Ejemplo n.º 1
0
        /// <summary>
        /// View model which supports the data pane on the main window.
        /// </summary>
        /// <param name="model">Junior handicap model</param>
        public DataPaneViewModel(IModel model)
        {
            this.model = model;

            this.mobTrophyPointsTableViewModel =
                new MobTrophyPointsTableViewModel(
                    this.model.CurrentSeason);
            this.teamTrophyPointsTableViewModel =
                new TeamTrophyPointsTableViewModel(
                    this.model.CurrentSeason);
            this.pointsTableViewModel =
                new PointsTableViewModel(
                    this.model);
            this.eventSummaryViewModel =
                new SummaryEventViewModel(
                    this.model.CurrentEvent);
            this.seasonSummaryViewModel =
                new SummaryTotalViewModel(
                    this.model.CurrentSeason);
            this.resultsTableViewModel =
                new ResultsTableViewModel(
                    this.model.CurrentEvent);

            this.dataViewContents = this.seasonSummaryViewModel;

            this.ShowMobTrophyPointsTableCommand  = new SimpleCommand(this.SelectMobTrophyPointsTable);
            this.ShowTeamTrophyPointsTableCommand = new SimpleCommand(this.SelectTeamTrophyPointsTable);
            this.ShowEventSummaryCommand          = new SimpleCommand(this.SelectEventSummaryData);
            this.ShowPointsTableCommand           = new SimpleCommand(this.SelectPointsTable);
            this.ShowResultsCommand       = new SimpleCommand(this.SelectResultsTable);
            this.ShowSeasonSummaryCommand = new SimpleCommand(this.SelectSeasonSummaryData);
        }
        protected override DataTemplate SelectTemplateCore(object item)
        {
            SummaryCategoryViewModel main = item as SummaryCategoryViewModel;

            if (main != null)
            {
                return(Category);
            }

            SummaryTotalViewModel summary = item as SummaryTotalViewModel;

            if (summary != null)
            {
                return(Total);
            }

            return(base.SelectTemplateCore(item));
        }