예제 #1
0
        private void OpenResultsEvent(object index, bool isMouseClick)
        {
            var results = SelectedResults;

            if (index != null)
            {
                // Using InvariantCulture since this is internal
                results.SelectedIndex = int.Parse(index.ToString(), CultureInfo.InvariantCulture);
            }

            if (results.SelectedItem != null)
            {
                bool executeResultRequired = false;

                if (isMouseClick)
                {
                    executeResultRequired = true;
                }
                else
                {
                    // If there is a context button selected fire the action for that button instead, and the main command will not be executed
                    executeResultRequired = !results.SelectedItem.ExecuteSelectedContextButton();
                }

                if (executeResultRequired)
                {
                    var result = results.SelectedItem.Result;

                    // SelectedItem returns null if selection is empty.
                    if (result != null && result.Action != null)
                    {
                        MainWindowVisibility = Visibility.Collapsed;

                        Application.Current.Dispatcher.Invoke(() =>
                        {
                            result.Action(new ActionContext
                            {
                                SpecialKeyState = KeyboardHelper.CheckModifiers(),
                            });
                        });

                        if (SelectedIsFromQueryResults())
                        {
                            // todo: revert _userSelectedRecordStorage.Save() and _historyItemsStorage.Save() after https://github.com/microsoft/PowerToys/issues/9164 is done
                            _userSelectedRecord.Add(result);
                            _userSelectedRecordStorage.Save();
                            _history.Add(result.OriginQuery.RawQuery);
                            _historyItemsStorage.Save();
                        }
                        else
                        {
                            SelectedResults = Results;
                        }
                    }
                }
            }
        }
예제 #2
0
        public void Save()
        {
            if (!_saved)
            {
                _historyItemsStorage.Save();
                _userSelectedRecordStorage.Save();
                _topMostRecordStorage.Save();

                _saved = true;
            }
        }
 public void Save()
 {
     _storage.Save();
 }
예제 #4
0
 public void addSearchHistory(string plugin, string msg)
 {
     _history.addSearchHistory(plugin, msg);
     _historyItemsStorage.Save();
 }
예제 #5
0
 public void Save()
 {
     _usageStorage.Save();
 }
예제 #6
0
 public void Save()
 {
     _storage.Save();
     //增加插件信息更新
     PluginManager.Save();
 }