Exemple #1
0
        void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                return;
            }
            fetchstate f = (fetchstate)e.UserState;
            Security   s = f.ChartStock;

            if (!blbox.ContainsKey(s.Symbol))
            {
                blbox.Add(s.Symbol, BarListImpl.FromCSV(s.Symbol, e.Result));
            }
            else
            {
                blbox[s.Symbol] = BarListImpl.FromCSV(s.Symbol, e.Result);
            }
            if (f.NewChart)
            {
                ChartImpl c = new ChartImpl(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 SecurityDelegate(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]);
            }
        }