public StartUpViewModel() { InitCommands(); _recentFileRepository = new RecentFileRepository(); var temp = _recentFileRepository.GetRecentFiles(); RecentFiles = new ObservableCollection<RecentFileViewModel>(); foreach (FileInfo f in temp) { var v = new RecentFileViewModel(f); RecentFiles.Add(v); } }
//TODO Repositories solution: We shouldn't create them each time we need them. Can we make them accesible everywhere somehow? i.e static class controller? /// <summary> /// This method is responsible for saving a tournament to a certain path. /// TODO Should we insert a recent file here or automaticly when we save a tournament, so in the tournament repository. /// </summary> /// <param name="uri"></param> private void Save(string uri) { Log.Debug(uri); RecentFileRepository recentFileRepository = new RecentFileRepository(); TournamentRepository tournamentRepository = new TournamentRepository(); tournamentRepository.SaveTournamentAsXML(CurrentTournament, uri); recentFileRepository.InsertFile(uri); }