Пример #1
0
        public CurrPrice()
        {
            InitializeComponent();

            myFH0 = new FH0();
            myFC0 = new FC0();
            myOH0 = new OH0();
            myOC0 = new OC0();

            this.Show();
            MainForm.LoadedForm.Add(this);
        }
Пример #2
0
        public OptionBoard()
        {
            InitializeComponent();

            myOC0 = new OC0();
            myOH0 = new OH0();
            myOMG = new OMG();

            foreach (KeyValuePair <string, List <string> > code in MainForm.종목마스터)
            {
                if (code.Value[0].Substring(0, 3) == "201")
                {
                    string 만기월 = code.Value[2];
                    if (월물.ContainsKey(만기월))
                    {
                        월물[만기월].Add(code.Value[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[2]);
                    }
                    else
                    {
                        월물.Add(만기월, new List <string> {
                            code.Value[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[2]
                        });
                        if (button1.Text == "")
                        {
                            button1.Text = 만기월;
                        }
                        else if (button2.Text == "")
                        {
                            button2.Text = 만기월;
                        }
                        else if (button3.Text == "")
                        {
                            button3.Text = 만기월;
                        }
                        else if (button4.Text == "")
                        {
                            button4.Text = 만기월;
                        }
                    }
                }
            }


            string[] name       = Enum.GetNames(typeof(ColumnName));
            string[] headertext = Enum.GetNames(typeof(ColumnText));

            PutTable = new DataTable();
            dataGridView3.DataSource = PutTable;

            for (int i = 0; i < name.Length; i++)
            {
                PutTable.Columns.Add(name[i]);
                dataGridView3.Columns[i].HeaderText = headertext[i];
                dataGridView3.Columns[i].Visible    = false;
                dataGridView3.Columns[i].SortMode   = DataGridViewColumnSortMode.NotSortable;
            }

            CallTable = new DataTable();
            dataGridView1.DataSource = CallTable;

            for (int i = name.Length - 1; i >= 0; i--)
            {
                CallTable.Columns.Add(name[i]);
                dataGridView1.Columns[name.Length - 1 - i].HeaderText = headertext[i];
                dataGridView1.Columns[name.Length - 1 - i].Visible    = false;
                dataGridView1.Columns[name.Length - 1 - i].SortMode   = DataGridViewColumnSortMode.NotSortable;
            }

            foreach (DataGridViewColumn col in dataGridView1.Columns)
            {
                GridFormat(col, CallTable.Columns[col.Name]);
            }
            foreach (DataGridViewColumn col in dataGridView3.Columns)
            {
                GridFormat(col, PutTable.Columns[col.Name]);
            }

            dataGridView2.Columns.Add("행사가", "행사가");
            dataGridView2.Columns["행사가"].SortMode = DataGridViewColumnSortMode.NotSortable;

            Categories = new SortedDictionary <string, List <string> >();
            using (StreamReader sr = new StreamReader("OptBoardCategories.txt"))
            {
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    if (line == "" || line.Length < 1)
                    {
                        break;
                    }

                    string   CategoryName = line.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    string[] items        = line.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

                    Categories.Add(CategoryName, items.Select(item => item).ToList());
                    comboBox1.Items.Add(CategoryName);
                    comboBox1.SelectedIndex = 0;
                }
            }

            this.Show();
            MainForm.LoadedForm.Add(this);
        }