private void EditSearchSource() { var newKeyword = _searchSource.ActionKeyword; var oldKeyword = _oldSearchSource.ActionKeyword; if (!PluginManager.ActionKeywordRegistered(newKeyword) || oldKeyword == newKeyword) { var id = _context.CurrentPluginMetadata.ID; PluginManager.ReplaceActionKeyword(id, oldKeyword, newKeyword); var index = _searchSources.IndexOf(_oldSearchSource); _searchSources[index] = _searchSource; Close(); } else { var warning = _api.GetTranslation("newActionKeywordsHasBeenAssigned"); MessageBox.Show(warning); } if (!string.IsNullOrEmpty(selectedNewIconImageFullPath)) { _viewModel.UpdateIconAttributes(_searchSource, selectedNewIconImageFullPath); _viewModel.CopyNewImageToUserDataDirectoryIfRequired( _searchSource, selectedNewIconImageFullPath, _oldSearchSource.IconPath); } }
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); } } }
private void btnDone_OnClick(object sender, RoutedEventArgs _) { var oldActionKeyword = _plugin.Metadata.ActionKeywords[0]; var newActionKeyword = tbAction.Text.Trim(); if (!PluginManager.ActionKeywordRegistered(newActionKeyword)) { var id = _plugin.Metadata.ID; PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword); MessageBox.Show(_translater.GetTranslation("succeed")); Close(); } else { string msg = _translater.GetTranslation("newActionKeywordsHasBeenAssigned"); MessageBox.Show(msg); } }
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); } }
private void EditSearchSource() { var newKeyword = _searchSource.ActionKeyword; var oldKeyword = _oldSearchSource.ActionKeyword; if (!PluginManager.ActionKeywordRegistered(newKeyword) || oldKeyword == newKeyword) { var id = _context.CurrentPluginMetadata.ID; PluginManager.ReplaceActionKeyword(id, oldKeyword, newKeyword); var index = _searchSources.IndexOf(_oldSearchSource); _searchSources[index] = _searchSource; var info = _api.GetTranslation("succeed"); MessageBox.Show(info); Close(); } else { var warning = _api.GetTranslation("newActionKeywordsHasBeenAssigned"); MessageBox.Show(warning); } }
internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
public bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);