protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e) { if (this == e.Workspace) { if (_repositories.Any(rvm => !rvm.IsSaved)) { bool?r = _dialog.MessageBox( "Some repositories were not saved. Exit anyway?", "Modified repositories exist.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) { base.OnRequestClose(this, e); } } else { _repositories.Clear(); base.OnRequestClose(this, e); } } else { _repositories.Remove(e.Workspace as RepositoryViewModel); } }
protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { if (this != e.Workspace) { base.OnRequestOpen(sender, e); } }
protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { if (this == e.Workspace) { var tlvm = new TaskListViewModel(_collection, _repository, _dialog, this); e = new WorkspaceRequestEventArgs(tlvm); } base.OnRequestOpen(sender, e); }
protected virtual void OnRequestDelete(object sender, WorkspaceRequestEventArgs e) { var handler = this.RequestDelete; if (null != handler) { handler(sender, e); } }
void OnWorkspaceRequestOpen(object sender, WorkspaceRequestEventArgs e) { _workspaces.Add(e.Workspace); var cv = CollectionViewSource.GetDefaultView(this.Workspaces); if (null != cv) { cv.MoveCurrentTo(e.Workspace); } }
protected override void OnRequestDelete(object sender, WorkspaceRequestEventArgs e) { this.IsSaved = false; base.OnRequestClose(this, new WorkspaceRequestEventArgs(this)); if (null == _taskCollection.Collection) { _repository.Remove(_taskCollection); } else { _taskCollection.Collection = null; } }
protected override void OnRequestDelete(object sender, WorkspaceRequestEventArgs e) { bool?r = _dialog.MessageBox( "Are you sure you want to delete task '" + this.DisplayName + "'?", "Confirm task deletion.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) { this.IsSaved = false; base.OnRequestClose(this, new WorkspaceRequestEventArgs(this)); _task.Collection = null; } }
protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e) { if (this.IsSaved) { base.OnRequestClose(sender, e); } else { bool?r = _dialog.MessageBox( "Changes have been made to repository. " + "Are you sure you want to close it?", "Repository hasn't been saved.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) { base.OnRequestClose(sender, e); } } }
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); } } }
protected override void OnRequestDelete(object sender, WorkspaceRequestEventArgs e) { if (_collection.Count > 0) { bool?r = _dialog.MessageBox( "Are you sure you want to delete it?", "Task collection contains items.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (!r.HasValue || !r.Value) { return; } } this.IsSaved = false; if (null == _collection.Collection) { _repository.Remove(_collection); } else { _collection.Collection = null; } }
protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { e = new WorkspaceRequestEventArgs(new TaskViewModel(_task, _dialog)); base.OnRequestOpen(this, e); }
protected virtual void OnRequestOpen(object sender, WorkspaceRequestEventArgs e) { var handler = this.RequestOpen; if (null != handler) handler(sender, e); }
protected override void OnRequestDelete(object sender, WorkspaceRequestEventArgs e) { bool? r = _dialog.MessageBox( "Are you sure you want to delete task '" + this.DisplayName + "'?", "Confirm task deletion.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) { this.IsSaved = false; base.OnRequestClose(this, new WorkspaceRequestEventArgs(this)); _task.Collection = null; } }
void OnWorkspaceRequestClose(object sender, WorkspaceRequestEventArgs e) { _workspaces.Remove(e.Workspace); }
void OnWorkspaceRequestOpen(object sender, WorkspaceRequestEventArgs e) { _workspaces.Add(e.Workspace); var cv = CollectionViewSource.GetDefaultView(this.Workspaces); if (null != cv) cv.MoveCurrentTo(e.Workspace); }
protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e) { if (this.IsSaved) base.OnRequestClose(sender, e); else { bool? r = _dialog.MessageBox( "Changes have been made to repository. " + "Are you sure you want to close it?", "Repository hasn't been saved.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) base.OnRequestClose(sender, e); } }
protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e) { this.IsExpanded = false; }
void OnItemRequestDelete(object sender, WorkspaceRequestEventArgs e) { this.Remove(e.Workspace as T); }
protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e) { if (this == e.Workspace) { if (_repositories.Any(rvm => !rvm.IsSaved)) { bool? r = _dialog.MessageBox( "Some repositories were not saved. Exit anyway?", "Modified repositories exist.", MessageBoxDialogButtons.OkCancel, MessageBoxDialogIcon.Question); if (r.HasValue && r.Value) base.OnRequestClose(this, e); } else { _repositories.Clear(); base.OnRequestClose(this, e); } } else { _repositories.Remove(e.Workspace as RepositoryViewModel); } }