void addSymbol_Click(object sender, EventArgs e) { String NewSymbol = Interaction.InputBox("Enter symbol to be add in the quotes list", "Enter new symbol", string.Empty, -1, -1).ToUpper(); if(frm_mainForm.Quotes.ContainsKey(NewSymbol)) MessageBox.Show(NewSymbol + "is allready in the quotes list!"); else { try { ArrayList candles = Data.getDataFromGoogle("", NewSymbol, "10d", 86400); double todaysOpen = ((Candle)candles[candles.Count - 2]).Close; frm_mainForm.Quotes.Add(NewSymbol, new Candle()); dataGridView1.Rows.Add(NewSymbol, null, null, DateTime.Now.ToShortTimeString(),todaysOpen); dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Yellow; Data df = new Data(); df.getDataFromGoogle_Async("", NewSymbol, "3d", 60); DataBase.addUserQuotes(User.curUsername, NewSymbol); } catch { MessageBox.Show(NewSymbol + " no such symbol listed!"); } } dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.DisplayedCells); }
private void frm_chart_Load(object sender, EventArgs e) { if (chartControl.Online) { this.Text = chartControl.Symbol + " live"; this.Name = chartControl.Symbol; } else { this.Text = chartControl.Symbol + " History"; this.Name = chartControl.Symbol + "_history"; } Data df = new Data(); if (ChartControl.Online) df.getDataFromGoogle_Async("", this.Name, "2d", 60); else dispayChart(ChartControl, DataBase.getChartData(chartControl.Symbol)); }
private void LiveQuotes_Load(object sender, EventArgs e) { foreach (DictionaryEntry quote in frm_mainForm.Quotes) { ArrayList candles = Data.getDataFromGoogle("", quote.Key.ToString(), "10d", 86400); double todaysOpen = ((Candle)candles[candles.Count - 2]).Close; dataGridView1.Rows.Add(quote.Key.ToString(), null, null, DateTime.Now.ToShortTimeString(), todaysOpen); } frm_Alerts alerts = new frm_Alerts(); alerts.Tag = dataGridView1; foreach (DataGridViewColumn column in dataGridView1.Columns) column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.DisplayedCells); foreach (DictionaryEntry quote in frm_mainForm.Quotes) { Data df = new Data(); df.getDataFromGoogle_Async("", quote.Key.ToString(), "3d", 60); } foreach (DataGridViewRow row in dataGridView1.Rows) row.DefaultCellStyle.BackColor = Color.Yellow; }
public void timer1_Tick(object sender, EventArgs e) { if (this.isConnected) { this.toolStripStatusLabel_connection.Text = "Connected"; this.toolStripStatusLabel_connection.Image = Properties.Resources.conOK; } else { this.toolStripStatusLabel_connection.Text = "Connection failed"; this.toolStripStatusLabel_connection.Image = Properties.Resources.conLOST; } foreach (DictionaryEntry quote in Quotes) { try { Data df = new Data(); df.getDataFromGoogle_Async("", quote.Key.ToString(), "3d", 60); } catch { } } }