void New() { var r = new TaskRepository(); var rvm = new RepositoryViewModel(r, _dialogFactory); _repositories.Add(rvm); SetActiveRepository(rvm); }
void SetActiveRepository(RepositoryViewModel ws) { var cv = CollectionViewSource.GetDefaultView(this.Repositories); if (null != cv) { cv.MoveCurrentTo(ws); } }
protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { String filename = _dialog.OpenFileDialog("Repository files|*.xml|All files|*.*"); if (null != filename) { var r = TaskRepository.Load(filename); if (null == (r as IDataErrorInfo).Error) { var rvm = new RepositoryViewModel(r, _dialogFactory, filename); _repositories.Add(rvm); SetActiveRepository(rvm); } else { _dialog.MessageBox( (r as IDataErrorInfo).Error, "Error loading repository", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error); } } }
void SetActiveRepository(RepositoryViewModel ws) { var cv = CollectionViewSource.GetDefaultView(this.Repositories); if (null != cv) cv.MoveCurrentTo(ws); }
void New() { var r = new TaskRepository(); var rvm = new RepositoryViewModel(r, _dialogFactory); _repositories.Add(rvm); SetActiveRepository(rvm); }
protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { String filename = _dialog.OpenFileDialog("Repository files|*.xml|All files|*.*"); if (null != filename) { var r = TaskRepository.Load(filename); if (null == (r as IDataErrorInfo).Error) { var rvm = new RepositoryViewModel(r, _dialogFactory, filename); _repositories.Add(rvm); SetActiveRepository(rvm); } else { _dialog.MessageBox( (r as IDataErrorInfo).Error, "Error loading repository", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error); } } }