示例#1
0
        private void InitApp()
        {
//            _settings.Apps.Clear();
//            _settings.Commands.Clear();
            string id = _context.CurrentPluginMetadata.ID;

            foreach (var app in _settings.Apps)
            {
                if (!PluginManager.ActionKeywordRegistered(app.Key))
                {
                    PluginManager.AddActionKeyword(id, app.Key);
                }
            }
        }
示例#2
0
        private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
        {
            App app = new App();

            app.Path   = textboxPath.Text;
            app.ID     = textboxID.Text;
            app.Key    = textboxKey.Text;
            app.Param  = textboxParam.Text;
            app.IsFile = (bool)radioFile.IsChecked;

            if (app.ID == "" || app.Key == "")
            {
                MessageBox.Show("关键字和标志不能为空");
                return;
            }

            string id = _context.CurrentPluginMetadata.ID;

            if (_add)
            {
                _settings.Apps.Add(app);
                if (!_context.CurrentPluginMetadata.ActionKeywords.Contains(app.Key))
                {
                    PluginManager.AddActionKeyword(id, app.Key);
                }
            }
            else
            {
                string oldKey = _settings.Apps[_index].Key;
                if (app.Key != oldKey)
                {
                    PluginManager.ReplaceActionKeyword(id, oldKey, app.Key);
                }

                if (!_context.CurrentPluginMetadata.ActionKeywords.Contains(app.Key))
                {
                    PluginManager.AddActionKeyword(id, app.Key);
                }

                _settings.Apps[_index] = app;
            }

            Close();
        }
        private void AddSearchSource()
        {
            var keyword = _searchSource.ActionKeyword;

            if (!PluginManager.ActionKeywordRegistered(keyword))
            {
                var id = _context.CurrentPluginMetadata.ID;
                PluginManager.AddActionKeyword(id, keyword);

                _searchSources.Add(_searchSource);

                Close();
            }
            else
            {
                var warning = _api.GetTranslation("newActionKeywordsHasBeenAssigned");
                MessageBox.Show(warning);
            }
        }
示例#4
0
 public void AddActionKeyword(string pluginId, string newActionKeyword)
 {
     PluginManager.AddActionKeyword(pluginId, newActionKeyword);
 }