public ViewFactory() { _prototypes = new Dictionary <string, ViewProvider>(); _prototypes["Startlist_1stRun_StartnumberAscending"] = new FirstRunStartListViewProvider(); _prototypes["Startlist_1stRun_Points_0"] = new DSVFirstRunStartListViewProvider(0); _prototypes["Startlist_1stRun_Points_15"] = new DSVFirstRunStartListViewProvider(15); _prototypes["Startlist_1stRun_Points_30"] = new DSVFirstRunStartListViewProvider(30); _prototypes["Startlist_2nd_StartnumberAscending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Ascending); //_prototypes["Startlist_2nd_StartnumberAscending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Ascending); _prototypes["Startlist_2nd_StartnumberDescending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Descending); //_prototypes["Startlist_2nd_StartnumberDescending"] = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Descending); _prototypes["Startlist_2nd_PreviousRun_0_OnlyWithResults"] = new BasedOnResultsFirstRunStartListViewProvider(0, false); _prototypes["Startlist_2nd_PreviousRun_0_AlsoWithoutResults"] = new BasedOnResultsFirstRunStartListViewProvider(0, true); _prototypes["Startlist_2nd_PreviousRun_15_OnlyWithResults"] = new BasedOnResultsFirstRunStartListViewProvider(15, false); _prototypes["Startlist_2nd_PreviousRun_15_AlsoWithoutResults"] = new BasedOnResultsFirstRunStartListViewProvider(15, true); _prototypes["Startlist_2nd_PreviousRun_30_OnlyWithResults"] = new BasedOnResultsFirstRunStartListViewProvider(30, false); _prototypes["Startlist_2nd_PreviousRun_30_AlsoWithoutResults"] = new BasedOnResultsFirstRunStartListViewProvider(30, true); _prototypes["Startlist_2nd_PreviousRun_all_OnlyWithResults"] = new BasedOnResultsFirstRunStartListViewProvider(int.MaxValue, false); _prototypes["Startlist_2nd_PreviousRun_all_AlsoWithoutResults"] = new BasedOnResultsFirstRunStartListViewProvider(int.MaxValue, true); _prototypes["RaceResult_BestOfTwo"] = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.BestRun); _prototypes["RaceResult_Sum"] = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.Sum); _prototypes["RaceResult_SumBest2"] = new RaceResultViewProvider(RaceResultViewProvider.TimeCombination.SumBest2); _prototypes["RaceResult_SumDSVPointsSchool"] = new DSVSchoolRaceResultViewProvider(); _prototypes["RaceRunResult"] = new RaceRunResultViewProvider(); }
public StartListViewProvider GetStartlistViewProvider(RaceRun rr, string context = null) { ViewFactory factory = Singleton <ViewFactory> .Instance; StartListViewProvider slVP; // First Run if (1 == rr.Run) { FirstRunStartListViewProvider frslVP = factory.Create <FirstRunStartListViewProvider>(_config.Run1_StartistView); // Backup if nothing has been created if (frslVP == null) { frslVP = new FirstRunStartListViewProvider(); } frslVP.SetDefaultGrouping(_config.Run1_StartistViewGrouping); frslVP.Init(rr.GetRace().GetParticipants()); slVP = frslVP; } else // Second or later run { // Figure out previous run RaceRun rrPrevious = rr.GetRace().GetRuns().Where(r => r.Run == (rr.Run - 1U)).First(); SecondRunStartListViewProvider srslVP = factory.Create <SecondRunStartListViewProvider>(_config.Run2_StartistView); if (srslVP == null) { srslVP = new SimpleSecondRunStartListViewProvider(StartListEntryComparer.Direction.Ascending); } srslVP.SetDefaultGrouping(_config.Run2_StartistViewGrouping); srslVP.Init(rrPrevious); slVP = srslVP; } return(slVP); }