Example #1
0
        private async void buttonSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.textBoxBrandSearch.Text) && string.IsNullOrEmpty(this.textBoxModelSearch.Text))
                {
                    return;
                }

                Cursor.Current = Cursors.WaitCursor;
                const string userRoot = "HKEY_CURRENT_USER";
                const string subkey   = "VSTManager\\Search";
                const string keyName  = userRoot + "\\" + subkey;

                Registry.SetValue(keyName, "Brand", this.textBoxBrandSearch.Text, RegistryValueKind.String);
                Registry.SetValue(keyName, "Model", this.textBoxModelSearch.Text, RegistryValueKind.String);

                m_scraper.Search(this.textBoxBrandSearch.Text.Replace(' ', '+'), this.textBoxModelSearch.Text.Replace(' ', '+'), this.checkBoxModelSearchOp.Checked);

                string result = await m_scraper.getResult();

                this.panelWebContent.Controls.Clear();
                if (browser != null)
                {
                    browser.Dispose();
                }

                browser                 = new CefSharp.WinForms.ChromiumWebBrowser("about:blank");
                browser.Dock            = DockStyle.Fill;
                browser.DownloadHandler = new DownloadHandler();

                loadHtml(browser, result);
                this.panelWebContent.Controls.Add(browser);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }