Example #1
0
 public void RemoveTask(GanttTaskViewModel task)
 {
     if (_TaskList.Remove(task))
     {
         OnPropertyChanged("Tasks");
     }
 }
Example #2
0
        private void LoadGanttModel(GanttModel gantt)
        {
            _selectedTask = null;
            _project      = gantt;
            _filePath     = null;
            _TaskList     = new BoundObservableCollection <GanttTaskViewModel, GanttTaskModel>(
                gantt.Tasks,
                m => new GanttTaskViewModel(m),          // creates a ViewModel from a Model
                vm => vm.GanttTaskModel,                 // retrieve the source object
                (vm, m) => vm.GanttTaskModel.Equals(m)); // checks if the ViewModel corresponds to the specified model
            _MilestoneList = new BoundObservableCollection <MilestoneViewModel, MilestoneModel>(
                gantt.Milestones,
                m => new MilestoneViewModel(m),          // creates a ViewModel from a Model
                vm => vm.MilestoneModel,                 // retrieve the source object
                (vm, m) => vm.MilestoneModel.Equals(m)); // checks if the ViewModel corresponds to the specified model

            // this allow to track modifications on project (this is basic, should be improved)
            _TaskList.CollectionChanged      += (sender, e) => { Saved = false; };
            _MilestoneList.CollectionChanged += (sender, e) => { Saved = false; };

            UpdateDuration();

            OnPropertyChanged(null); //update all fields

            Saved = true;            // no modification has pending !
        }
Example #3
0
 public void AddTask(GanttTaskViewModel task)
 {
     _TaskList.Add(task);
     OnPropertyChanged("Tasks");
     task.ShowEditForm();
 }