mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Merge pull request #932 from softworkz/submit_platform_specific
Webb app: add platform guards and promote analyzer severity
This commit is contained in:
4
src/.editorconfig
Normal file
4
src/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CA1416: Validate platform compatibility
|
||||
dotnet_diagnostic.CA1416.severity = error
|
||||
@@ -10,36 +10,20 @@ namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
if (HybridSupport.IsElectronActive)
|
||||
{
|
||||
Electron.PowerMonitor.OnLockScreen += () =>
|
||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsWindows())
|
||||
{
|
||||
Console.WriteLine("Screen Locked detected from C#");
|
||||
};
|
||||
Electron.PowerMonitor.OnLockScreen += () => { Console.WriteLine("Screen Locked detected from C#"); };
|
||||
|
||||
Electron.PowerMonitor.OnUnLockScreen += () =>
|
||||
{
|
||||
Console.WriteLine("Screen unlocked detected from C# ");
|
||||
};
|
||||
Electron.PowerMonitor.OnUnLockScreen += () => { Console.WriteLine("Screen unlocked detected from C# "); };
|
||||
|
||||
Electron.PowerMonitor.OnSuspend += () =>
|
||||
{
|
||||
Console.WriteLine("The system is going to sleep");
|
||||
};
|
||||
Electron.PowerMonitor.OnSuspend += () => { Console.WriteLine("The system is going to sleep"); };
|
||||
|
||||
Electron.PowerMonitor.OnResume += () =>
|
||||
{
|
||||
Console.WriteLine("The system is resuming");
|
||||
};
|
||||
Electron.PowerMonitor.OnResume += () => { Console.WriteLine("The system is resuming"); };
|
||||
|
||||
Electron.PowerMonitor.OnAC += () =>
|
||||
{
|
||||
Console.WriteLine("The system changes to AC power");
|
||||
};
|
||||
|
||||
Electron.PowerMonitor.OnBattery += () =>
|
||||
{
|
||||
Console.WriteLine("The system is about to change to battery power");
|
||||
};
|
||||
Electron.PowerMonitor.OnAC += () => { Console.WriteLine("The system changes to AC power"); };
|
||||
|
||||
Electron.PowerMonitor.OnBattery += () => { Console.WriteLine("The system is about to change to battery power"); };
|
||||
}
|
||||
}
|
||||
|
||||
return View();
|
||||
|
||||
@@ -55,39 +55,42 @@ namespace ElectronNET.WebApp
|
||||
});
|
||||
});
|
||||
|
||||
Electron.Dock.SetMenu(new[]
|
||||
if (System.OperatingSystem.IsMacOS())
|
||||
{
|
||||
new MenuItem
|
||||
Electron.Dock.SetMenu(new[]
|
||||
{
|
||||
Type = MenuType.normal,
|
||||
Label = "MenuItem",
|
||||
Click = () =>
|
||||
new MenuItem
|
||||
{
|
||||
Electron.Notification.Show(new NotificationOptions(
|
||||
"Dock MenuItem Click",
|
||||
"A menu item added to the Dock was selected;"));
|
||||
},
|
||||
},
|
||||
new MenuItem
|
||||
{
|
||||
Type = MenuType.submenu,
|
||||
Label = "SubMenu",
|
||||
Submenu = new[]
|
||||
{
|
||||
new MenuItem
|
||||
Type = MenuType.normal,
|
||||
Label = "MenuItem",
|
||||
Click = () =>
|
||||
{
|
||||
Type = MenuType.normal,
|
||||
Label = "Sub MenuItem",
|
||||
Click = () =>
|
||||
{
|
||||
Electron.Notification.Show(new NotificationOptions(
|
||||
"Dock Sub MenuItem Click",
|
||||
"A menu item added to the Dock was selected;"));
|
||||
},
|
||||
Electron.Notification.Show(new NotificationOptions(
|
||||
"Dock MenuItem Click",
|
||||
"A menu item added to the Dock was selected;"));
|
||||
},
|
||||
},
|
||||
new MenuItem
|
||||
{
|
||||
Type = MenuType.submenu,
|
||||
Label = "SubMenu",
|
||||
Submenu = new[]
|
||||
{
|
||||
new MenuItem
|
||||
{
|
||||
Type = MenuType.normal,
|
||||
Label = "Sub MenuItem",
|
||||
Click = () =>
|
||||
{
|
||||
Electron.Notification.Show(new NotificationOptions(
|
||||
"Dock Sub MenuItem Click",
|
||||
"A menu item added to the Dock was selected;"));
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user