/// <summary> /// The update method called in state machine /// </summary> public void Tick() { var resultState = (int)ResultState.SelectedState; if (this.currentSlot != null) // slot is touched by card (for error check) { if (this.currentSlot.GetCursorOnSlot() && Input.GetMouseButtonUp(0)) // finger/mouse is touching the slot and the input is released { if (SlotDict.slot_dictionary_manager.IsAvailable(this.currentSlot.slot.slotNumber)) // slot is not already filled { // IN SLOT STATE :: card is snapped to slot position //this.stateMachine.changeState(new InSlotState(this, this.in_slot, this.arr_of_slots, this.DoIfSnappedToSlot)); resultState = (int)ResultState.InSlotState; Debug.Log("Hello"); } } else if (!this.currentSlot.GetCursorOnSlot() && Input.GetMouseButtonUp(0)) // finger/mouse is NOT touching the slot { // and the input is released // NOT SNAPPING STATE :: card is puched away //this.stateMachine.changeState(new NoSnappingState(this, in_slot, this.DoIfNotSnappedToSlot)); resultState = (int)ResultState.NoSnappingState; } } // return result as a callback var res = new SelectedResults(resultState); this.resultCallBack(res); }
private void RecalculateCanExecute(object obj = null) { this.CanExecute = SelectedResults != null && !string.IsNullOrWhiteSpace(this.env1) && !string.IsNullOrWhiteSpace(this.env2) && SelectedResults.Any(_ => !_.IsActioned()) && additionalCriteriaOnSelectedResults(this.SelectedResults); }
private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => { if (!ResultsSelected()) { SelectedResults = Results; } else { MainWindowVisibility = Visibility.Collapsed; } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); StartHelpCommand = new RelayCommand(_ => { Process.Start("http://doc.getwox.com"); }); OpenResultCommand = new RelayCommand(index => { var results = SelectedResults; if (index != null) { results.SelectedIndex = int.Parse(index.ToString()); } var result = results.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { bool hideWindow = result.Action != null && result.Action(new ActionContext { SpecialKeyState = GlobalHotkey.Instance.CheckModifiers() }); if (hideWindow) { MainWindowVisibility = Visibility.Collapsed; } if (ResultsSelected()) { _userSelectedRecord.Add(result); _history.Add(result.OriginQuery.RawQuery); } } }); LoadContextMenuCommand = new RelayCommand(_ => { if (ResultsSelected()) { SelectedResults = ContextMenu; } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (ResultsSelected()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); UnselectTextCommand = new RelayCommand(_ => { var q = QueryText; ChangeQueryText(q + " "); ChangeQueryText(q); }); }
private void InitializeKeyCommands() { IgnoreCommand = new RelayCommand(_ => { }); EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { MainWindowVisibility = Visibility.Collapsed; } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextTabItem(); }); SelectPrevTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevTabItem(); }); SelectNextContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextContextMenuItem(); }); SelectPreviousContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectPreviousContextMenuItem(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult()); StartHelpCommand = new RelayCommand(_ => { Process.Start("http://doc.wox.one/"); }); OpenResultCommand = new RelayCommand(index => { var results = SelectedResults; if (index != null) { results.SelectedIndex = int.Parse(index.ToString(), CultureInfo.InvariantCulture); } if (results.SelectedItem != null) { //If there is a context button selected fire the action for that button before the main command. bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton(); if (!didExecuteContextButton) { var result = results.SelectedItem.Result; if (result != null && result.Action != null) // SelectedItem returns null if selection is empty. { MainWindowVisibility = Visibility.Collapsed; Application.Current.Dispatcher.Invoke(() => { result.Action(new ActionContext { SpecialKeyState = KeyboardHelper.CheckModifiers() }); }); if (SelectedIsFromQueryResults()) { _userSelectedRecord.Add(result); _history.Add(result.OriginQuery.RawQuery); } else { SelectedResults = Results; } } } } }); LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = ContextMenu; } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); ClearQueryCommand = new RelayCommand(_ => { if (!string.IsNullOrEmpty(QueryText)) { ChangeQueryText(string.Empty, true); //Push Event to UI SystemQuery has changed OnPropertyChanged(nameof(SystemQueryText)); } }); }
private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { MainWindowVisibility = Visibility.Collapsed; } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextTabItem(); }); SelectPrevTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevTabItem(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult()); StartHelpCommand = new RelayCommand(_ => { Process.Start("http://doc.wox.one/"); }); OpenResultCommand = new RelayCommand(index => { var results = SelectedResults; if (index != null) { results.SelectedIndex = int.Parse(index.ToString()); } if (results.SelectedItem != null) { //If there is a context button selected fire the action for that button before the main command. bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton(); if (!didExecuteContextButton) { var result = results.SelectedItem.Result; if (result != null && result.Action != null) // SelectedItem returns null if selection is empty. { MainWindowVisibility = Visibility.Collapsed; Task.Run(() => { result.Action(new ActionContext { SpecialKeyState = GlobalHotkey.Instance.CheckModifiers() }); }); if (SelectedIsFromQueryResults()) { _userSelectedRecord.Add(result); _history.Add(result.OriginQuery.RawQuery); } else { SelectedResults = Results; } } } } }); LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = ContextMenu; } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); }
private void InitializeKeyCommands() { IgnoreCommand = new RelayCommand(_ => { }); EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { Hide(); } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextTabItem(); }); SelectPrevTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevTabItem(); }); SelectNextContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextContextMenuItem(); }); SelectPreviousContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectPreviousContextMenuItem(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); OpenResultWithKeyboardCommand = new RelayCommand(index => { OpenResultsEvent(index, false); }); OpenResultWithMouseCommand = new RelayCommand(index => { OpenResultsEvent(index, true); }); ClearQueryCommand = new RelayCommand(_ => { if (!string.IsNullOrEmpty(QueryText)) { ChangeQueryText(string.Empty, true); // Push Event to UI SystemQuery has changed OnPropertyChanged(nameof(SystemQueryText)); } }); }
private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { MainWindowVisibility = Visibility.Collapsed; } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult()); StartHelpCommand = new RelayCommand(_ => { SearchWeb.NewTabInBrowser("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/"); }); OpenResultCommand = new RelayCommand(index => { var results = SelectedResults; if (index != null) { results.SelectedIndex = int.Parse(index.ToString()); } var result = results.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { bool hideWindow = result.Action != null && result.Action(new ActionContext { SpecialKeyState = GlobalHotkey.Instance.CheckModifiers() }); if (hideWindow) { MainWindowVisibility = Visibility.Collapsed; } if (SelectedIsFromQueryResults()) { _userSelectedRecord.Add(result); _history.Add(result.OriginQuery.RawQuery); } else { SelectedResults = Results; } } }); LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = ContextMenu; } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); }
private void InitializeKeyCommands() { IgnoreCommand = new RelayCommand(_ => { }); EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { MainWindowVisibility = Visibility.Collapsed; } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextTabItem(); }); SelectPrevTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevTabItem(); }); SelectNextContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextContextMenuItem(); }); SelectPreviousContextMenuItemCommand = new RelayCommand(_ => { SelectedResults.SelectPreviousContextMenuItem(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult()); OpenResultWithKeyboardCommand = new RelayCommand(index => { OpenResultsEvent(index, false); }); OpenResultWithMouseCommand = new RelayCommand(index => { OpenResultsEvent(index, true); }); LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = ContextMenu; } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); ClearQueryCommand = new RelayCommand(_ => { if (!string.IsNullOrEmpty(QueryText)) { ChangeQueryText(string.Empty, true); // Push Event to UI SystemQuery has changed OnPropertyChanged(nameof(SystemQueryText)); } }); }
private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => { if (!SelectedIsFromQueryResults()) { SelectedResults = Results; } else { Hide(); } }); ClearQueryCommand = new RelayCommand(_ => { if (!string.IsNullOrEmpty(QueryText)) { ChangeQueryText(string.Empty); // Push Event to UI SystemQuery has changed //OnPropertyChanged(nameof(SystemQueryText)); } }); SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); }); SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); }); SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); }); SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); }); SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult()); StartHelpCommand = new RelayCommand(_ => { PluginManager.API.OpenUrl("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/"); }); OpenSettingCommand = new RelayCommand(_ => { App.API.OpenSettingDialog(); }); OpenResultCommand = new RelayCommand(index => { var results = SelectedResults; if (index != null) { results.SelectedIndex = int.Parse(index.ToString()); } var result = results.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { bool hideWindow = result.Action != null && result.Action(new ActionContext { SpecialKeyState = GlobalHotkey.CheckModifiers() }); if (hideWindow) { Hide(); } if (SelectedIsFromQueryResults()) { _userSelectedRecord.Add(result); _history.Add(result.OriginQuery.RawQuery); } else { SelectedResults = Results; } } }); AutocompleteQueryCommand = new RelayCommand(_ => { var result = SelectedResults.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { var autoCompleteText = result.Title; if (!string.IsNullOrEmpty(result.AutoCompleteText)) { autoCompleteText = result.AutoCompleteText; } else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText)) { autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText; } var specialKeyState = GlobalHotkey.CheckModifiers(); if (specialKeyState.ShiftPressed) { autoCompleteText = result.SubTitle; } ChangeQueryText(autoCompleteText); } }); LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { // When switch to ContextMenu from QueryResults, but no item being chosen, should do nothing // i.e. Shift+Enter/Ctrl+O right after Alt + Space should do nothing if (SelectedResults.SelectedItem != null) { SelectedResults = ContextMenu; } } else { SelectedResults = Results; } }); LoadHistoryCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) { SelectedResults = History; History.SelectedIndex = _history.Items.Count - 1; } else { SelectedResults = Results; } }); ReloadPluginDataCommand = new RelayCommand(_ => { Hide(); PluginManager .ReloadData() .ContinueWith(_ => Application.Current.Dispatcher.Invoke(() => { Notification.Show( InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully"), ""); })) .ConfigureAwait(false); }); }
private void resultView_ItemDrag(object sender, ItemDragEventArgs e) { var dataObject = ShellTools.GetDataObject(SelectedResults.Select(result => result.FullPath), includeAsText: false); resultView.DoDragDrop(dataObject, DragDropEffects.Copy); }
private void copyToolStripMenuItem_Click(object sender, EventArgs e) { ShellTools.Copy(SelectedResults.Select(result => result.FullPath)); }