Esempio n. 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {

            bool isNewInstance = false;
            appMutex = new Mutex(true, "SamsungHotkeys", out isNewInstance);
            if(!isNewInstance)
            {
                Debug.WriteLine("Another instance of SamsungHotkeys is already running!");
                Application.Current.Shutdown();
                return;
            }

            try
            {
                hkMgr = new HotkeyManager(Dispatcher);
            }
            catch(Controls.InterfaceNotInitializedException ex)
            {
                MessageBox.Show("Unable to initialize the Samsung BIOS interface. It would seem that SABI.DLL is not properly installed.", "Samsung Hotkeys", MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown();
                return;
            }
            
            hkMgr.ShowOSDEvent += HkMgr_ShowOSDEvent;
            osdWindow.ShowActivated = false;
            osdWindow.Topmost = true;
            osdWindow.ShowInTaskbar = false;
            osdWindow.Opacity = 0;

            osdWindow.SizeChanged += OsdWindow_SizeChanged;

            osdWindow.Show();

            
        }
Esempio n. 2
0
        private void HkMgr_ShowOSDEvent(object sender, HotkeyManager.ShowOSDEventArgs e)
        {
            Debug.WriteLine("ShowOSDEvent: " + e.HotkeyEvent + "; HasLevel=" + e.HasLevel + "; Level=" + e.Level);

            switch(e.HotkeyEvent)
            {
                case Hotkey.EasySettings:
                    ShowSettingsWindow();
                    break;

                case Hotkey.ScreenBrightnessDown:
                case Hotkey.ScreenBrightnessUp:
                    ShowOSD("Display Brightness", e.Level / 100.0);
                    break;

                case Hotkey.DisplaySwitch:
                    if (SamsungHotkeys.Properties.Settings.Default.ShowUnusedOSDNotifications)
                    {
                        ShowOSD("Display Switch");
                    }
                    break;

                case Hotkey.TouchpadDisabled:
                    ShowOSD("Touchpad", "OFF", redTextBrush);
                    break;

                case Hotkey.TouchpadEnabled:
                    ShowOSD("Touchpad", "ON", greenTextBrush);
                    break;

                case Hotkey.KeyboardBacklightDown:
                case Hotkey.KeyboardBacklightUp:
                    ShowOSD("Keyboard Backlight", e.Level / 8.0);
                    break;

                case Hotkey.CoolingMode:
                    ShowOSD("Power Plan: ", (string)e.Parameter, lightTextBrush);
                    break;

                case Hotkey.ToggleWireless:
                    ShowOSD("WiFi / BT / WWAN", e.Level == 0 ? "OFF" : "ON", e.Level == 0 ? redTextBrush : greenTextBrush);
                    break;

                case Hotkey.FnLockDisabled:
                    ShowOSD("Fn-Lock", "OFF", redTextBrush);
                    break;

                case Hotkey.FnLockEnabled:
                    ShowOSD("Fn-Lock", "ON", greenTextBrush);
                    break;

                case Hotkey.EjectODD:
                    ShowOSD("Eject ODD");
                    break;
            }
        }