示例#1
0
 private void _onOneOfTheRunSelected(object sender, ASTaskViewModel e)
 {
     SelectedRun = e;
     foreach (var t in Tasks)
     {
         if (t != e)
         {
             t.IsSelected = false;
         }
     }
     //OnProjectSelected(this);
 }
示例#2
0
 public ProjectViewModel(Project m) : this()
 {
     _model = m;
     _tasks = new ObservableCollection <ASTaskViewModel>();
     foreach (var tsk in m.Tasks)
     {
         var newTask = new ASTaskViewModel(tsk);
         newTask.RunSelected += _onOneOfTheRunSelected;
         _tasks.Add(newTask);
         newTask.Parent = this;
     }
 }
示例#3
0
        public void AddANewTask(string newtaskName)
        {
            ASTask newTask = _model.CreatTaskDir(newtaskName);

            var newTaskViewModel = new ASTaskViewModel(newTask);

            newTaskViewModel.RunSelected += _onOneOfTheRunSelected;
            Tasks.Add(newTaskViewModel);
            newTaskViewModel.Parent = this;
            this.SelectedRun        = newTaskViewModel;
            Tasks = new ObservableCollection <ASTaskViewModel>(Tasks);
            newTaskViewModel.IsSelected = true;
        }
示例#4
0
        private void _newTaskNameAccepted(object sender, ProjectViewModel e)
        {
            _addataskdialogbox.Close();
            var newtaskName = ((AddTaskViewModel)sender).NewTaskName;
            //var TaskExistsFlag = false;
            ASTaskViewModel taskExist = null;

            foreach (var task in e.Tasks)
            {
                if (task.TaskName == newtaskName)
                {
                    taskExist = task;
                    //TaskExistsFlag = true;
                    break;
                }
            }
            if (taskExist != null)
            {
                var taskCanRun = !taskExist.Model.FindRunGeneratedFile();
                if (taskCanRun)
                {
                    var rsp = MessageBox.Show("Task exists, do you want to overwrite it?", "Warning!", MessageBoxButton.YesNo);
                    if (rsp == MessageBoxResult.Yes)
                    {
                        taskExist.IsSelected = true;
                    }
                    else
                    {
                        _showAddTaskPopupWindow(e);
                    }
                }
                else
                {
                    MessageBox.Show("Task exists, please give a new name!", "Error!", MessageBoxButton.OK);
                    _showAddTaskPopupWindow(e);
                }
            }
            else
            {
                SelectedProject = e;
                e.AddANewTask(newtaskName);
                //_model.GenerateProjectTree();
                //_setupProjectTree();
            }
        }
示例#5
0
        public void DeleteATask(ASTaskViewModel e)
        {
            var dialogResult = MessageBox.Show("Are you sure you want to delete this task: " + e.TaskName + " ?", "Warning!", MessageBoxButton.YesNo);

            if (dialogResult == MessageBoxResult.Yes)
            {
                foreach (var task in _model.Tasks)
                {
                    if (task.TaskName == e.TaskName)
                    {
                        _model.Tasks.Remove(task);
                        _model.RemoveTaskDirRecursively(task.TaskPath);
                        break;
                    }
                }
                Tasks.Remove(e);
            }
        }
示例#6
0
 protected virtual void OnRunSelected(ASTaskViewModel e)
 {
     RunSelected?.Invoke(this, e);
 }