public MainWindow() { InitializeComponent(); backlightPercentButtons.Add(new Button() { Content = "25 %", Style = FindResource("ButtonStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "50 %", Style = FindResource("ButtonSelectedStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "75 %", Style = FindResource("ButtonStyle") as Style }); backlightPercentButtons.Add(new Button() { Content = "100 %", Style = FindResource("ButtonStyle") as Style }); foreach (var backlightPercentButton in backlightPercentButtons) { backlightPercentButton.Click += BacklightPercentButton_Click; } SourceInitialized += (s, e) => { #if !UI_DESIGN PowerSetting.Init(new WindowInteropHelper(this).Handle); PowerSetting.OnMonitorStateChanged += PowerSetting_OnMonitorStateChanged; KeyboardHook.Init(); KeyboardHook.OnNumLockPressed += KeyboardHook_OnNumLockPressed; #endif }; Loaded += (s, e) => { Hide(); }; Unloaded += (s, e) => { #if !UI_DESIGN PowerSetting.Dispose(); KeyboardHook.Dispose(); #endif }; Closed += (s, e) => { taskbarIcon.Dispose(); #if !UI_DESIGN Chroma.Instance.Unregister(); Chroma.Instance.Uninitialize(); LogitechGSDK.LogiLedShutdown(); #endif }; CreateTaskbarIconInit(); #if !UI_DESIGN WaitForLEDSDKInit(); #else CreateTaskbarIcon(); #endif }
static void Main(string[] args) { KeyboardHook.Init(); Application.EnableVisualStyles(); Application.Run(new MainUI()); }