public OptionsWindow() { InitializeComponent(); // Show what's already selected _hotkey = (HotKey)Application.Current.Properties["hotkey"]; try { _hotkey.LoadSettings(); } catch (HotkeyAlreadyInUseException) { } _hotkeyViewModel = new HotkeyViewModel { KeyCode = KeyInterop.KeyFromVirtualKey((int)_hotkey.KeyCode), Alt = _hotkey.Alt, Ctrl = _hotkey.Ctrl, Windows = _hotkey.WindowsKey, Shift = _hotkey.Shift }; HotkeyPreview.Text = _hotkeyViewModel.ToString(); AltTabCheckBox.IsChecked = Settings.Default.AltTabHook; RunAsAdministrator.IsChecked = Settings.Default.RunAsAdmin; }
public OptionsWindow() { InitializeComponent(); // Show what's already selected _hotkey = (HotKey) Application.Current.Properties["hotkey"]; try { _hotkey.LoadSettings(); } catch (HotkeyAlreadyInUseException) { } _hotkeyViewModel = new HotkeyViewModel { KeyCode = KeyInterop.KeyFromVirtualKey((int) _hotkey.KeyCode), Alt = _hotkey.Alt, Ctrl = _hotkey.Ctrl, Windows = _hotkey.WindowsKey, Shift = _hotkey.Shift }; HotkeyPreview.Text = _hotkeyViewModel.ToString(); AltTabCheckBox.IsChecked = Settings.Default.AltTabHook; }
private void SetUpHotKey() { _hotkey = new HotKey(); _hotkey.LoadSettings(); Application.Current.Properties["hotkey"] = _hotkey; _hotkey.HotkeyPressed += hotkey_HotkeyPressed; try { _hotkey.Enabled = Settings.Default.EnableHotKey; } catch (HotkeyAlreadyInUseException) { var boxText = "The current hotkey for activating Switcheroo is in use by another program." + Environment.NewLine + Environment.NewLine + "You can change the hotkey by right-clicking the Switcheroo icon in the system tray and choosing 'Options'."; MessageBox.Show(boxText, "Hotkey already in use", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// ================================= #region Private Methods /// ================================= private void SetUpHotKey() { _hotkey = new HotKey(); _hotkey.LoadSettings(); Application.Current.Properties["hotkey"] = _hotkey; _hotkey.HotkeyPressed += hotkey_HotkeyPressed; try { _hotkey.Enabled = true; } catch (HotkeyAlreadyInUseException) { var boxText = "The current hotkey for activating Switcheroo is in use by another program." + Environment.NewLine + Environment.NewLine + "You can change the hotkey by right-clicking the Switcheroo icon in the system tray and choosing 'Options'."; MessageBox.Show(boxText, "Hotkey already in use", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public OptionsWindow() { InitializeComponent(); // Show what's already selected _hotkey = (HotKey)Application.Current.Properties["hotkey"]; try { _hotkey.LoadSettings(); } catch (HotkeyAlreadyInUseException) { } _hotkeyViewModel = new HotkeyViewModel { KeyCode = KeyInterop.KeyFromVirtualKey((int)_hotkey.KeyCode), Alt = _hotkey.Alt, Ctrl = _hotkey.Ctrl, Windows = _hotkey.WindowsKey, Shift = _hotkey.Shift }; HotKeyCheckBox.IsChecked = Settings.Default.EnableHotKey; HotkeyPreview.Text = _hotkeyViewModel.ToString(); HotkeyPreview.IsEnabled = Settings.Default.EnableHotKey; AltTabCheckBox.IsChecked = Settings.Default.AltTabHook; AutoSwitch.IsChecked = Settings.Default.AutoSwitch; AutoSwitch.IsEnabled = Settings.Default.AltTabHook; InstantReleaseSwitch.IsChecked = Settings.Default.InstantReleaseSwitch; MaximumQueryResultCountCheckBox.IsChecked = Settings.Default.MaximumResultCountEnabled; MaximumQueryResultCount.IsEnabled = (bool)MaximumQueryResultCountCheckBox.IsChecked; MaximumQueryResultCount.Text = Settings.Default.MaximumResultCount.ToString(); RunAsAdministrator.IsChecked = Settings.Default.RunAsAdmin; }