Пример #1
0
 private async void BTN_Search_Again_Click(object sender, EventArgs e)
 {
     System.IO.Stream         str = Properties.Resources.Windows_Navigation_Start;
     System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str);
     snd.Play();
     try
     {
         pbLoading.Show();
         pbLoading.Enabled = true;
         string search = TB_Search_Again.Text;
         if (!Main_Menu.searchableNames.Contains(search))
         {
             ErrorProvider_Search_Error.SetError(TB_Search_Again, "Please enter a valid search");
         }
         else
         {
             ErrorProvider_Search_Error.Clear();
             await fillLabels(TB_Search_Again.Text);
             await paintGraph(TB_Search_Again.Text);
         }
         pbLoading.Hide();
         pbLoading.Enabled = false;
     }
     catch (System.Net.WebException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message);
     }
 }
Пример #2
0
        private void BTN_Search_Stocks_Click(object sender, EventArgs e)
        {
            System.IO.Stream         str = Properties.Resources.Windows_Navigation_Start;
            System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str);
            snd.Play();
            search = TB_Search_Stocks.Text;

            try
            {
                if (!searchableNames.Contains(search))
                {
                    ErrorProvider_Search_Error.SetError(TB_Search_Stocks, "Please enter a valid search");
                }
                else
                {
                    pbLoading.Show();
                    ErrorProvider_Search_Error.Clear();
                    Search_Result_Form srf = new Search_Result_Form();
                    srf.searchString = TB_Search_Stocks.Text.ToString();

                    pbLoading.Hide();
                    srf.ShowDialog();
                }
            }
            catch (System.Net.WebException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message);
            }
        }