private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { frmFileList fileList = new frmFileList(folder); fileList.Show(); //Process.Start("explorer.exe", folder); //MessageBox.Show("All tickers processed to: " + folder); }
private void btnDL_Click(object sender, EventArgs e) { //Verify folderPath if (!Directory.Exists(txtPath.Text)) { MessageBox.Show("Please enter a valid folder"); return; } //Verify tickers are entered if (txtTicker.Text == "") { MessageBox.Show("Please enter a ticker symbol"); return; } //Verify dates are valid if (DatesVerified()) { string tickers = txtTicker.Text; //Verify symbols are only letters and commas bool result = tickers.All((c => Char.IsLetter(c) || c == ',' || c == ' ' || c == '-')); if (!result) { MessageBox.Show("Please enter only letters and commas, ex:" + Environment.NewLine + "GOOG, AMZN, MSFT"); return; } //Selects daily, weekly or monthly quotes SetInterval(); //Removes white space, converts to uppercase & splits symbols string[] symbols = Helpers.SplitTickers(tickers); foreach (string symbol in symbols) { //Constructs Yahoo's URL to request data from string path = Path.Combine(folder, symbol + ".csv"); string url = "http://real-chart.finance.yahoo.com/table.csv?s=" + symbol + "&a=" + cboFromMonth.SelectedIndex + "&b=" + nudFromDay.Value + "&c=" + nudFromYear.Value + "&d=" + cboToMonth.SelectedIndex + "&e=" + nudToDay.Value + "&f" + nudToYear.Value + "&g=" + interval + "&ignore=.csv"; try { Helpers.DownloadSymbolsToCSV(url, path, folder, symbol); } catch { MessageBox.Show("Could not locate " + symbol); } } frmFileList fileList = new frmFileList(folder); fileList.Show(); //Process.Start("explorer.exe", folder); //MessageBox.Show("All tickers processed to: " + folder); } }