コード例 #1
0
        public override async void Initialize(MainWindow mainWindow)
        {
            _adminClient = new AdminClientServiceClient();
            MainWindow   = mainWindow;

            #region View And ViewModel
            _view = new MatchesWindow();
            // Check if service is available
            if (!await AdminClientHelper.IsAvailable(_adminClient))
            {
                return;
            }
            var seasons = await _adminClient.GetSeasonsAsync();

            var matches = await _adminClient.GetMatchesAsync(seasons.FirstOrDefault());

            _viewModel = new MatchesWindowViewModel
            {
                Seasons                = seasons.ToList(),
                SelectedSeason         = seasons.FirstOrDefault(),
                Matches                = matches.ToList(),
                BackCommand            = new RelayCommand(ExecuteBackCommand),
                AddCommand             = new RelayCommand(ExecuteAddCommand),
                DeleteCommand          = new RelayCommand(ExecuteDeleteCommand),
                ChangeCommand          = new RelayCommand(ExecuteChangeCommand),
                GenerateMatchesCommand = new RelayCommand(ExecuteGenerateCommand),
                LoadMatchDayCommand    = new RelayCommand(ExecuteLoadMatchCommand)
            };
            _view.DataContext = _viewModel;
            _viewModel.SelectionSeasonChanged += UpdateSeason;
            #endregion

            _view.MatchesDataGrid.Loaded += SetMinWidths;
            MainWindow.Content            = _view;
        }
コード例 #2
0
        protected override async void ReloadModels()
        {
            var matches = await _adminClient.GetMatchesAsync(_viewModel.SelectedSeason);

            _viewModel.Matches = matches.ToList();
        }