/// <summary> /// Confirm button for both add and update /// </summary> private void btnConfirm_OnClick(object sender, RoutedEventArgs e) { string title = tbTitle.Text; if (string.IsNullOrEmpty(title)) { string warning = _context.API.GetTranslation("wox_plugin_websearch_input_title"); MessageBox.Show(warning); return; } string url = tbUrl.Text; if (string.IsNullOrEmpty(url)) { string warning = _context.API.GetTranslation("wox_plugin_websearch_input_url"); MessageBox.Show(warning); return; } string newActionKeyword = tbActionword.Text.Trim(); if (_isUpdate) { try { _plugin.NotifyActionKeywordsUpdated(_updateWebSearch.ActionKeyword, newActionKeyword); } catch (WoxPluginException exception) { MessageBox.Show(exception.Message); return; } _updateWebSearch.ActionKeyword = newActionKeyword; _updateWebSearch.IconPath = tbIconPath.Text; _updateWebSearch.Enabled = cbEnable.IsChecked ?? false; _updateWebSearch.Url = url; _updateWebSearch.Title = title; } else { try { _plugin.NotifyActionKeywordsAdded(newActionKeyword); } catch (WoxPluginException exception) { MessageBox.Show(exception.Message); return; } _settings.WebSearches.Add(new WebSearch { ActionKeyword = newActionKeyword, Enabled = cbEnable.IsChecked ?? false, IconPath = tbIconPath.Text, Url = url, Title = title }); } _settings.Save(); _settingWindow.ReloadWebSearchView(); Close(); }
private void CbEnableWebSearchSuggestion_OnChecked(object sender, RoutedEventArgs e) { comboBoxSuggestionSource.Visibility = Visibility.Visible; _settings.EnableWebSearchSuggestion = true; _settings.Save(); }