コード例 #1
0
        void deleteSymbol_Click(object sender, EventArgs e)
        {
            MenuItem mi = (MenuItem)sender;

            foreach (Form form in this.MdiParent.MdiChildren)
            {
                if ((form is frm_chart) && (form.Name == mi.Tag.ToString()))
                {
                    form.Close();
                }
                if (form is frm_Alerts)
                {
                    frm_Alerts frm = (frm_Alerts)form;
                    if (frm.deleteAlert(mi.Tag.ToString()))
                    {
                        DataBase.deleteAlert(User.curUsername, mi.Tag.ToString());
                    }
                }
            }

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[0].Value.ToString() == mi.Tag.ToString())
                {
                    dataGridView1.Rows.Remove(row);
                    break;
                }
            }

            if (frm_mainForm.Quotes.Contains(mi.Tag.ToString()))
            {
                DataBase.deleteQuote(User.curUsername, mi.Tag.ToString());
                frm_mainForm.Quotes.Remove(mi.Tag.ToString());
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        private void alertsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frm_Alerts newMDIchild = new frm_Alerts();

            newMDIchild.MdiParent = this;
            newMDIchild.Show();
            alertsToolStripMenuItem.Enabled = false;
        }
コード例 #4
0
        private void frm_mainForm_Load(object sender, EventArgs e)
        {
            BuildMenuItems();
            this.Text = User.curName + ", " + User.curUsername;

            toolStripStatusLabel_date.Text        = DateTime.Now.ToLongDateString();
            toolStripStatusLabel_connection.Text  = "Not connected";
            toolStripStatusLabel_connection.Image = Properties.Resources.conLOST;
            isConnected = false;


            ArrayList quoteList = DataBase.getUsersQuoteList(User.curUsername);

            foreach (String quote in quoteList)
            {
                Quotes.Add(quote, new Candle());
            }

            frm_LiveQuotes newMDIchild = new frm_LiveQuotes();

            newMDIchild.MdiParent = this;
            newMDIchild.Show();

            frm_LiveNews newMDIchild2 = new frm_LiveNews();

            newMDIchild2.MdiParent = this;
            newMDIchild2.Show();

            frm_Alerts newMDIchild3 = new frm_Alerts();

            newMDIchild3.MdiParent = this;
            newMDIchild3.Show();

            alertsToolStripMenuItem.Enabled     = false;
            liveQuotesToolStripMenuItem.Enabled = false;
            newsToolStripMenuItem.Enabled       = false;

            ArrayList DefaultChartList = DataBase.getDefaultChartList();

            foreach (String symbol in DefaultChartList)
            {
                ChartControl chartControl = new ChartControl();
                chartControl.Symbol = symbol;
                frm_chart newMDIchild4 = new frm_chart(chartControl);
                newMDIchild4.MdiParent = this;
                newMDIchild4.Show();
            }

            this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical);
        }
コード例 #5
0
ファイル: Data.cs プロジェクト: koryakinp/NETproject
        public void DownloadComplete(Object sender, DownloadStringCompletedEventArgs e, String symbol)
        {
            if (!e.Cancelled && e.Error == null)
            {
                string        result  = (string)e.Result;
                MemoryStream  ms      = new MemoryStream(System.Text.Encoding.Default.GetBytes(result));
                DataProcessor dp      = new DataProcessor();
                ArrayList     candles = dp.getHistory(ms, 60);
                foreach (Form frm in Application.OpenForms)
                {
                    if (frm.Name == symbol)
                    {
                        frm_chart form = (frm_chart)frm;
                        form.dispayChart(form.ChartControl, candles);
                    }

                    if (frm.Name == "frm_mainForm")
                    {
                        frm_mainForm form = (frm_mainForm)frm;
                        form.isConnected = true;
                    }

                    if (frm.Name == "frm_LiveQuotes")
                    {
                        frm_LiveQuotes form = (frm_LiveQuotes)frm;
                        form.update(symbol, (Candle)candles[candles.Count - 1]);
                    }

                    if (frm.Name == "frm_Alerts")
                    {
                        frm_Alerts form = (frm_Alerts)frm;
                        form.update(symbol, (Candle)candles[candles.Count - 1]);
                    }
                }
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
ファイル: frm_mainForm.cs プロジェクト: koryakinp/NETproject
        private void frm_mainForm_Load(object sender, EventArgs e)
        {
            BuildMenuItems();
            this.Text = User.curName + ", " + User.curUsername;

            toolStripStatusLabel_date.Text = DateTime.Now.ToLongDateString();
            toolStripStatusLabel_connection.Text = "Not connected";
            toolStripStatusLabel_connection.Image = Properties.Resources.conLOST;
            isConnected = false;

            ArrayList quoteList = DataBase.getUsersQuoteList(User.curUsername);
            foreach (String quote in quoteList)
            {
                Quotes.Add(quote, new Candle());
            }

            frm_LiveQuotes newMDIchild = new frm_LiveQuotes();
            newMDIchild.MdiParent = this;
            newMDIchild.Show();

            frm_LiveNews newMDIchild2 = new frm_LiveNews();
            newMDIchild2.MdiParent = this;
            newMDIchild2.Show();

            frm_Alerts newMDIchild3 = new frm_Alerts();
            newMDIchild3.MdiParent = this;
            newMDIchild3.Show();

            alertsToolStripMenuItem.Enabled = false;
            liveQuotesToolStripMenuItem.Enabled = false;
            newsToolStripMenuItem.Enabled = false;

            ArrayList DefaultChartList = DataBase.getDefaultChartList();

            foreach (String symbol in DefaultChartList)
            {
                ChartControl chartControl = new ChartControl();
                chartControl.Symbol = symbol;
                frm_chart newMDIchild4 = new frm_chart(chartControl);
                newMDIchild4.MdiParent = this;
                newMDIchild4.Show();
            }

            this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical);
        }
コード例 #8
0
ファイル: frm_mainForm.cs プロジェクト: koryakinp/NETproject
 private void alertsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frm_Alerts newMDIchild = new frm_Alerts();
     newMDIchild.MdiParent = this;
     newMDIchild.Show();
     alertsToolStripMenuItem.Enabled = false;
 }