Exemplo n.º 1
0
        public SingleGameView(IViewModelFactory viewModelFactory, SingleGameTeamSelectorViewModel singleGameTeamSelectorViewModel, bool sortLineup = true)
        {
            InitializeComponent();
            ViewModelFactory = viewModelFactory;
            TeamSetup        = singleGameTeamSelectorViewModel;
            var awayTeam             = singleGameTeamSelectorViewModel.AwayTeam;
            var awayTeamLineupEditor = new SingleGameTeamLineupEditorView(viewModelFactory, awayTeam, false, sortLineup);

            awayTeamLineupEditor.ShowDialog();
            var awayTeamLineupEditorViewModel = (SingleGameTeamLineupEditorViewModel)awayTeamLineupEditor.DataContext;

            awayTeam = awayTeamLineupEditorViewModel.Team;
            var awayTeamBullpenEditor = new SingleGameTeamBullpenEditorView(viewModelFactory, awayTeam);

            awayTeamBullpenEditor.ShowDialog();
            var awayTeamBullpenEditorViewModel = (SingleGameTeamBullpenEditorViewModel)awayTeamBullpenEditor.DataContext;

            awayTeam = awayTeamBullpenEditorViewModel.Team;
            var homeTeam             = singleGameTeamSelectorViewModel.HomeTeam;
            var homeTeamLineupEditor = new SingleGameTeamLineupEditorView(viewModelFactory, homeTeam, false, sortLineup);

            homeTeamLineupEditor.ShowDialog();
            var homeTeamLineupEditorViewModel = (SingleGameTeamLineupEditorViewModel)homeTeamLineupEditor.DataContext;

            homeTeam = homeTeamLineupEditorViewModel.Team;
            var homeTeamBullpenEditor = new SingleGameTeamBullpenEditorView(viewModelFactory, homeTeam);

            homeTeamBullpenEditor.ShowDialog();
            var homeTeamBullpenEditorViewModel = (SingleGameTeamBullpenEditorViewModel)homeTeamBullpenEditor.DataContext;

            homeTeam    = homeTeamBullpenEditorViewModel.Team;
            DataContext = viewModelFactory.GetViewModel(GetType().ToString(), new List <ViewModelBase> {
                homeTeam, awayTeam
            });
        }
Exemplo n.º 2
0
        private void awayTeamBullpenButton_Click(object sender, RoutedEventArgs e)
        {
            var viewModel             = (SingleGameViewModel)DataContext;
            var awayTeamBullpenEditor = new SingleGameTeamBullpenEditorView(ViewModelFactory, viewModel.AwayTeam, true);

            awayTeamBullpenEditor.ShowDialog();
            var awayTeamBullpenEditorViewModel = (SingleGameTeamBullpenEditorViewModel)awayTeamBullpenEditor.DataContext;
            var awayTeam = awayTeamBullpenEditorViewModel.Team;

            viewModel.UpdateAwayTeamBullpen(awayTeam);
        }