Ejemplo n.º 1
0
        void InitMainWindow()
        {
            for (int i = 0; i < numberOfStudent; i++)
            {
                TextBox txtBoxName = new TextBox {
                    FontSize = 25, Background = Brushes.LightBlue, Text = "TS" + (i + 1).ToString(), Margin = new Thickness(5), Width = 125, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, TextAlignment = TextAlignment.Center
                };
                txtBoxName.SetValue(Grid.RowProperty, i + 1);
                txtBoxName.SetValue(Grid.ColumnProperty, 0);
                gridStudentInformation.Children.Add(txtBoxName);
                txtBoxStudentNameList.Add(txtBoxName);

                TextBox txtBoxPoint = new TextBox {
                    FontSize = 25, Background = Brushes.AliceBlue, Text = "0", Margin = new Thickness(5), Width = 125, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, TextAlignment = TextAlignment.Center
                };
                txtBoxPoint.SetValue(Grid.RowProperty, i + 1);
                txtBoxPoint.SetValue(Grid.ColumnProperty, 1);
                gridStudentInformation.Children.Add(txtBoxPoint);
                txtBoxStudentPointList.Add(txtBoxPoint);
                studentList.Add(new Student("TS" + (i + 1).ToString(), 0));
            }

            eWMainWindow = new EWMainWindow();
            eWMainWindow.Show();
            eWPointSummarized = new EWPointSummarized();
            eWStart           = new EWStart();
            eWObstacles       = new EWObstacles();
            eWAccelerate      = new EWAccelerate();
            eWDecode          = new EWDecode();
            eWFinish          = new EWFinish();
            server            = new Server(this);

            uCStart      = new UCStart(this, eWMainWindow, eWStart, studentList, server);
            uCObstacles  = new UCObstacles(this, eWMainWindow, eWObstacles, studentList, server);
            uCAccelerate = new UCAccelerate(this, eWMainWindow, eWAccelerate, studentList, server);
            uCDecode     = new UCDecode(this, eWMainWindow, eWDecode, studentList, server);
            uCFinish     = new UCFinish(this, eWMainWindow, eWFinish, studentList, server);

            tabMain.Items.Add(new TabItem {
                Content = uCStart, Header = "Khởi Động", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCObstacles, Header = "VCNV", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCAccelerate, Header = "Tăng Tốc", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCDecode, Header = "Giải Mã", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCFinish, Header = "Về Đích", Width = 80, Height = 20, FontSize = 10
            });

            //Cap nhap ID cua vong hien tai
            System.IO.StreamWriter streamWriter = new System.IO.StreamWriter("Round.txt");
            streamWriter.Flush();
            streamWriter.Write("0");
            streamWriter.Close();
        }
Ejemplo n.º 2
0
        void InitMainWindow()
        {
            if (txtBoxStudentNameList.Count != 4)
            {
                for (int i = 0; i < numberOfStudent; i++)
                {
                    Viewbox viewbox    = new Viewbox();
                    TextBox txtBoxName = new TextBox {
                        FontSize = 35, Background = Brushes.Transparent, Foreground = Brushes.Black, Text = studentList[i].Name, TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 15, 0, 0)
                    };
                    viewbox.Child = txtBoxName;
                    viewbox.SetValue(Grid.RowProperty, i + 1);
                    viewbox.SetValue(Grid.ColumnProperty, 0);
                    gridStudentInformation.Children.Add(viewbox);
                    txtBoxStudentNameList.Add(txtBoxName);

                    TextBox txtBoxPoint = new TextBox {
                        FontSize = 35, Background = Brushes.Transparent, Foreground = Brushes.Black, Text = studentList[i].Point.ToString(), TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 15, 0, 0)
                    };
                    txtBoxPoint.SetValue(Grid.RowProperty, i + 1);
                    txtBoxPoint.SetValue(Grid.ColumnProperty, 1);
                    gridStudentInformation.Children.Add(txtBoxPoint);
                    txtBoxStudentPointList.Add(txtBoxPoint);
                }
            }
            else
            {
                for (int i = 0; i < numberOfStudent; i++)
                {
                    txtBoxStudentNameList[i].Text  = studentList[i].Name;
                    txtBoxStudentPointList[i].Text = studentList[i].Point.ToString();
                }
            }

            eWMainWindow = new EWMainWindow();
            eWMainWindow.Show();
            eWPointSummarized = new EWPointSummarized();
            eWStart           = new EWStart();
            eWObstacles       = new EWObstacles();
            eWAccelerate      = new EWAccelerate();
            eWDecode          = new EWDecode();
            eWFinish          = new EWFinish();


            uCReadExcel    = new UCReadExcel(this);
            uCStart        = new UCStart(this, eWMainWindow, eWStart, studentList, server, matchID);
            uCObstacles    = new UCObstacles(this, eWMainWindow, eWObstacles, studentList, server, matchID);
            uCAccelerate   = new UCAccelerate(this, eWMainWindow, eWAccelerate, studentList, server, matchID);
            uCDecode       = new UCDecode(this, eWMainWindow, eWDecode, studentList, server, matchID);
            uCFinish       = new UCFinish(this, eWMainWindow, eWFinish, studentList, server, matchID);
            uCSubQuestions = new UCSubQuestions(this, eWMainWindow, studentList, server, matchID);
            while (tabMain.Items.Count != 0)
            {
                tabMain.Items.RemoveAt(0);
            }

            tabMain.Items.Add(new TabItem {
                Content = uCStart, Header = "Khởi Động", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCObstacles, Header = "VCNV", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCAccelerate, Header = "Tăng Tốc", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCDecode, Header = "Giải Mã", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCFinish, Header = "Về Đích", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCSubQuestions, Header = "Câu hỏi phụ", Width = 80, Height = 20, FontSize = 10
            });
            tabMain.Items.Add(new TabItem {
                Content = uCReadExcel, Header = "Read Excel", Width = 80, Height = 20, FontSize = 10
            });


            //Cap nhap ID cua vong hien tai
            System.IO.StreamWriter streamWriter = new System.IO.StreamWriter("Round.txt");
            streamWriter.Flush();
            streamWriter.Write("0");
            streamWriter.Close();
        }