private void LoadTournament() { Log.Debug("Loading tournament..."); TournamentRepository tournamentRepository = new TournamentRepository(); if (SelectedFile != null) { Tournament tournament = tournamentRepository.LoadTournamentFromXML(SelectedFile.RecentFile.FullName); var tournamentViewModel = new TournamentViewModel(tournament, SelectedFile.RecentFile.FullName); Messenger.Default.Send(new NotificationMessage <ViewModelBase>(this, tournamentViewModel, "TournamentViewModel")); } else { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Open XML bestand"; openFileDialog.DefaultExt = ".xml"; openFileDialog.Filter = "XML documents (.xml)|*.xml"; openFileDialog.CheckFileExists = true; openFileDialog.CheckPathExists = true; if (openFileDialog.ShowDialog() == true) { Tournament tournament = tournamentRepository.LoadTournamentFromXML(openFileDialog.FileName); var tournamentViewModel = new TournamentViewModel(tournament); Messenger.Default.Send(new NotificationMessage <ViewModelBase>(this, tournamentViewModel, "TournamentViewModel")); } } //Making it null again in case we want to access the method out of the first window (for example starting a new tournament while in the tournamentViewModel) //If we don't do this, we always get in the first if and it will always open the tournament that was originally selected. SelectedFile = null; }
private void StartNewTournament() { Log.Debug("Starting new tournament..."); var tournamentViewModel = new TournamentViewModel(); Messenger.Default.Send(new NotificationMessage <ViewModelBase>(this, tournamentViewModel, "TournamentViewModel")); }
private void LoadTournament() { Log.Debug("Loading tournament..."); TournamentRepository tournamentRepository = new TournamentRepository(); if(SelectedFile != null) { Tournament tournament = tournamentRepository.LoadTournamentFromXML(SelectedFile.RecentFile.FullName); var tournamentViewModel = new TournamentViewModel(tournament, SelectedFile.RecentFile.FullName); Messenger.Default.Send(new NotificationMessage<ViewModelBase>(this, tournamentViewModel, "TournamentViewModel")); } else { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Open XML bestand"; openFileDialog.DefaultExt = ".xml"; openFileDialog.Filter = "XML documents (.xml)|*.xml"; openFileDialog.CheckFileExists = true; openFileDialog.CheckPathExists = true; if (openFileDialog.ShowDialog() == true) { Tournament tournament = tournamentRepository.LoadTournamentFromXML(openFileDialog.FileName); var tournamentViewModel = new TournamentViewModel(tournament); Messenger.Default.Send(new NotificationMessage<ViewModelBase>(this, tournamentViewModel, "TournamentViewModel")); } } //Making it null again in case we want to access the method out of the first window (for example starting a new tournament while in the tournamentViewModel) //If we don't do this, we always get in the first if and it will always open the tournament that was originally selected. SelectedFile = null; }
private void StartNewTournament() { Log.Debug("Starting new tournament..."); var tournamentViewModel = new TournamentViewModel(); Messenger.Default.Send(new NotificationMessage<ViewModelBase>(this,tournamentViewModel,"TournamentViewModel")); }