Exemplo n.º 1
0
        public ModifyJobModel(JobModel job)
        {
            this.Name = job.Name;
            this.Description = job.Description;
            this.Active = job.Active;
            this.ClassName = job.ClassName;
            this.StartType = job.StartType;

            this.IsSimpleTrigger = job.Trigger.Simple != null;

            this.StartTime = job.Trigger.StartTime;
            this.EndTime = job.Trigger.EndTime;

            if (this.IsSimpleTrigger)
            {
                if (job.Trigger.Simple.RepeatCount == -1)
                {
                    this.RepeatCount = 0;
                    this.RepeatForever = true;
                }
                else
                {
                    this.RepeatCount = job.Trigger.Simple.RepeatCount;
                }

                var interval = job.Trigger.Simple.RepeatInterval / 1000;

                this.IntervalDays = (int)(interval / 86400);
                interval -= this.IntervalDays * 86400;

                this.IntervalHours = (int)(interval / 3600);
                interval -= this.IntervalHours * 3600;

                this.IntervalMinutes = (int)(interval / 60);
                interval -= this.IntervalMinutes * 60;

                this.IntervalSeconds = (int)interval;
            }
            else
            {
                this.CronExpression = job.Trigger.Cron.Expression;
            }
        }
Exemplo n.º 2
0
        private void ViewJob(JobModel parameter)
        {
            var para = new NavigationParameters();
            para.Add("Job", parameter);

            this.NavigationService.RequestNavigate(Consts.ViewNames.JobDetail, para);
        }
Exemplo n.º 3
0
        private void Init()
        {
            this.IsLoading = true;

            var jobList = this.ClientService.JobService.GetJobList();

            this.InvokeOnUIDispatcher(() =>
            {
                foreach (var item in jobList)
                {
                    var job = new JobModel(item);
                    this.JobDataList.Add(job);
                }
            });

            this.IsLoading = false;
        }
Exemplo n.º 4
0
        private void StopJob(JobModel parameter)
        {
            if (this.IsLoading)
            {
                return;
            }

            this.IsLoading = true;

            Task.Factory.StartNew(() =>
            {
                var result = this.ClientService.JobService.StopJob(parameter.ID);
                this.IsLoading = false;
                if (!result.Success)
                {
                    MessageBox.Show(result.Message);
                }
            });
        }
Exemplo n.º 5
0
 private void EditJob(JobModel parameter)
 {
     var para = new NavigationParameters();
     para.Add("Job", parameter);
     this.NavigationService.RequestNavigate(Consts.ViewNames.ModifyJob, para);
 }