Exemple #1
0
        public ReportSettingsViewModel(IMatchManager matchManager, IReportGenerationQueueManager reportGenerationQueueManager, IEventAggregator events)
        {
            MatchManager = matchManager;
            ReportGenerationQueueManager = reportGenerationQueueManager;
            Events = events;

            Sets = new SortedDictionary <string, List <Rally> >();
            if (MatchManager.Match != null)
            {
                foreach (var rally in MatchManager.Match.Rallies)
                {
                    var          setNumber = (rally.CurrentSetScore.First + rally.CurrentSetScore.Second + 1).ToString();
                    List <Rally> rallyList;
                    if (!Sets.TryGetValue(setNumber, out rallyList))
                    {
                        Sets[setNumber] = new List <Rally>();
                    }
                    Sets[setNumber].Add(rally);
                }
            }

            _generatedReport = new Dictionary <string, object>();

            StrokeStats = new Dictionary <int, string[]>
            {
                [1]   = new[] { "side", Properties.Resources.report_settings_strokechoice_side },
                [2]   = new[] { "steparound", Properties.Resources.report_settings_strokechoice_steparound },
                [4]   = new[] { "spin", Properties.Resources.table_spin_title },
                [8]   = new[] { "technique", Properties.Resources.report_settings_strokechoice_technique },
                [16]  = new[] { "placement", Properties.Resources.report_settings_strokechoice_placement },
                [32]  = new[] { "table", Properties.Resources.table_large_tab_title },
                [64]  = new[] { "service", Properties.Resources.report_settings_strokechoice_service },
                [128] = new[] { "number", Properties.Resources.report_settings_strokechoice_number }
            };

            GeneralStats = new Dictionary <int, string[]>
            {
                [1] = new[] { "rallylength", Properties.Resources.report_settings_generalchoice_rallylength },
                [2] = new[] { "matchdynamics", Properties.Resources.report_settings_generalchoice_matchdynamics },
                [4] =
                    new[] { "transitionmatrix", Properties.Resources.report_settings_generalchoice_transitionmatrix },
                [8] = new[] { "techefficiency", Properties.Resources.report_settings_generalchoice_techefficiency }
            };

            DisplayName     = Properties.Resources.report_settings_window_title;
            AvailableCombis = new List <int>();
            SelectedCombis  = new List <int>();

            Load();
            ReportGenerationQueueManager.Start();

            PropertyChanged += ReportSettingsViewModel_PropertyChanged;
            ReportGenerationQueueManager.ReportGenerated += ReportGenerationQueueManager_ReportGenerated;
        }
        public ShellViewModel(IWindowManager windowmanager, IEventAggregator eventAggregator, IMatchManager manager, IReportGenerationQueueManager queueManager, IDialogCoordinator coordinator)
        {
            this.DisplayName = "";

            _windowManager = windowmanager;
            _reportGenerationQueueManager = queueManager;
            Events            = eventAggregator;
            MatchManager      = manager;
            DialogCoordinator = coordinator;

            // for translation testing - don't set for production!
            //CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("de-DE");
            //CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("de-DE");

            TryDeleteTmpFiles();
        }