Example #1
0
        public List <WebSearch> LoadDefaultWebSearches()
        {
            List <WebSearch> webSearches = new List <WebSearch>();

            WebSearch googleWebSearch = new WebSearch()
            {
                Title      = "Google",
                ActionWord = "g",
                IconPath   = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\google.png",
                Url        = "https://www.google.com/search?q={q}",
                Enabled    = true
            };

            webSearches.Add(googleWebSearch);


            WebSearch wikiWebSearch = new WebSearch()
            {
                Title      = "Wikipedia",
                ActionWord = "wiki",
                IconPath   = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\wiki.png",
                Url        = "http://en.wikipedia.org/wiki/{q}",
                Enabled    = true
            };

            webSearches.Add(wikiWebSearch);

            return(webSearches);
        }
Example #2
0
        public void UpdateItem(WebSearch webSearch)
        {
            updateWebSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
            if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
            {
                MessageBox.Show("Invalid web search");
                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;
        }