public void UpdateItem(WebSearch webSearch) { updateWebSearch = WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch); if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url)) { string warning = context.API.GetTranslation("Bloop_plugin_websearch_invalid_web_search"); MessageBox.Show(warning); Close(); return; } update = true; lblAdd.Text = "Update"; tbIconPath.Text = webSearch.IconPath; ShowIcon(webSearch.IconPath); cbEnable.IsChecked = webSearch.Enabled; tbTitle.Text = webSearch.Title; tbUrl.Text = webSearch.Url; tbActionword.Text = webSearch.ActionWord; }
private void QuerySuggestions(string keyword, Query query, string subtitle, WebSearch webSearch) { ISuggestionSource sugg = SuggestionSourceFactory.GetSuggestionSource(WebSearchStorage.Instance.WebSearchSuggestionSource, context); if (sugg != null) { var result = sugg.GetSuggestions(keyword); if (result != null) { context.API.PushResults(query, context.CurrentPluginMetadata, result.Select(o => new Result() { Title = o, SubTitle = subtitle, Score = 5, IcoPath = webSearch.IconPath, Action = (c) => { Process.Start(webSearch.Url.Replace("{q}", Uri.EscapeDataString(o))); return true; } }).ToList()); } } }