mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-08-11 10:39:42 +00:00
implement BrowserWindow-API functions
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user