예제 #1
0
        private void OpenGrids(SingleGame G)
        {
            UI.Grid Ga = ShowGrid(A, G.A, G);
            UI.Grid Gb = ShowGrid(B, G.B, G);

            A.Left       = 10;
            B.Left       = A.Right + 50;
            panel1.Width = B.Right + 10;
            this.Width   = panel1.Right + 20;

            A.Top         = 50;
            B.Top         = A.Top;
            panel1.Height = A.Bottom + 80;
            this.Height   = panel1.Bottom + 20;


            label1.Text = "Игрок " + (G.pl1 + 1).ToString();
            label1.Top  = 10;
            label1.Left = A.Left + (A.Width - label1.Width) / 2;

            label2.Text = "Игрок " + (G.pl2 + 1).ToString();
            label2.Top  = label1.Top;
            label2.Left = B.Left + (B.Width - label2.Width) / 2;


            x.Text = A.Rows[0].HeaderCell.Value.ToString().Substring(0, 1) + " = (";
            for (int i = 0; i < G.x.Count; i++)
            {
                x.Text += G.x[i].ToString("0.00");
                if (i != G.x.Count - 1)
                {
                    x.Text += " ";
                }
                else
                {
                    x.Text += ")";
                }
            }
            x.Top  = A.Bottom + 10;
            x.Left = A.Left + (A.Width - x.Width) / 2;

            y.Text = A.Columns[0].HeaderCell.Value.ToString().Substring(0, 1) + " = (";
            for (int i = 0; i < G.y.Count; i++)
            {
                y.Text += G.y[i].ToString("0.00");
                if (i != G.y.Count - 1)
                {
                    y.Text += " ";
                }
                else
                {
                    y.Text += ")";
                }
            }
            y.Top  = x.Top;
            y.Left = B.Left + (B.Width - y.Width) / 2;
        }
        //Test
        //public ViewCooperativeGameForm()
        //{
        //    InitializeComponent();
        //    Database.G = new CooperativeGame();
        //    Database.G.Generate(3);
        //    Database.G.GenerateCoalitions();
        //    Database.G.SolveCooperativeGame();
        //    G = Database.G.FindGame(Database.G.CoalitionsInText[0][0]);
        //    CGStudentProgress.SectionsCount = 2;

        //    FirstInterfaceSetup_CooperativeGameModelFormation();
        //    //SecondInterfaceSetup_Domination();
        //}

        private void FirstInterfaceSetup_CooperativeGameModelFormation()
        {
            StrategiesPanel.Show();
            B.Hide();

            UI.TWDNGrid Gs = new UI.TWDNGrid(S, 1, Database.G.N);
            Gs.InitializeHeaders("", "Количество стратегий", "Игрок", false, true);
            Gs.InitializeGrid(Database.G.S);

            UI.Grid Ga = new UI.Grid(A, Math.Min(10, G.SingleGames[0].A.Count), Math.Min(10, G.SingleGames[0].A[0].Count));
            A.Tag = Ga;
            Ga.InitializeHeaders("Стратегии", 100, 50);
            Ga.InitializeGrid();
            A.EditMode    = DataGridViewEditMode.EditProgrammatically;
            A.ReadOnly    = true;
            A.StandardTab = true;

            UI.ControlsAligner form = new UI.ControlsAligner(this);
            form.AddElement(NavigationPanel, true, "Stretch");
            form.AddElement(Task1Panel);
            form.AddElement(StrategiesPanel);
            form.AddElement(MatrixesPanel);
            form.AddElement(SkipBTN, true, "Left");
            form.AddElement(FinishBTN, false, "Right");

            UI.ControlsAligner spanel = new UI.ControlsAligner(StrategiesPanel);
            spanel.AddElement(S);
            spanel.Align(true);

            UI.ControlsAligner mpanel = new UI.ControlsAligner(MatrixesPanel);
            mpanel.AddElement(A);
            mpanel.Align(true);

            form.Align();
            CreateNavigationPanel();
            this.Text = "Заполните вектора стратегий";
        }