コード例 #1
0
 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);
     }
 }
コード例 #2
0
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     if (this != e.Workspace)
     {
         base.OnRequestOpen(sender, e);
     }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        protected virtual void OnRequestDelete(object sender, WorkspaceRequestEventArgs e)
        {
            var handler = this.RequestDelete;

            if (null != handler)
            {
                handler(sender, e);
            }
        }
コード例 #5
0
        void OnWorkspaceRequestOpen(object sender, WorkspaceRequestEventArgs e)
        {
            _workspaces.Add(e.Workspace);
            var cv = CollectionViewSource.GetDefaultView(this.Workspaces);

            if (null != cv)
            {
                cv.MoveCurrentTo(e.Workspace);
            }
        }
コード例 #6
0
 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;
     }
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
 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);
         }
     }
 }
コード例 #9
0
        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);
                }
            }
        }
コード例 #10
0
 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;
     }
 }
コード例 #11
0
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     e = new WorkspaceRequestEventArgs(new TaskViewModel(_task, _dialog));
     base.OnRequestOpen(this, e);
 }
コード例 #12
0
 protected virtual void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     var handler = this.RequestOpen;
     if (null != handler)
         handler(sender, e);
 }
コード例 #13
0
ファイル: TaskViewModel.cs プロジェクト: Lovesan/Organizer
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     e = new WorkspaceRequestEventArgs(new TaskViewModel(_task, _dialog));
     base.OnRequestOpen(this, e);
 }
コード例 #14
0
ファイル: TaskViewModel.cs プロジェクト: Lovesan/Organizer
 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;
     }
 }
コード例 #15
0
 void OnWorkspaceRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     _workspaces.Remove(e.Workspace);
 }
コード例 #16
0
 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);
         }
     }
 }
コード例 #17
0
 void OnWorkspaceRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     _workspaces.Add(e.Workspace);
     var cv = CollectionViewSource.GetDefaultView(this.Workspaces);
     if (null != cv)
         cv.MoveCurrentTo(e.Workspace);
 }
コード例 #18
0
 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);
     }
 }
コード例 #19
0
 void OnWorkspaceRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     _workspaces.Remove(e.Workspace);
 }
コード例 #20
0
 protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     this.IsExpanded = false;
 }
コード例 #21
0
 void OnItemRequestDelete(object sender, WorkspaceRequestEventArgs e)
 {
     this.Remove(e.Workspace as T);
 }
コード例 #22
0
 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);
     }
 }