コード例 #1
0
 private void FiForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if ((sender as FormInput).isOK)
     {
         GLOBALMODE = EMODE.EDITOR;
         EMODEChanged?.Invoke(this, new EventArgs());
     }
 }
コード例 #2
0
        private void toolStripButton_Clear_Click(object sender, EventArgs e)
        {
            // TODO Clear datagrid
            dataGridView_Solve.Rows.Clear();
            dataGridView_Solve.Columns.Clear();

            GLOBALMODE = EMODE.NONE;
            EMODEChanged?.Invoke(this, new EventArgs());

            dataGridView_Solve.Refresh();
        }
コード例 #3
0
        private void toolStripButton_SolveTransport_Click(object sender, EventArgs e)
        {
            if (!GridEditorFilled())
            {
                return;
            }
            TryCloseTransportSolvation();

            // Enter in solver mode
            GLOBALMODE = EMODE.SOLVE;
            EMODEChanged?.Invoke(this, new EventArgs());

            // Here our solvation will be
            CSolveTable csTable = new CSolveTable();

            csTable.FillTable(dataGridView_Solve);
            dataGridView_Solve.Columns.Clear();
            dataGridView_Solve.Rows.Clear();
            dataGridView_Solve.Refresh();
            dataGridView_Solve.ReadOnly = true;
            csTable.FormColumnsOnGrid(ref dataGridView_Solve);
            csTable.Solve();
        }
コード例 #4
0
        private void toolStripButton_MyVar_Click(object sender, EventArgs e)
        {
            DataGridViewTextBoxColumn dgvc = new DataGridViewTextBoxColumn();

            dgvc.HeaderText = "";
            dgvc.Name       = "";
            dgvc.ReadOnly   = true;
            dataGridView_Solve.Columns.Add(dgvc);

            int iBuyersCount  = 6;
            int iSellersCount = 5;

            for (int i = 0; i < iBuyersCount; ++i)
            {
                int    iNum  = i + 1;
                string sText = "B" + iNum.ToString();
                dataGridView_Solve.Columns.Add(sText, sText);
            }

            dataGridView_Solve.Columns.Add("Запасы", "Запасы");
            dataGridView_Solve.RowHeadersVisible = false;

            string[] sValues;
            // Draw first rows
            for (int i = 0; i < iSellersCount; ++i)
            {
                int iNum = i + 1;
                sValues    = new string[iBuyersCount + 2];
                sValues[0] = "A" + iNum.ToString();
                for (int j = 1; j < iBuyersCount + 2; ++j)
                {
                    sValues[j] = "";
                }

                dataGridView_Solve.Rows.Add(sValues);
            }

            // Last row с потребностями
            sValues    = new string[iBuyersCount + 2];
            sValues[0] = "Потребности";
            for (int i = 1; i < iBuyersCount + 1; ++i)
            {
                sValues[i] = "";
            }
            dataGridView_Solve.Rows.Add(sValues);

            // Make right bottom corner uneditable
            dataGridView_Solve.ReadOnly = true;

            dataGridView_Solve[1, 0].Value = "2";
            dataGridView_Solve[1, 1].Value = "7";
            dataGridView_Solve[1, 2].Value = "8";
            dataGridView_Solve[1, 3].Value = "2";
            dataGridView_Solve[1, 4].Value = "6";
            dataGridView_Solve[1, 5].Value = "23";

            dataGridView_Solve[2, 0].Value = "8";
            dataGridView_Solve[2, 1].Value = "6";
            dataGridView_Solve[2, 2].Value = "9";
            dataGridView_Solve[2, 3].Value = "4";
            dataGridView_Solve[2, 4].Value = "9";
            dataGridView_Solve[2, 5].Value = "12";

            dataGridView_Solve[3, 0].Value = "3";
            dataGridView_Solve[3, 1].Value = "2";
            dataGridView_Solve[3, 2].Value = "4";
            dataGridView_Solve[3, 3].Value = "6";
            dataGridView_Solve[3, 4].Value = "7";
            dataGridView_Solve[3, 5].Value = "24";

            dataGridView_Solve[4, 0].Value = "7";
            dataGridView_Solve[4, 1].Value = "2";
            dataGridView_Solve[4, 2].Value = "11";
            dataGridView_Solve[4, 3].Value = "7";
            dataGridView_Solve[4, 4].Value = "9";
            dataGridView_Solve[4, 5].Value = "32";

            dataGridView_Solve[5, 0].Value = "2";
            dataGridView_Solve[5, 1].Value = "7";
            dataGridView_Solve[5, 2].Value = "5";
            dataGridView_Solve[5, 3].Value = "8";
            dataGridView_Solve[5, 4].Value = "3";
            dataGridView_Solve[5, 5].Value = "28";

            dataGridView_Solve[6, 0].Value = "6";
            dataGridView_Solve[6, 1].Value = "9";
            dataGridView_Solve[6, 2].Value = "3";
            dataGridView_Solve[6, 3].Value = "4";
            dataGridView_Solve[6, 4].Value = "5";
            dataGridView_Solve[6, 5].Value = "22";

            dataGridView_Solve[7, 0].Value = "25";
            dataGridView_Solve[7, 1].Value = "34";
            dataGridView_Solve[7, 2].Value = "32";
            dataGridView_Solve[7, 3].Value = "44";
            dataGridView_Solve[7, 4].Value = "55";

            GLOBALMODE = EMODE.EDITOR;
            EMODEChanged?.Invoke(this, new EventArgs());

            dataGridView_Solve.Refresh();
        }