private NotifyIcon _notifyIcon; // The icon that sits in the system tray. #endregion Fields #region Constructors /// <summary> /// This class should be created and passed into Application.Run( ... ). /// </summary> public CustomApplicationContext() { try { InitializeContext(); InitializeCodeSnippetSource(); // Register Alt + A as global hotkey. _hotKeyManager = new HotkeyManager(this); RegisterHotKey(_hotKeyManager.Handle, HotKeyId, (int) KeyModifier.Alt, Keys.A.GetHashCode()); SetStartup(); } catch (Exception exception) { ErrorReport.Report(exception); throw; } }
public Win32MessagePump(HotkeyManager hotkeyManager, App app) { _hotkeyManager = hotkeyManager; _app = app; }
static void BindHotkeyPref(HotkeyDefinition hd, HotkeyManager manager, Widget template, Widget parent, Widget remapDialogRoot, Widget remapDialogPlaceholder) { var key = template.Clone() as Widget; key.Id = hd.Name; key.IsVisible = () => true; key.Get <LabelWidget>("FUNCTION").GetText = () => hd.Description + ":"; var remapButton = key.Get <ButtonWidget>("HOTKEY"); remapButton.GetText = () => manager[hd.Name].GetValue().DisplayString(); if (manager.GetFirstDuplicate(hd.Name, manager[hd.Name].GetValue(), hd) != null) { remapButton.GetColor = () => ChromeMetrics.Get <Color>("HotkeyColorInvalid"); } remapButton.OnClick = () => { remapDialogRoot.RemoveChildren(); if (remapButton.IsHighlighted()) { remapButton.IsHighlighted = () => false; if (remapDialogPlaceholder != null) { remapDialogPlaceholder.Visible = true; } return; } if (remapDialogPlaceholder != null) { remapDialogPlaceholder.Visible = false; } var siblings = parent.Children; foreach (var sibling in siblings) { var button = sibling.GetOrNull <ButtonWidget>("HOTKEY"); if (button != null) { button.IsHighlighted = () => false; } } remapButton.IsHighlighted = () => true; Ui.LoadWidget("HOTKEY_DIALOG", remapDialogRoot, new WidgetArgs { { "onSave", () => { remapButton.GetText = () => manager[hd.Name].GetValue().DisplayString(); remapButton.GetColor = () => ChromeMetrics.Get <Color>("ButtonTextColor"); } }, { "hotkeyDefinition", hd }, { "hotkeyManager", manager }, }); }; parent.AddChild(key); }
public HotkeyWindow(HotkeyManager Parent) { this._Parent = Parent; this.CreateHandle(new CreateParams()); }
public WorldSnapshotImpl(ISnapshotPanel snapshotPanel, IEditorPlugin editorPlugin, HotkeyManager hotkeyManager) { this.snapshotPanel = snapshotPanel; this.editorPlugin = editorPlugin; this.hotkeyManager = hotkeyManager; GameCallbacks.AddInstallCallback(OnInstallCallback); GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback); GameCallbacks.AddCleanupSceneCall(OnCleanupCallback); ObjectCallbacks.AddOnTargetCallback(OnTarget); ImGuiCallbacks.AddOnEnabledCallback(OnGizmoEnabled); ImGuiCallbacks.AddOnDisabledCallback(OnGizmoDisabled); ImGuiCallbacks.AddOnPositionChangedCallback(OnPositionChanged); ImGuiCallbacks.AddOnRotationChangedCallback(OnRotationChanged); hotkeyManager.Add(new Hotkey("ToggleSnapshotNodeEditingMode", "Toggle Snapshot Node Editing Mode", "Oemtilde", ToggleNodeEditing, true)); hotkeyManager.Add(new Hotkey("SaveSnapshot", "Save Snapshot", "Control + S", Save, true)); hotkeyManager.Add(new Hotkey("CopySnapshotNode", "Copy Snapshot Node", "Control + C", CopyNode, true)); hotkeyManager.Add(new Hotkey("PasteSnapshotNode", "Paste Snapshot Node", "Control + V", PasteNode, true)); hotkeyManager.Add(new Hotkey("DuplicateSnapshotNode", "Duplicate Snapshot Node", "Control + D", DuplicateNode, true)); hotkeyManager.Add(new Hotkey("DeleteSnapshotNode", "Delete Snapshot Node", "Delete", RemoveNode, true)); hotkeyManager.Add(new Hotkey("SetGizmoTranslateOperationMode", "Set Gizmo Operation Mode to Translate", "Control + Q", SetOperationModeToTranslateHotkey, true, false)); hotkeyManager.Add(new Hotkey("SetGizmoRotationOperationMode", "Set Gizmo Operation Mode to Rotation", "Control + E", SetOperationModeToRotationHotkey, true, false)); hotkeyManager.Add(new Hotkey("ToggleGizmoSnap", "Toggle Gizmo Snap", "Control + B", ToggleGizmoSnapHotkey, true, false)); }
private void MainWindowLoaded(object sender, RoutedEventArgs args) { var dimensions = SettingsManager.Dimensions; Width = dimensions.Width; Left = dimensions.Left; Top = dimensions.Top; Height = dimensions.Height; if (dimensions.LeftSideWidth != 1 || dimensions.RightSideWidth != 1) { ContentGrid.ColumnDefinitions[0].Width = new GridLength(dimensions.LeftSideWidth, GridUnitType.Star); ContentGrid.ColumnDefinitions[2].Width = new GridLength(dimensions.RightSideWidth, GridUnitType.Star); } if (AllowsTransparency) { ToggleEditMode.Content = viewModel.Languages.Translate("Unlock Window"); MainSplitter.Visibility = Visibility.Hidden; } else { ToggleEditMode.Content = viewModel.Languages.Translate("Lock Window"); ResetWindowPositionButton.Visibility = Visibility.Visible; } menu = TrayIconManager.BuildContextMenu((o, e) => ShowWindow(), (o, e) => Close(), ConfigureShortcut, (o, e) => ToggleEditModeChecked(o, null), (o, e) => ResetWindowPositionButtonClicked(o, null), (o, e) => Languages.PromptLanguage(viewModel.Languages), () => serverBridge.Toggle(), serverBridge.Running, (o, e) => { ReleaseNotesManager.ShowReleaseNotes(); }, Properties.Settings.Default.CurrentVersion, (o, e) => { ThresholdsManagerWindow.ShowThresholds(viewModel.Languages, viewModel.CurrentCommander.Value.State.Cargo, viewModel.CurrentCommander.Key); }, (o, e) => { new NotificationSettingsWindow(viewModel.Languages).ShowDialog(); }, (o, e) => { new GraphicSettingsWindow(viewModel.GraphicSettings).ShowDialog(); }); icon = TrayIconManager.Init(menu); try { var shortcut = SettingsManager.Shortcut; var hotKey = (Keys) new KeysConverter().ConvertFromString(shortcut); HotkeyManager.RegisterHotKey(this, hotKey); } catch { SettingsManager.Shortcut = null; ConfigureShortcut(this, EventArgs.Empty); ShowWindow(); } Blueprints.UpdateLayout(); ShoppingList.UpdateLayout(); if (!AllowsTransparency) { saveDimensionScheduler = new PostponeScheduler(SaveDimensions, 500); SizeChanged += (o, e) => saveDimensionScheduler.Schedule(); LocationChanged += (o, e) => saveDimensionScheduler.Schedule(); MainSplitter.DragCompleted += (o, e) => saveDimensionScheduler.Schedule(); } }
public HotkeysTabViewModel() { _hotkeyManager = HotkeyManager.GetInstance(); }
public void Awake() { instance = this; }
public HotkeysTabViewModel() { _hotkeyManager = HotkeyManager.GetInstance(); _hotkeyManager.ClearAllHotkeys = ClearAllHotkeys; }