implement BrowserWindow-API functions

This commit is contained in:
Gregor Biswanger
2017-10-15 21:39:52 +02:00
parent 08b88e3adf
commit a4aa1dfae3
25 changed files with 1261 additions and 342 deletions

View File

@@ -12,16 +12,21 @@ namespace ElectronNET.WebApp.Controllers
Electron.IpcMain.On("SayHello", (args) => {
Electron.Notification.Show(new NotificationOptions("Hallo Robert","Nachricht von ASP.NET Core App"));
Electron.IpcMain.Send("Goodbye", "Elephant!");
Electron.IpcMain.Send(Electron.WindowManager.BrowserWindows.First(), "Goodbye", "Elephant!");
});
Electron.IpcMain.On("GetPath", async (args) =>
{
string pathName = await Electron.App.GetPathAsync(PathName.pictures);
Electron.IpcMain.Send("GetPathComplete", pathName);
var currentBrowserWindow = Electron.WindowManager.BrowserWindows.First();
Electron.WindowManager.BrowserWindows.First().Minimize();
await Electron.WindowManager.CreateWindowAsync("http://www.google.de");
string pathName = await Electron.App.GetPathAsync(PathName.pictures);
Electron.IpcMain.Send(currentBrowserWindow, "GetPathComplete", pathName);
currentBrowserWindow.Minimize();
await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions {
Title = "My second Window",
AutoHideMenuBar = true
},"http://www.google.de");
});

View File

@@ -43,7 +43,7 @@ namespace ElectronNET.WebApp
public async void Bootstrap()
{
Electron.Menu.SetApplicationMenu(new MenuItem[] {
var menuItems = new MenuItem[] {
new MenuItem {
Label = "File",
Submenu = new MenuItem[] {
@@ -66,19 +66,12 @@ namespace ElectronNET.WebApp
});
}
}
});
};
Electron.Menu.SetApplicationMenu(menuItems);
Electron.Tray.Show("/Assets/electron_32x32.png", menuItems);
var browserWindow = await Electron.WindowManager.CreateWindowAsync();
Electron.Tray.Show("/Assets/electron_32x32.png", new MenuItem[] {
new MenuItem {
Label = "Exit",
Click = () =>
{
Electron.App.Exit();
}
}
});
}
}
}