Пример #1
0
        public void SetStepOptions(StepOptions options)
        {
            if (options == null)
            {
                return;
            }

            foreach (var step in Steps)
            {
                step.SetOptions(options);
            }
        }
Пример #2
0
        public FormWizard()
        {
            NeedEncode = NeedMux = NeedReduceBitrate = true;
            InitializeComponent();

            StepPanels.Add(new FormStep1().panelStep1);
            StepPanels.Add(new FormStep2(this).panelStep2);
            StepPanels.Add(new FormStep3(this).panelStep3);
            StepPanels.Add(new FormStep4(this).panelStep4);
            StepPanels.Add(new FormStep5().panelStep5);

            StepOptions.Add(new StepOpt(true, true, true));
            StepOptions.Add(new StepOpt(true, true, false));
            StepOptions.Add(new StepOpt(true, true, false));
            StepOptions.Add(new StepOpt(true, false, false));
            StepOptions.Add(new StepOpt(false, false, true));

            StepShownActions.Add(null);
            StepShownActions.Add(null);
            StepShownActions.Add(null);
            StepShownActions.Add(new Action(() =>
            {
                Thread t = new Thread(() =>
                {
                    bool succ = FormStep4.EncodeFile();
                    if (!succ)
                    {
                        MessageBox.Show("转码失败");
                        this.Invoke(new MethodInvoker(delegate()
                        {
                            this.Close();
                        }));
                    }
                    this.Invoke(new MethodInvoker(delegate()
                    {
                        SwitchToNextStep();
                    }));
                });
                t.Start();
            }));
            StepShownActions.Add(null);

            SwitchToNextStep();
        }
Пример #3
0
 /// <summary>
 /// Forces every step of the process to use the default options.
 /// Don't use this if you have steps with your own options.
 /// </summary>
 /// <returns></returns>
 public ProcessBuilder ForceUseDefaultStepOptions()
 {
     StepOptions = StepOptions.Default;
     return(this);
 }
Пример #4
0
        /// <summary>
        /// Adds a step to the process that executes a request with the given method and data
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="data"></param>
        /// <param name="reference"></param>
        /// <returns>Returns a reference code to the step created</returns>
        public static ProcessBuilder AddStep(this ProcessBuilder builder, string url, HttpMethod method, object data, out Guid reference, StepOptions options = null)
        {
            options = options ?? StepOptions.Default;

            var step = new HttpStep(url, method, data);

            step.SetOptions(options);

            reference = step.Reference;

            builder.Steps.Add(step);

            return(builder);
        }
Пример #5
0
        /// <summary>
        /// Creates a simple HTTP step
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static HttpStep CreateHttpStep(this ProcessBuilder builder, string url, HttpMethod method, object data, StepOptions options = null)
        {
            options = options ?? StepOptions.Default;

            var step = new HttpStep(url, method, data);

            step.SetOptions(options);

            return(step);
        }
Пример #6
0
        /// <summary>
        /// Adds a step to the process that executes a request with a lazy loaded request data
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="lazyData"></param>
        /// <returns></returns>
        public static ProcessBuilder AddStep(this ProcessBuilder builder, string url, HttpMethod method, Func <object> lazyData, StepOptions options = null)
        {
            var reference = Guid.Empty;

            return(builder.AddStep(url, method, lazyData, out reference, options));
        }
Пример #7
0
 public Step(StepOptions mode = StepOptions.Required, params Func <Token, IMatcher, bool>[] functions)
 {
     this.functions = functions;
     this.stepMode  = mode;
 }