コード例 #1
0
        private void durtion()
        {
            int minutes  = (int)numericMinutes.Value + (int)numericUpDown1.Value;
            var registry = new Registry();

            IJob myjob = new MyJob(this.mainWindow);

            if (radioButton5.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(minutes).Minutes();
            }
            if (radioButton6.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(minutes).Hours();
            }
            if (radioButton4.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(minutes).Seconds();
            }
        }
コード例 #2
0
        private void scheduleButton_Click(object sender, EventArgs e)
        {
            int time1    = (int)numericMinutes.Value;                             //time start to run
            int time2    = (int)numericMinutes.Value + (int)numericUpDown1.Value; //time for duration
            var registry = new Registry();

            IJob myjob = new MyJob(this.mainWindow);//set the job

            if (radioButton1.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(time1).Minutes();
                myLogger.Info("User schedule AMA to run in" + time1 + "minutes");
                if (radioButton5.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Minutes();
                    myLogger.Info("User schedule AMA to run in" + time2 + "minutes");
                }
                if (radioButton6.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Hours();
                    myLogger.Info("User schedule AMA to run in" + time2 + "Hours");
                }
                if (radioButton4.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Seconds();
                    myLogger.Info("User schedule AMA to run in" + time2 + "seconds");
                }
            }
            if (radioButton2.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(time1).Hours();
                myLogger.Info("User schedule AMA to run in" + time1 + "hours");
                if (radioButton5.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Minutes();
                    myLogger.Info("User schedule AMA to run in" + time2 + "minutes");
                }
                if (radioButton6.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Hours();
                    myLogger.Info("User schedule AMA to run in" + time2 + "Hours");
                }
                if (radioButton4.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Seconds();
                    myLogger.Info("User schedule AMA to run in" + time2 + "seconds");
                }
            }
            if (radioButton3.Checked)
            {
                registry.Schedule(myjob).ToRunOnceIn(time1).Seconds();
                myLogger.Info("User schedule AMA to run in" + time1 + "seconds");
                if (radioButton5.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Minutes();
                    myLogger.Info("User schedule AMA to run in" + time2 + "minutes");
                }
                if (radioButton6.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Hours();
                    myLogger.Info("User schedule AMA to run in" + time2 + "Hours");
                }
                if (radioButton4.Checked)
                {
                    registry.Schedule(myjob).ToRunOnceIn(time2).Seconds();
                    myLogger.Info("User schedule AMA to run in" + time2 + "seconds");
                }
            }

            JobManager.Initialize(registry);
        }