Sicherung
This commit is contained in:
59
FSI.BT.Tools/RadialMenu/Buisness/Main.cs
Normal file
59
FSI.BT.Tools/RadialMenu/Buisness/Main.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
namespace FSI.BT.Tools.RadialMenu.Business
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using FSI.BT.Tools.RadialMenu.Handler;
|
||||
using FSI.Lib.Wpf.ExtensionMethods;
|
||||
|
||||
internal class Main : IDisposable
|
||||
{
|
||||
|
||||
private readonly KeyboardInput keyboardInput;
|
||||
private UserInterface.FrmRadialMenu frmRadialMenu;
|
||||
public Main()
|
||||
{
|
||||
keyboardInput = new();
|
||||
keyboardInput.RegisterHotKey();
|
||||
keyboardInput.HotKeyPressed += KeyboardInput_HotKeyPressed;
|
||||
|
||||
frmRadialMenu = new UserInterface.FrmRadialMenu();
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
keyboardInput.HotKeyPressed -= KeyboardInput_HotKeyPressed;
|
||||
keyboardInput.Dispose();
|
||||
}
|
||||
|
||||
private void KeyboardInput_HotKeyPressed()
|
||||
{
|
||||
|
||||
|
||||
Thread thread = new(() =>
|
||||
{
|
||||
UserInterface.FrmRadialMenu frmRadialMenu = new();
|
||||
|
||||
if (Global.Vars.UserRights || Global.Vars.AdminRights)
|
||||
{
|
||||
if (frmRadialMenu.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
frmRadialMenu.ShowCenteredToMouse();
|
||||
frmRadialMenu.ActivateCenteredToMouse();
|
||||
|
||||
}
|
||||
|
||||
frmRadialMenu.Closed += (sender2, e2) => frmRadialMenu.Dispatcher.InvokeShutdown();
|
||||
|
||||
System.Windows.Threading.Dispatcher.Run();
|
||||
}
|
||||
});
|
||||
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user