Beispiel #1
0
 public void push(Task task)
 {
     if (this.isCompleted_)
     {
         Debug.LogError("list task is completed!");
     }
     if (this.begin_ == null && this.end_ == null)
     {
         this.begin_ = task;
         this.end_   = task;
     }
     else
     {
         Task         end       = this.end_;
         TaskShutdown oShutdown = end.shutdown;
         end.shutdown = delegate(){
             oShutdown();
             //Debug.Log ("!!!" + forceExit_);
             if (!forceExit_)
             {
                 TaskManager.Run(task);
             }
             else
             {
                 this.isOver_ = true;
             }
         };
         other_.Add(this.end_);
         this.end_ = task;
     }
 }
Beispiel #2
0
        public static TaskWait Create(float time, TaskShutdown shutdown)
        {
            TaskWait wait = new TaskWait(time);

            TaskManager.PushBack(wait, shutdown);
            return(wait);
        }
Beispiel #3
0
 public static void PushBack(Task task, TaskShutdown func)
 {
     TaskShutdown oShutdown = task.shutdown;
     task.shutdown = delegate (){
         oShutdown();
         func();
     };
 }
Beispiel #4
0
        public static void PushBack(Task task, TaskShutdown func)
        {
            TaskShutdown oShutdown = task.shutdown;

            task.shutdown = delegate(){
                oShutdown();
                func();
            };
        }
Beispiel #5
0
 public ControlableTask(TaskUpdate updateFunc, TaskInit initFunc = null, TaskShutdown shutdownFunc = null, Action pauseFunc = null, Action continuePlayFunc = null)
 {
     _task.update = updateFunc;
     if (initFunc != null)
     {
         _task.init = initFunc;
     }
     if (shutdownFunc != null)
     {
         _task.shutdown = shutdownFunc;
     }
     if (pauseFunc != null)
     {
         onPause = pauseFunc;
     }
     if (continuePlayFunc != null)
     {
         onContiunePlay = continuePlayFunc;
     }
 }
Beispiel #6
0
 public void push(Task task)
 {
     if (this.isCompleted_)
     {
         Debug.Log("list task is completed!");
     }
     if (this.begin_ == null && this.end_ == null)
     {
         this.begin_ = task;
         this.end_   = task;
     }
     else
     {
         Task         end       = this.end_;
         TaskShutdown oShutdown = end.shutdown;
         end.shutdown = delegate(){
             oShutdown();
             TaskManager.Run(task);
         };
         other_.Add(this.end_);
         this.end_ = task;
     }
 }
Beispiel #7
0
        public static TaskList AddAnimation(this TaskList list, TweenTask.Maker maker, TaskInit init = null, TaskShutdown shutdown = null)
        {
            var tt = new TweenTask(
                maker
                );

            if (init != null)
            {
                tt.init = init;
            }

            if (shutdown != null)
            {
                tt.shutdown = shutdown;
            }

            list.push(tt);
            return(list);
        }
Beispiel #8
0
 public static TaskWait Create(float time, TaskShutdown shutdown)
 {
     TaskWait wait = new TaskWait (time);
     TaskManager.PushBack (wait, shutdown);
     return wait;
 }
        /// <summary>
        /// Show a job in the panel. If the job is null, the panel will be reset
        /// </summary>
        /// <param name="job">The job to show</param>
        public void setJob(Scheduling.Job job)
        {
            this.job = job;

            if (job == null)
            {
                reset();
                return;
            }

            if (job.status == JobStatus.CREATED)
            {
                elementToDisable.ForEach(element => element.IsEnabled = true);
            }
            else
            {
                elementToDisable.ForEach(element => element.IsEnabled = false);
            }

            label_jobDetailsTitle.Content = "Selected Job";
            textBox_TaskName.Text         = job.name;

            if (job.executeNow)
            {
                jobNowCheckbox.IsChecked    = true;
                jobCyclicCheckbox.IsChecked = false;
                textBox_plannedTrigger.Text = string.Empty;
            }
            else
            {
                jobNowCheckbox.IsChecked    = false;
                jobCyclicCheckbox.IsChecked = job.cyclic;
                textBox_plannedTrigger.Text = job.triggerDescription;
            }

            // Selected computers
            selectedComputersGrid.SelectedItems.Clear();
            foreach (Computer c in selectedComputersGrid.Items)
            {
                foreach (ComputerInfo ci in job.computers)
                {
                    if (ci.name == c.nameLong)
                    {
                        selectedComputersGrid.SelectedItems.Add(c);
                        break;
                    }
                }
            }

            // Tasks
            tasksPanel.Children.Clear();
            foreach (JobTask task in job.tasks)
            {
                dynamic panel = null;

                switch (task.type)
                {
                case JobTaskType.INSTALL_SOFTWARE:
                    panel = new TaskInstall();
                    break;

                case JobTaskType.REBOOT:
                    panel = new TaskReboot();
                    break;

                case JobTaskType.SHUTDOWN:
                    panel = new TaskShutdown();
                    break;

                case JobTaskType.WAKE_ON_LAN:
                    panel = new TaskWakeOnLan();
                    break;
                }

                if (panel != null)
                {
                    panel.initFromTask(task);
                    tasksPanel.Children.Add(panel);
                }
            }

            // Actions accordingly to the status
            switch (job.status)
            {
            case JobStatus.CANCELLED:
            case JobStatus.TERMINATED:
                buttonShowReport.Visibility = Visibility.Visible;
                buttonCancel.Visibility     = Visibility.Collapsed;
                buttonDelete.Visibility     = Visibility.Visible;
                parent.jobReportDetails.setJob(job);
                break;

            case JobStatus.SCHEDULED:
                buttonShowReport.Visibility = Visibility.Visible;
                buttonDelete.Visibility     = Visibility.Collapsed;
                buttonCancel.Visibility     = Visibility.Visible;
                buttonCancel.IsEnabled      = true;
                parent.jobReportDetails.setJob(job);
                break;

            case JobStatus.IN_PROGRESS:
                buttonShowReport.Visibility = Visibility.Visible;
                buttonDelete.Visibility     = Visibility.Collapsed;
                buttonCancel.Visibility     = Visibility.Visible;
                buttonCancel.IsEnabled      = false;
                break;

            case JobStatus.CREATED:
            default:
                buttonShowReport.Visibility = Visibility.Collapsed;
                buttonDelete.Visibility     = Visibility.Collapsed;
                buttonCancel.Visibility     = Visibility.Collapsed;
                break;
            }
            buttonCreateJob.Visibility = Visibility.Collapsed;
        }