Example #1
0
        /// <summary>
        ///     Creates a JobFormScheduler based on the triggers and constraints specified in
        ///     the view.
        /// </summary>
        /// <param name="view"></param>
        /// <returns></returns>
        internal static JobFormScheduler WithParametersFrom(IJobParametersView view)
        {
            JobFormScheduler jf = new JobFormScheduler
            {
                winEndSeconds         = view.WindowStartSeconds,
                winStartSeconds       = view.WindowStartSeconds,
                initialBackoffSeconds = view.InitialBackoffSeconds,
                maximumBackoffSeconds = view.MaximumBackoffSeconds,
                tag                          = view.JobTag,
                lifeTime                     = view.Persistent ? Lifetime.Forever : Lifetime.UntilNextBoot,
                recurring                    = view.Recurring,
                replaceCurrent               = view.ReplaceCurrent,
                constrainOnAnyNetwork        = view.ConstrainOnAnyNetwork,
                constrainDeviceCharging      = view.ConstrainDeviceCharging,
                constrainOnUnmeteredNewtwork = view.ConstrainOnUnmeteredNetwork,
                useLinearBackoffStrategy     = view.UseLinearBackoffStrategy,
                initialized                  = true
            };

            return(jf);
        }
 void ScheduleButton_Click(object sender, EventArgs e)
 {
     JobFormScheduler.WithParametersFrom(this)
     .SubmitJob <FibonacciCalculatorJob>(this);
     Finish();
 }