public PluginMenu(List <Plugin> list) { InitializeComponent(); //горячие клавиши AppSettingsReader reader = new AppSettingsReader(); KeyGestureConverter gestureConverter = new KeyGestureConverter(); try { string tmp = (string)reader.GetValue("Esc", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture escKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding escKeyBinding = new KeyBinding(new RelayCommand(o => { MinHeight = 0; var animation = new DoubleAnimation(); animation.From = Height; animation.To = MinHeight; animation.Duration = TimeSpan.FromSeconds(0.5); animation.Completed += animation_Completed; this.BeginAnimation(HeightProperty, animation); }, o => true), escKeyGesture); InputBindings.Add(escKeyBinding); } catch { } PluginList.ItemsSource = list; }
public SaveGameDialog() { InitializeComponent(); InputBindings.Add( new KeyBinding(GenericCommands.CancelCommand, Key.Escape, ModifierKeys.None)); InputBindings.Add( new KeyBinding(GenericCommands.AcceptCommand, Key.Enter, ModifierKeys.None)); CommandBindings.Add(new CommandBinding( GameCommands.SaveGameCommand, GameCommandsSaveGameCommandExecuted)); CommandBindings.Add( new CommandBinding(GenericCommands.CancelCommand, GenericCommandsCancelCommandExecuted)); CommandBindings.Add( new CommandBinding(GenericCommands.AcceptCommand, GenericCommandsAcceptCommandExecuted, GenericCommandsAcceptCommandCanExecute)); IsVisibleChanged += SaveGameDialogIsVisibleChanged; SaveGameList.SelectionChanged += SaveGameListSelectionChanged; }
private string GetSearchWatermark() { var focusOnSearchKeyGesture = (KeyGesture)InputBindings.OfType <KeyBinding>().First( x => x.Command == Commands.FocusOnSearchBox).Gesture; return($"Search ({focusOnSearchKeyGesture.GetDisplayStringForCulture(CultureInfo.CurrentCulture)})"); }
/// <summary> /// Binding HotKey /// </summary> private void BindHotkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals("Select")) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control); key = new KeyBinding(SelectCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DONG))) { KeyGesture keyg = new KeyGesture(Key.Escape, ModifierKeys.None); key = new KeyBinding(CloseCommand, keyg); key.Gesture = keyg; } InputBindings.Add(key); } } }
private void InitializeCommandBindings() { CommandBindings.Add(new CommandBinding(ProbeOptionsCommand, ProbeOptionsExecute)); CommandBindings.Add(new CommandBinding(StartStopCommand, StartStopExecute)); CommandBindings.Add(new CommandBinding(HelpCommand, HelpExecute)); CommandBindings.Add(new CommandBinding(NewInstanceCommand, NewInstanceExecute)); CommandBindings.Add(new CommandBinding(TraceRouteCommand, TraceRouteExecute)); CommandBindings.Add(new CommandBinding(FloodHostCommand, FloodHostExecute)); CommandBindings.Add(new CommandBinding(AddMonitorCommand, AddMonitorExecute)); var kgProbeOptions = new KeyGesture(Key.F10); var kgStartStop = new KeyGesture(Key.F5); var kgHelp = new KeyGesture(Key.F1); var kgNewInstance = new KeyGesture(Key.N, ModifierKeys.Control); var kgTraceRoute = new KeyGesture(Key.T, ModifierKeys.Control); var kgFloodHost = new KeyGesture(Key.F, ModifierKeys.Control); var kgAddMonitor = new KeyGesture(Key.A, ModifierKeys.Control); InputBindings.Add(new InputBinding(ProbeOptionsCommand, kgProbeOptions)); InputBindings.Add(new InputBinding(StartStopCommand, kgStartStop)); InputBindings.Add(new InputBinding(HelpCommand, kgHelp)); InputBindings.Add(new InputBinding(NewInstanceCommand, kgNewInstance)); InputBindings.Add(new InputBinding(TraceRouteCommand, kgTraceRoute)); InputBindings.Add(new InputBinding(FloodHostCommand, kgFloodHost)); InputBindings.Add(new InputBinding(AddMonitorCommand, kgAddMonitor)); StartStopMenu.Command = StartStopCommand; HelpMenu.Command = HelpCommand; NewInstanceMenu.Command = NewInstanceCommand; TraceRouteMenu.Command = TraceRouteCommand; FloodHostMenu.Command = FloodHostCommand; AddMonitorMenu.Command = AddMonitorCommand; }
private void BindShortkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control); key = new KeyBinding(SaveCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XUAT_DU_LIEU))) { KeyGesture keyg = new KeyGesture(Key.E, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ExportCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { KeyGesture keyg = new KeyGesture(Key.F1, ModifierKeys.None); key = new KeyBinding(HelpCommand, keyg); } if (key != null) { InputBindings.Add(key); } } } }
private void EditInputBinding(MenuItem menu, ModifierKeys modifier) { KeyConverter k = new KeyConverter(); Key key = (Key)k.ConvertFromString(menu.InputGestureText); InputBindingCollection InputBindingsCopy = new InputBindingCollection(InputBindings); foreach (KeyBinding item in InputBindingsCopy) { if (item.Key == key) { if (modifier == ModifierKeys.None) { InputBindings.Remove(item); } else { item.Modifiers = modifier; if (modifier == ModifierKeys.Control) { menu.InputGestureText = "CTRL+" + menu.InputGestureText; } } break; } } }
public void AttachControls() { MainMenuContainer.Content = SessionCore.Instance.Menu; RatingViewerContainer.Content = SessionCore.Instance.RatingViewer; LayersContainer.Content = SessionCore.Instance.Layers; InputBindings.AddRange(mainForm.InputBindings); CommandBindings.AddRange(mainForm.CommandBindings); SessionCore.Instance.Downloads.Owner = this; // Adjust menu foreach (MenuItem item in SessionCore.Instance.Menu.menuSession.Items.OfType <MenuItem>()) { if (item != SessionCore.Instance.Menu.menuStartSession) { if (item == SessionCore.Instance.Menu.menuManualMode || item == SessionCore.Instance.Menu.menuIgnorePos) { EditInputBinding(item, ModifierKeys.Control); } else { item.IsEnabled = false; EditInputBinding(item, ModifierKeys.None); } } } EditInputBinding(SessionCore.Instance.Menu.menuEditVideo, ModifierKeys.Control); EditInputBinding(SessionCore.Instance.Menu.menuDownloadVideo, ModifierKeys.Control); EditInputBinding(SessionCore.Instance.Menu.menuSettings, ModifierKeys.Control); LayersRow.Height = new GridLength(SessionCore.Instance.Layers.Height); if (SessionCore.Instance.Business.CurrentVideo != null) { business_NowPlaying(null, new NowPlayingEventArgs()); } }
public void Initialize() { this.OnActualUnload(_discordPresence); if (!(DataContext is ViewModel)) { return; } InitializeComponent(); InputBindings.AddRange(new[] { new InputBinding(new AsyncCommand(() => Model.GoCommand.ExecuteAsync(AssistsViewModel.Instance)), new KeyGesture(Key.G, ModifierKeys.Control)), new InputBinding(new DelegateCommand(() => UserChampionships.NavigateToChampionshipPage(null)), new KeyGesture(Key.W, ModifierKeys.Control)), }); var acObject = Model.AcObject; if (acObject.LastSelectedTimestamp == 0) { if (_ignoreIntroId != acObject.Id) { new UserChampionshipIntro(acObject).ShowDialog(); } acObject.LastSelectedTimestamp = DateTime.Now.ToMillisecondsTimestamp(); } _discordPresence.Details = $"Championships | {acObject.DisplayName}"; }
public MainWindow( IAudioService audioService, IDictionaryService dictionaryService, IInputService inputService, IKeyStateService keyStateService) { InitializeComponent(); this.audioService = audioService; this.dictionaryService = dictionaryService; this.inputService = inputService; this.keyStateService = keyStateService; defaultPointSource = inputService.PointSource; manualModePointSource = new MousePositionSource(Settings.Default.PointTtl) { State = RunningStates.Paused }; managementWindowRequest = new InteractionRequest <NotificationWithServicesAndState>(); managementWindowRequestCommand = new DelegateCommand(RequestManagementWindow); toggleManualModeCommand = new DelegateCommand(ToggleManualMode, () => !(defaultPointSource is MousePositionSource)); quitCommand = new DelegateCommand(Quit); backCommand = new DelegateCommand(Back); //Setup key binding (Alt+M and Shift+Alt+M) to open settings InputBindings.Add(new KeyBinding { Command = managementWindowRequestCommand, Modifiers = ModifierKeys.Alt, Key = Key.M }); InputBindings.Add(new KeyBinding { Command = managementWindowRequestCommand, Modifiers = ModifierKeys.Shift | ModifierKeys.Alt, Key = Key.M }); //Setup key binding (Alt+Enter and Shift+Alt+Enter) to open settings InputBindings.Add(new KeyBinding { Command = toggleManualModeCommand, Modifiers = ModifierKeys.Alt, Key = Key.Enter }); InputBindings.Add(new KeyBinding { Command = toggleManualModeCommand, Modifiers = ModifierKeys.Shift | ModifierKeys.Alt, Key = Key.Enter }); Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion); //Set the window size to 0x0 as this prevents a flicker where OptiKey would be displayed in the default position and then repositioned Width = 0; Height = 0; }
public MainWindow() : base(250, 420, 250, 420) { InitializeComponent(); DataContext = new MainViewModel(); InputBindings.Add(new KeyBinding(DataContext.AboutCommand, new KeyGesture(Key.F1))); InputBindings.Add(new KeyBinding(DataContext.CopyTimeToClipboardCommand, new KeyGesture(Key.C, ModifierKeys.Control))); }
public GłówneOkno() { InitializeComponent(); InputBindings.Add(new KeyBinding(new Komenda(Nowy_OnClick), Key.N, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(new Komenda(Otwórz_OnClick), Key.O, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(new Komenda(Zapisz_OnClick), Key.S, ModifierKeys.Control)); }
public ElPueblo(UIEnvironment env, Point location, Size?size = null) : base(env, location, size ?? new Size(64, 64)) { InputBindings.Add(new MouseBinding(BeepBoopElPueblo, this)); InputBindings.Add(new KeyBinding(() => Move(5), ConsoleKeyEx.RightArrow)); InputBindings.Add(new KeyBinding(() => Move(-5), ConsoleKeyEx.LeftArrow)); InputBindings.Add(new KeyBinding(() => Move(y: 5), ConsoleKeyEx.UpArrow)); InputBindings.Add(new KeyBinding(() => Move(y: -5), ConsoleKeyEx.DownArrow)); }
public MainWindow() { InitializeComponent(); var viewModel = (MainViewModel)DataContext; viewModel.Window = this; InputBindings.AddRange(viewModel.KeyBindings); }
public void Dispose() { // Let's ensure everything is cleaned up. foreach (var keyBindings in InputBindings.OfType <KeyBinding>()) { HotkeyManager.SetRegisterGlobalHotkey(keyBindings, false); } }
public MetroWindow() { SetValue(winChrome_WindowChromeProperty, CreateWindowChromeObject()); // Since the system menu had to be disabled, we must add this command var cmd = new RelayCommand(a => ShowSystemMenu(this), a => !IsFullScreen); InputBindings.Add(new KeyBinding(cmd, Key.Space, ModifierKeys.Alt)); }
protected DialogBase() { ShowInTaskbar = false; _okCommand = new DelegateCommand(OkCommandExecuted, OkCommandCanExecute); _cancelCommand = new DelegateCommand(CancelCommandExecuted); InputBindings.Add(new KeyBinding(OkCommand, Key.Enter, ModifierKeys.None)); InputBindings.Add(new KeyBinding(CancelCommand, Key.Escape, ModifierKeys.None)); }
protected override void InitializeOverride(Uri uri) { InitializeComponent(); InputBindings.AddRange(new[] { new InputBinding(SelectAllCarsCommand, new KeyGesture(Key.A, ModifierKeys.Control)), new InputBinding(RemoveSelectionFromCarsCommand, new KeyGesture(Key.D, ModifierKeys.Control)), }); }
public LD44Game() { _graphics = new GraphicsDeviceManager(this); _screens = new ScreenStack(); _inputBindings = new InputBindings(); Content.RootDirectory = "Content"; }
public DragSelector() { CommandBindings.Add(new CommandBinding(NextCommand, new ExecutedRoutedEventHandler(NextCommandExecuted), new CanExecuteRoutedEventHandler(NextCommandCanExecute))); InputBindings.Add(new InputBinding(NextCommand, new KeyGesture(Key.Down, ModifierKeys.None))); CommandBindings.Add(new CommandBinding(PreviousCommand, new ExecutedRoutedEventHandler(PreviousCommandExecuted), new CanExecuteRoutedEventHandler(PreviousCommandCanExecute))); InputBindings.Add(new InputBinding(PreviousCommand, new KeyGesture(Key.Up, ModifierKeys.None))); }
public MultiSelectTreeView() { InitializeComponent(); var ib = new KeyBinding(ApplicationCommands.Copy, Key.C, ModifierKeys.Control); InputBindings.Add(ib); }
public OpenFileListDlg() { InitializeComponent(); this.listView.SelectionChanged += ListView_SelectionChanged; this.listView.KeyDown += ListView_KeyDown; InputBindings.Add(new KeyBinding(new RelayCommand(a => searchBox.Focus()), Key.E, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(new RelayCommand(a => searchBox.Focus()), Key.F, ModifierKeys.Control)); }
public void WithNextCharacter(Action <Char> with) { defaultInsert = false; InputBindings.Clear(); withCharacter = with; }
private void SetModel() { _model?.Unload(); InitializeAcObjectPage(_model = new ViewModel(_object)); InputBindings.AddRange(new[] { new InputBinding(_model.TestCommand, new KeyGesture(Key.G, ModifierKeys.Control)) }); }
public MainWindowViewModel() { KeyBinding kb = new KeyBinding { Key = Key.T, Command = MyCommand }; InputBindings.Add(kb); }
private void BindShortkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU_TAM))) { KeyGesture keyg = new KeyGesture(Key.H, ModifierKeys.Control); key = new KeyBinding(HoldCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRINH_DUYET))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control); key = new KeyBinding(SaveCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.SUA))) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ModifyCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XOA))) { KeyGesture keyg = new KeyGesture(Key.Delete, ModifierKeys.Shift); key = new KeyBinding(DeleteCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DUYET))) { KeyGesture keyg = new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ApproveCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TU_CHOI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(RefuseCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THOAI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CancelCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { KeyGesture keyg = new KeyGesture(Key.F1, ModifierKeys.None); key = new KeyBinding(HelpCommand, keyg); } if (key != null) { InputBindings.Add(key); } } } }
private void GameScreenUnloaded(object sender, RoutedEventArgs e) { StopDescendantAnimations(); CommandBindings.Clear(); InputBindings.Clear(); ClientEvents.ChatMessageReceived.Unsubscribe(OnChatMessageReceived); ClientEvents.AllTurnEnded.Unsubscribe(OnAllTurnEnded); ClientEvents.TurnStarted.Unsubscribe(OnTurnStarted); }
/// <summary> /// Initializes a new instance of the HamburgerMenuEx class. /// </summary> public HamburgerMenuEx() { DefaultStyleKey = typeof(HamburgerMenuEx); SetResourceReference(DefaultItemFocusVisualStyleProperty, SystemParameters.FocusVisualStyleKey); SetResourceReference(ClientAreaAnimationProperty, SystemParameters.ClientAreaAnimationKey); InputBindings.Add(new KeyBinding(new GoBackCommand(this), Key.Left, ModifierKeys.Alt)); }
private void Awake() { TickableManager.Instance.Subscribe(this); playerHUD = gameObject.GetComponentInChildren <IPlayerHUD>(); playerHUD.Setup(playerData); playerMovement = GetComponent <IPlayerMovement>(); inputBindings = GetComponent <PlayerInputBindings>().GetInputBindings(); playerInventory = (IQueuInventory)InventoryFactory.GetInstance().GetInventory(InventoryType.QueueInventory, 2); }
// Returns the text to be displayed in the search box. private string GetSearchText() { var focusOnSearchKeyGesture = (KeyGesture)InputBindings.OfType <KeyBinding>().First( x => x.Command == Commands.FocusOnSearchBox).Gesture; return(string.Format(CultureInfo.CurrentCulture, Resx.Resources.Text_SearchBoxText, focusOnSearchKeyGesture.GetDisplayStringForCulture(CultureInfo.CurrentCulture))); }
// Use this for initialization void Start() { inputBindings = new InputBindings(); loadComponents(); }
public void Init( InputBindings bindings ) { this.bindings = bindings; actions = this.bindings.Actions; }
void Awake() { Input = new InputBindings(); }