Files
FSI.BT.IR.Tools/FSI.BT.Tools/App.xaml.cs
2022-03-23 14:16:48 +01:00

66 lines
2.2 KiB
C#

using Hardcodet.Wpf.TaskbarNotification;
using NHotkey;
using NHotkey.Wpf;
using System.Windows;
using System.Windows.Input;
namespace FSI.BT.Tools
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : System.Windows.Application
{
private static readonly KeyGesture RadialMenu = new KeyGesture(Key.OemBackslash, ModifierKeys.Control);
private static readonly KeyGesture TimeStamp = new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Alt);
public void Application_Startup(object sender, StartupEventArgs e)
{
Global.Settings = new AppSettings(GetType().Namespace.ToString() + ".xml");
Global.Settings.Load();
Global.TaskbarIcon = (TaskbarIcon)FindResource("FSINotifyIcon");
Global.AdminRights = Admin.CheckAdminRight();
Global.SuperAdminRights = Admin.CheckSuperAdminRight();
Global.UserRights = Admin.CheckUserRight();
HotkeyManager.Current.AddOrReplace("RadialMenu", RadialMenu, ShowRadialMenu);
HotkeyManager.Current.AddOrReplace("TimeStampToClipboard", TimeStamp, TimeStampToClipboard);
Global.FrmRadialMenu = new FrmRadialMenu();
Global.WinCC = new Lib.Guis.SieTiaWinCCMsgMgt.WinCC(
Global.Settings.SieTiaWinCCMsgMgtAutostart,
Global.Settings.SieTiaWinCCMsgMgtUpdateIntervall,
Global.Settings.SieTiaWinCCMsgMgtWindowsName,
Global.Settings.SieTiaWinCCMsgMgtClassName,
Global.Settings.SieTiaWinCCMsgMgtBtnName
);
}
private void ShowRadialMenu(object sender, HotkeyEventArgs e)
{
var cmd = new Commands.RadialMenuCommand();
if (cmd.CanExecute(null))
cmd.Execute(null);
e.Handled = true;
}
private void TimeStampToClipboard(object sender, HotkeyEventArgs e)
{
var cmd = new Commands.TimeStampToClipboardCommand();
cmd.Execute(null);
e.Handled = true;
}
private void Application_Exit(object sender, ExitEventArgs e)
{
Global.Settings.Save();
}
}
}