Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
0
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     if (this != e.Workspace)
     {
         base.OnRequestOpen(sender, e);
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
        protected virtual void OnRequestDelete(object sender, WorkspaceRequestEventArgs e)
        {
            var handler = this.RequestDelete;

            if (null != handler)
            {
                handler(sender, e);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 11
0
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     e = new WorkspaceRequestEventArgs(new TaskViewModel(_task, _dialog));
     base.OnRequestOpen(this, e);
 }
Ejemplo n.º 12
0
 protected virtual void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     var handler = this.RequestOpen;
     if (null != handler)
         handler(sender, e);
 }
Ejemplo n.º 13
0
 protected override void OnRequestOpen(object sender, WorkspaceRequestEventArgs e)
 {
     e = new WorkspaceRequestEventArgs(new TaskViewModel(_task, _dialog));
     base.OnRequestOpen(this, e);
 }
Ejemplo n.º 14
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;
     }
 }
Ejemplo n.º 15
0
 void OnWorkspaceRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     _workspaces.Remove(e.Workspace);
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 19
0
 void OnWorkspaceRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     _workspaces.Remove(e.Workspace);
 }
Ejemplo n.º 20
0
 protected override void OnRequestClose(object sender, WorkspaceRequestEventArgs e)
 {
     this.IsExpanded = false;
 }
Ejemplo n.º 21
0
 void OnItemRequestDelete(object sender, WorkspaceRequestEventArgs e)
 {
     this.Remove(e.Workspace as T);
 }
Ejemplo n.º 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);
     }
 }