Beispiel #1
0
 private void OpenPilotStats(string selectedPilot)
 {
     if (!FindAndDisplayStatsWindow(selectedPilot))
     {
         PilotStatsForm statsForm = new PilotStatsForm(selectedPilot, false);
         statsForm.MdiParent = this;
         statsForm.Show();
         statsForm.Focus();
     }
 }
Beispiel #2
0
        private void BuildAndDisplaySquadForm(string squadName, Squad squad)
        {
            Registry.Instance.RemovePilot(squadName);

            int startTour = squad.GetMinTour(squad);
            int endTour = squad.GetMaxTour(squad);
            bool inException = false;
            bool reloadPilotsRequired = false;

            try
            {
                Registry.Instance.GetSquad(squadName).CheckSquadInSync(startTour, endTour);

                SquadScoreStatsBuilder squadBuilder = new SquadScoreStatsBuilder();
                for (int tour = startTour; tour <= endTour; tour++)
                {
                    AcesHighPilotScore score = squadBuilder.BuildSquadScoreObject(squad, tour);
                    if (score.TourDetails.Contains("[NO DATA]"))
                        continue;

                    AcesHighPilotStats stats = squadBuilder.BuildSquadStatsObject(squad, tour, ref reloadPilotsRequired);
                    Registry.PilotStatsRegistry squadStatsReg = new Registry.PilotStatsRegistry();
                    Registry.Instance.AddPilotStatsToRegistry(squadName, squadStatsReg);
                    Registry.Instance.ConstructScoresForPilot(score, squadName);
                    Registry.Instance.ConstructStatsForPilot(stats, squadName);
                }
            }
            catch (SquadOutOfSyncException ex)
            {
                MessageBox.Show(ex.Text, "Squad out of sync error");
                inException = true;
            }
            catch (SquadDoesNotExistInRegistryException squadEx)
            {
                MessageBox.Show(squadEx.Text, "Squad loading error");
                inException = true;
            }

            if (!FindAndDisplayStatsWindow(squadName) && !inException)
            {
                PilotStatsForm form = new PilotStatsForm(squadName, true);
                form.MdiParent = this;
                form.CompositeObjVsObjDataIncomplete = reloadPilotsRequired;
                form.Show();
            }
        }