Exemple #1
0
        public FormRepeatTask(RepeatTask t)
        {
            InitializeComponent();
            rTask = t;

            textBoxName.Text = rTask.Name;

            // Load Repeat settings
            numericUpDownRepetitions.Value = rTask.numRepeats;
            numericUpDownTimeLimit.Value = rTask.TimeLimit;
            switch (rTask.RepeatEndType)
            {
                case RepeatEndType.Repetitions:
                    radioButtonRepetitions.Checked = true;
                    numericUpDownRepetitions.Enabled = true;
                    numericUpDownTimeLimit.Enabled = false;
                    break;
                case RepeatEndType.TimeLimit:
                    radioButtonTimeLimit.Checked = true;
                    numericUpDownRepetitions.Enabled = false;
                    numericUpDownTimeLimit.Enabled = true;
                    break;
                case RepeatEndType.Both:
                    radioButtonBoth.Checked = true;
                    numericUpDownRepetitions.Enabled = true;
                    numericUpDownTimeLimit.Enabled = true;
                    break;
                default:
                    throw new System.Exception("Unknown RepeatEndType!");
            }
        }
Exemple #2
0
 public RepeatTask(RepeatTask rt)
 {
     Name = rt.Name;
     numRepeats = rt.numRepeats;
     TimeLimit = rt.TimeLimit;
     RepeatEndType = rt.RepeatEndType;
     endCondition = rt.endCondition.returnNew();
     tasks = new List<Task>();
     for (int i = 0; i < rt.tasks.Count; i++)
         tasks.Add(rt.tasks[i]);
 }
Exemple #3
0
        public Therapy()
        {
            Name = "Unnamed Therapy";

            //Creating root repeat task
            tasks = new RepeatTask();
            tasks.Name = "root";
            tasks.numRepeats = 1;
            tasks.RepeatEndType = RepeatEndType.Repetitions;
            tasks.endCondition = new Repeat_rEndCondition();
            ((Repeat_rEndCondition)tasks.endCondition).Initialize(1);
        }
Exemple #4
0
 private void buttonCreate_Click(object sender, EventArgs e)
 {
     Task newTask;
     Form newTaskForm;
     switch (listBoxTasks.SelectedIndex)
     {
         case 0:
             newTask = new DialogTask();
             newTaskForm = new FormDialogTask((DialogTask) newTask);
             break;
         case 1:
             newTask = new Task2D();
             newTaskForm = new Form2DTask((Task2D) newTask);
             break;
         case 2:
             newTask = new RepeatTask();
             newTaskForm = new FormRepeatTask((RepeatTask) newTask);
             break;
         default:
             return;
     }
     this.Visible = false;
     newTaskForm.Tag = this.Tag;
     DialogResult result = newTaskForm.ShowDialog();
     if (result == DialogResult.OK)
     {
         //if the task name is left empty then set it to a generic name based on the task type
         if (newTask.Name == null || newTask.Name.Length == 0)
         {
             switch (listBoxTasks.SelectedIndex)
             {
                 case 0:
                     newTask.Name = "Dialog Task";
                     break;
                 case 1:
                     newTask.Name = "2D Task";
                     break;
                 case 2:
                     newTask.Name = "Repeat Task";
                     break;
                 default:
                     newTask.Name = "Task Name";
                     return;
             }
         }
         therapy.addTask(newTask);
         this.DialogResult = DialogResult.OK;
     }
     else
         this.DialogResult = DialogResult.Cancel;
     this.Close();
 }
Exemple #5
0
 public Therapy(Therapy t)
 {
     Name = "copy of " + t.Name;
     tasks = (RepeatTask)t.tasks.returnNew();
 }