void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) return; fetchstate f = (fetchstate)e.UserState; Stock s = f.ChartStock; if (!blbox.ContainsKey(s.Symbol)) blbox.Add(s.Symbol, BarList.FromCSV(s.Symbol,e.Result)); else blbox[s.Symbol] = BarList.FromCSV(s.Symbol,e.Result); if (f.NewChart) { Chart c = new Chart(blbox[s.Symbol], true); c.Symbol = s.Symbol; try { c.StartPosition = FormStartPosition.Manual; c.Location = Chartographer.Properties.Settings.Default.chartstart; } catch (NullReferenceException) { } newChartData += new BarListUpdated(c.NewBarList); c.FetchStock += new StockDelegate(c_FetchStock); c.Move += new EventHandler(c_Move); c.Icon = Chartographer.Properties.Resources.chart; if (maxchartbox.Checked) c.WindowState = FormWindowState.Maximized; if (blackbackground.Checked) c.BackColor = Color.Black; c.Show(); } else if (newChartData != null) newChartData(blbox[s.Symbol]); }
private void button2_Click(object sender, EventArgs e) { OpenFileDialog od = new OpenFileDialog(); od.CheckFileExists = true; od.CheckPathExists = true; od.DefaultExt = "*.EPF"; od.Filter = "TickFiles|*.EPF;*.IDX"; od.InitialDirectory = "c:\\program files\\tradelink\\tickdata\\"; od.Multiselect = false; od.ShowDialog(); BarList bl = od.FileName.Contains(".EPF") ? BarList.FromEPF(od.FileName) : BarList.FromIDX(od.FileName); Chart c = new Chart(bl, false); c.Symbol = bl.Symbol; try { c.StartPosition = FormStartPosition.Manual; c.Location = Chartographer.Properties.Settings.Default.chartstart; } catch (NullReferenceException) { } newChartData += new BarListUpdated(c.NewBarList); c.Move += new EventHandler(c_Move); c.Icon = Chartographer.Properties.Resources.chart; if (maxchartbox.Checked) c.WindowState = FormWindowState.Maximized; if (blackbackground.Checked) c.BackColor = Color.Black; c.Show(); }
void rightchart(object sender, EventArgs e) { Point p = qg.PointToClient(MousePosition); DataGrid.HitTestInfo ht = qg.HitTest(p); if (ht.Type != DataGrid.HitTestType.Cell) return; if (ht.Row < 0) return; string sym = GetVisibleSecurity(qg.CurrentRowIndex).Symbol; Chart c = new Chart(); try { c = new Chart(bardict[sym]); } catch (Exception) { return; } c.Symbol = sym; c.Show(); }