private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { switch (e.Result.ToString()) { case "load-all": wf.Close(); // close wait message box break; case "update-all": updateButton.Enabled = true; ps.Load(portfolioTabControl.SelectedTab.Name, null); break; } // refresh portfolio view portfolioDataGridView_UpdateView(); // clear tool strip status toolStripStatusLabel.Text = ""; // update group box enable state notesGroupBox.Enabled = (ps.PortfolioTable.Rows.Count > 0); summaryGroupBox.Enabled = (ps.PortfolioTable.Rows.Count > 0); if (!notesGroupBox.Enabled) { notesTextBox.Text = ""; } }
private void timer_Tick(object sender, EventArgs e) { timer.Enabled = false; // show wait message box WaitForm wf = new WaitForm(this); wf.Show("Please wait while historical data is downloaded..."); // download historical data hs.Load(); hs.Update(); // process data... UpdateHistoryGraphCurves(); if (hs.HistoryTable.Rows.Count > 0) { vs.Update(); UpdateVolatilityGraphCurves(); } // close wait message box wf.Close(); if (hs.HistoryTable.Rows.Count == 0) { MessageBox.Show("Failed to Download Stock Historical Data. ", "Download Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }