Esempio n. 1
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            (tabControl1.SelectedTab as MegaTabPage).SelectedDate = dateTimePicker1.Value;

            MegaTabPage panel = tabControl1.SelectedTab as MegaTabPage;
            SymbolFile sf;
            string broker, symbol;
            List<string> grafs = panel.GetGrafNameList();
            panel.ClearGrafs();

            foreach (string name in grafs)
            {
                broker = name.Substring(0, name.IndexOf("(") - 1);
                symbol = name.Substring(name.IndexOf("(") + 1, name.IndexOf(")") - name.IndexOf("(") - 1);
                sf = GetSymbolFile(broker, symbol, panel.GetDateStr());

                if (sf == null)
                    panel.AddGraf(name);
                else
                    panel.AddGrafFast(name, sf.Path);
            }
            tabControl1_SelectedIndexChanged(null, null);

            if (StakanV != null)
            {
                StakanFile file = GetSelectedStakanFile();
                if (file == null)
                {
                    StakanV = new StakanViewer(StakanV.Name);
                    groupBox3.Enabled = false;
                    dataGridView2.Enabled = false;
                    dataGridView2.Rows.Clear();
                }
                else
                {
                    StakanV = new StakanViewer(StakanV.Name, file.Path);
                    switch (StakanV.Points)
                    {
                        case 0: StakanFormat = "0"; break;
                        case 1: StakanFormat = "0.0"; break;
                        case 2: StakanFormat = "0.00"; break;
                        case 3: StakanFormat = "0.000"; break;
                        case 4: StakanFormat = "0.0000"; break;
                        case 5: StakanFormat = "0.00000"; break;
                    }
                    groupBox3.Enabled = true;
                    dataGridView2.Enabled = true;
                    hScrollBar1.Maximum = Math.Max(0, StakanV.Drinks.Count - dataGridView2.Columns.Count);

                    StakanReview();
                }
            }
        }
Esempio n. 2
0
        private void Tree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Level == 2 && Tree.SelectedNode == e.Node && e.Node.Parent.Parent.Index == 0)
            {
                MegaTabPage panel = tabControl1.SelectedTab as MegaTabPage;

                if (panel.GrafExist(e.Node.Parent.Text + " (" + e.Node.Text + ")"))
                    return;
                SymbolFile sf = GetSelectedSymbolFile();
                if (sf == null)
                    panel.AddGraf(e.Node.Parent.Text + " (" + e.Node.Text + ")");
                else
                    panel.AddGrafFast(e.Node.Parent.Text + " (" + e.Node.Text + ")", sf.Path);

                dataGridView1.Rows.Add();
                dataGridView1[0, dataGridView1.Rows.Count - 1].Value = panel.Grafs[panel.Grafs.Count - 1].ToString();
                dataGridView1[1, dataGridView1.Rows.Count - 1].Value = panel.Grafs[panel.Grafs.Count - 1].DMedSpr;
                dataGridView1[2, dataGridView1.Rows.Count - 1].Value = panel.Grafs[panel.Grafs.Count - 1].NMedSpr;
                if (panel.Grafs[panel.Grafs.Count - 1].Fictive)
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Gray;
                else
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.ForeColor = panel.Grafs[panel.Grafs.Count - 1].pPen.Color;
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
            }
            else if (e.Node.Level == 2 && Tree.SelectedNode == e.Node && e.Node.Parent.Parent.Index == 1)
            {
                StakanFile file = GetSelectedStakanFile();
                if (file == null)
                {
                    StakanV = new StakanViewer(e.Node.Text);
                    label3.Text = e.Node.Text;
                    groupBox3.Enabled = false;
                    dataGridView2.Enabled = false;
                    dataGridView2.Rows.Clear();
                }
                else
                {
                    StakanV = new StakanViewer(e.Node.Text, file.Path);
                    switch (StakanV.Points)
                    {
                        case 0: StakanFormat = "0"; break;
                        case 1: StakanFormat = "0.0"; break;
                        case 2: StakanFormat = "0.00"; break;
                        case 3: StakanFormat = "0.000"; break;
                        case 4: StakanFormat = "0.0000"; break;
                        case 5: StakanFormat = "0.00000"; break;
                    }
                    label3.Text = e.Node.Text;
                    groupBox3.Enabled = true;
                    dataGridView2.Enabled = true;
                    hScrollBar1.Maximum = Math.Max(0, StakanV.Drinks.Count - dataGridView2.Columns.Count);

                    StakanReview();
                }
            }
        }