Example #1
0
        void readResult(LogFileHandler handler, ListBox target)
        {
            target.Invoke(new Action(() =>
            {
                target.Items.Clear();
            }));

            for (int i = 0; i < handler.resultCount; i++)
            {
                target.Invoke(new Action(() =>
                {
                    UrlItem item = new UrlItem(handler.UrlResults[i, 0], handler.UrlResults[i, 1]);
                    target.Items.Add(item);
                }));
            }
        }
Example #2
0
        async Task onTabChange(int index)
        {
            if (txtFreeStyle.Text.Length == 0)
            {
                return;
            }

            switch (index)
            {
            case 0:     // Google
                HttpClient          client = new HttpClient();
                HttpResponseMessage msg    = await client.GetAsync(
                    "https://suggestqueries.google.com/complete/search?output=toolbar&hl=he&gl=IL&q=" + txtFreeStyle.Text);

                string data = await msg.Content.ReadAsStringAsync();

                var xml   = XDocument.Parse(data, LoadOptions.PreserveWhitespace);
                var query = from c in xml.Root.Descendants("suggestion")
                            select c.Attribute("data");

                lstGoogle.Items.Clear();
                foreach (string name in query)
                {
                    UrlItem item = new UrlItem(name, "https://www.google.com/search?q=" + name);
                    lstGoogle.Items.Add(item);
                }

                break;

            case 1:     // History
                MainForm.historyLog.updateSearchParams(txtFreeStyle.Text);
                break;

            case 2:     // Bookmark
                MainForm.bookmarkLog.updateSearchParams(txtFreeStyle.Text);
                break;
            }
        }