예제 #1
0
        private void Continue_Click(object sender, EventArgs e)
        {
            Hide();
            // MessageBox.Show("1");
            TimerSettings.Container = new CompetitionsContainer();
            TimerSettings.Competition.Teams.Setup(false);
            TimerSettings.Container.LaunchSupervisor = LaunchSupervisor.Text;
            TimerSettings.Container.MainJudge        = MainJudge.Text;
            TimerSettings.Container.Scorekeeper      = Scorekeeper.Text;
            //MessageBox.Show("2");
            TimerSettings.Competition.Teams.CurrentModel = (CompetingModels)StartModelIndex.SelectedItem;


            TimerSettings.Container.Name = CMName.Text;
            //TimerSettings.Container.PartsOfCompetitions = new List<Competition>();
            TimerSettings.Container.Competition = TimerSettings.Competition;
            //TimerSettings.Container.CurrentState = TimerSettings.Competition;
            //MessageBox.Show("3");
            //Async!

            TimerSettings.MakeEnvironment();
            TimerSettings.CurrentProjectFolder = Path.Combine(TimerSettings.CompetitionProjects, DateTime.Now.ToString("D") + " " + DateTime.Now.ToString("H-mm-ss"));
            Directory.CreateDirectory(Path.Combine(TimerSettings.CurrentProjectFolder));

            //TimerSettings.Container.Name +
            BGSaver.SaveData();
            //MessageBox.Show("4");

            MainForm MF = new MainForm();

            MF.Closed += (s, a) => Close();
            MF.Show();
        }
예제 #2
0
        public void Finish(bool Recover = false, bool FinishEntirely = true)
        {
            BGSaver.SaveData();
            TimerSettings.Competition.Finished = FinishEntirely;
            //onCompetitionFinished();
            //return; //FIX
            //List<byte> MinRounds = new List<byte>();

            /*foreach (var T in TimerSettings.Competition.Teams.AllTeams)
             * {
             *  //var Rc =
             *  var BR = T.Rounds.FindAll(delegate (Round R) { return !R.Finished; });
             *  foreach (var R in BR)
             *  {
             *      T.Rounds.Remove(R);
             *  }
             *  //MinRounds.Add((byte)T.Rounds.Count);
             * }*/
            //byte minr = MinRounds.ToArray().Min();
            if (!Recover)
            {
                foreach (var TC in TimerSettings.Competition.Teams.TeamClumps)
                {
                    List <byte> MinRounds = new List <byte>();
                    foreach (var T in TC.Teams())
                    {
                        MinRounds.Add((byte)T.Rounds.Count);
                    }
                    byte minr = MinRounds.ToArray().Min();

                    foreach (var T in TC.Teams())
                    {
                        T.SetRoundsCount(minr);
                    }
                }
            }
            else
            {
                foreach (var TC in TimerSettings.Competition.Teams.TeamClumps)
                {
                    List <byte> MaxRounds = new List <byte>();
                    foreach (var T in TC.Teams())
                    {
                        MaxRounds.Add((byte)T.Rounds.Count);
                    }
                    byte maxr = MaxRounds.ToArray().Max();

                    foreach (var T in TC.Teams())
                    {
                        T.SetRoundsCount(maxr);
                    }
                }
            }
            if (onCompetitionFinished != null)
            {
                onCompetitionFinished();
            }
        }
예제 #3
0
        private void Print_Click(object sender, EventArgs e)
        {
            var T1 = GetTeam(0);
            var T2 = GetTeam(1);
            var T3 = GetTeam(2);

            if ((T1.CurrentRound.Finished | T2.CurrentRound.Finished | T3.CurrentRound.Finished) && !Stopwatch.Started)
            {
                Print.Enabled = false;
                ChoosePilots(true);
                void PrintReport()
                {
                    var Print = new Thread(new ThreadStart(() =>
                    {
                        RoundReport.MakeReport();
                    }));

                    Print.IsBackground = true;
                    Print.Start();

                    //NewSetOfTeams();
                    StopTimer(true);
                    //ClearTimer();
                }

                void PrintFunc()
                {
                    if (!TimerSettings.NoPrePrintAsking)
                    {
                        var PM = new PrintModeSelector();
                        PM.Show();
                        PM.FormClosing += (s, a) => { PrintReport(); };
                    }
                    else
                    {
                        PrintReport();
                    }
                    //Might be deleted. Just allow any num of prints
                }

                PrintFunc();
                BGSaver.SaveData();
            }
            else
            {
                MessageBox.Show("Не хватает данных для вывода на печать!");
            }
        }
예제 #4
0
        private void ChangePilot(int ModelNum)
        {
            TeamsListForm LF = new TeamsListForm(true);

            ChoosePilots();
            LF.Closing += (s, a) =>
            {
                if (LF.Choosen_Team != null)
                {
                    Start.Enabled = true;
                    switch (ModelNum)
                    {
                    case 0:
                        TimerSettings.Competition.Teams.First = LF.Choosen_Team;
                        M1Round.Value = TimerSettings.Competition.Teams.First.CurrentRoundNum + 1;
                        break;

                    case 1:
                        TimerSettings.Competition.Teams.Second = LF.Choosen_Team;
                        M2Round.Value = TimerSettings.Competition.Teams.Second.CurrentRoundNum + 1;
                        break;

                    case 2:
                        TimerSettings.Competition.Teams.Third = LF.Choosen_Team;
                        M3Round.Value = TimerSettings.Competition.Teams.Third.CurrentRoundNum + 1;
                        break;
                    }
                }
                ChoosePilots(true);
                if (LF.SomethingChanged)
                {
                    UpdateTeamsData();
                }
                BGSaver.SaveData();
            };
            LF.Show();
        }