コード例 #1
0
        private void addround(object sender, RoutedEventArgs e)
        {
            AddRound addRound = new AddRound();

            addRound.first_name   = fn;
            addRound.secound_name = sn;
            addRound.command      = !command;
            addRound.Update();
            if (addRound.ShowDialog() == true)
            {
                Gameround gameround = new Gameround(addRound.first_point, addRound.secound_point);
                fn = addRound.first_name;
                firstcommand.Header = fn;
                sn = addRound.secound_name;
                secoundcommand.Header = sn;
                command = addRound.command;
                if (command)
                {
                    gameround.vyzov = fn;
                }
                else
                {
                    gameround.vyzov = sn;
                }
                ListView.Items.RemoveAt(ListView.Items.Count - 1);
                ListView.Items.Add(gameround);
                gamerounds.Add(gameround);
                ListView.Items.Add(Gameround.getTotal());
            }
        }
コード例 #2
0
        public MainWindow()
        {
            if (firstlaunch)
            {
                FirstSettings firstSettings = new FirstSettings();
                if (fn == "@@@" && firstSettings.ShowDialog() != true)
                {
                    InitializeComponent();
                    Close();
                }


                InitializeComponent();
                fn                    = firstSettings.first_name;
                sn                    = firstSettings.secound_name;
                first_players         = firstSettings.first_players;
                secound_players       = firstSettings.secound_players;
                leader                = firstSettings.leader;
                command               = !leader;
                firstcommand.Header   = fn;
                secoundcommand.Header = sn;
            }
            firstlaunch = false;
            InitializeComponent();
            ListView.Items.Add(Gameround.getTotal());
        }
コード例 #3
0
            public static Gameround getTotal()
            {
                Gameround getTotal = new Gameround();

                getTotal.id      = "Итог";
                getTotal.first   = sum1;
                getTotal.secound = sum2;
                getTotal.zhury   = sumz;
                return(getTotal);
            }
コード例 #4
0
        private void Save(object sender, RoutedEventArgs e)
        {
            SaveButton.IsEnabled = false;
            gamerounds.Add(Gameround.getTotal());
            Application application = new Application();
            Document    doc         = application.Documents.Add();
            Range       range       = doc.Range();

            range.Text = "ПРОТОКОЛ МАТЕМАТИЧЕСКОГО БОЯ\n";
            range.Bold = 1;
            range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
            range      = doc.Range(range.End - 1);
            range.Bold = 0;
            range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft;
            if (!(string.IsNullOrWhiteSpace(first_players) && string.IsNullOrWhiteSpace(secound_players)))
            {
                string[] fcommand = first_players.Split('\n');
                string[] scommand = secound_players.Split('\n');
                Table    commands = range.Tables.Add(range, Math.Max(fcommand.Length, scommand.Length) + 1, 2);
                commands.Cell(1, 1).Range.Text = fn;
                commands.Cell(1, 1).Range.Bold = 1;
                commands.Cell(1, 2).Range.Text = sn;
                commands.Cell(1, 2).Range.Bold = 1;
                for (int i = 1; i <= Math.Max(fcommand.Length, scommand.Length); i++)
                {
                    if (i <= fcommand.Length && !string.IsNullOrWhiteSpace(fcommand[i - 1]))
                    {
                        commands.Cell(i + 1, 1).Range.Text = (i).ToString() + ". " + fcommand[i - 1].Replace("\r", "");
                    }
                    if (i <= scommand.Length && !string.IsNullOrWhiteSpace(scommand[i - 1]))
                    {
                        commands.Cell(i + 1, 2).Range.Text = (i).ToString() + ". " + scommand[i - 1].Replace("\r", "");
                    }
                }
            }
            range      = doc.Range(range.End - 1);
            range.Text = "В конкурсе капитанов победил капитан команды ";
            if (leader)
            {
                range.Text = "В конкурсе капитанов победил капитан команды " + fn;
            }
            else
            {
                range.Text = "В конкурсе капитанов победил капитан команды " + sn;
            }
            range = doc.Range(range.End - 1);
            Table table = doc.Tables.Add(range, gamerounds.Count + 1, 5);

            table.Borders.Enable           = 1;
            table.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth100pt;
            table.Borders.InsideLineWidth  = WdLineWidth.wdLineWidth025pt;
            foreach (Row row in table.Rows)
            {
                foreach (Cell cell in row.Cells)
                {
                    if (cell.RowIndex == 1)
                    {
                        if (cell.ColumnIndex == 1)
                        {
                            cell.Range.Text = "Раунд";
                            cell.Range.Bold = 1;
                        }
                        if (cell.ColumnIndex == 2)
                        {
                            cell.Range.Text = fn;
                            cell.Range.Bold = 1;
                        }
                        if (cell.ColumnIndex == 3)
                        {
                            cell.Range.Text = "Вызов";
                            cell.Range.Bold = 1;
                        }
                        if (cell.ColumnIndex == 4)
                        {
                            cell.Range.Text = sn;
                            cell.Range.Bold = 1;
                        }
                        if (cell.ColumnIndex == 5)
                        {
                            cell.Range.Text = "Жюри";
                            cell.Range.Bold = 1;
                        }
                    }
                    else
                    {
                        Gameround gr = gamerounds[cell.RowIndex - 2];
                        if (cell.ColumnIndex == 1)
                        {
                            cell.Range.Text = gr.id;
                        }
                        if (cell.ColumnIndex == 2)
                        {
                            cell.Range.Text = gr.first.ToString();
                        }
                        if (cell.ColumnIndex == 3)
                        {
                            cell.Range.Text = gr.vyzov;
                        }
                        if (cell.ColumnIndex == 4)
                        {
                            cell.Range.Text = gr.secound.ToString();
                        }
                        if (cell.ColumnIndex == 5)
                        {
                            cell.Range.Text = gr.zhury.ToString();
                        }
                    }
                }
            }
            gamerounds.RemoveAt(gamerounds.Count - 1);
            range      = doc.Range(range.End - 1);
            range.Text = "\n" + DateTime.Today.ToShortDateString();
            range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight;
            doc.Save();
            doc.Close();
            application.Quit();
            SaveButton.IsEnabled = true;
        }