private void AddTeamButton_Click(object sender, RoutedEventArgs e) { var addWindow = new AddTeamWindow(); var res = addWindow.ShowDialog(); if (res == true) { Competition.Teams.Add(addWindow.Team); } }
public Team ShowTeam() { #region View and ViewModel _view = new AddTeamWindow(); _viewModel = new AddTeamWindowViewModel() { OkCommand = new RelayCommand(ExecuteOkCommand), CancelCommand = new RelayCommand(ExecuteCancelCommand), Seasons = Seasons, Team = Team }; _view.DataContext = _viewModel; _view.ResizeMode = ResizeMode.NoResize; #endregion return(_view.ShowDialog() == true ? _viewModel.Team : null); }