예제 #1
0
파일: Step.cs 프로젝트: chungvodim/Razzil
        //public delegate void StepStartHandler();
        //public delegate void StepSuccessHandler();
        //public delegate void StepFailedHandler();

        //public StepStartHandler OnStartStep;
        //public StepSuccessHandler OnStepSuccess;
        //public StepFailedHandler OnStepFailed;
        private Step CreateNextStep()
        {
            using (var db = new Entities())
            {
                if (this.NextStepId != null)
                {
                    int? nextStepType = GetNextStepType(this.NextStepId);
                    if(nextStepType != null)
                    {
                        Step nextStep;
                        switch (nextStepType)
                        {
                            case 1: nextStep = new EnterPageStep(this.NextStepId.Value, this.Context); break;
                            case 2: nextStep = new EnterInputStep(this.NextStepId.Value, this.Context); break;
                            case 3: nextStep = new ClickStep(this.NextStepId.Value, this.Context); break;
                            case 4: nextStep = new MatchingStep(this.NextStepId.Value, this.Context); break;
                            case 5: nextStep = new GetCaptchaStep(this.NextStepId.Value, this.Context); break;
                            case 6: nextStep = new GetOTPStep(this.NextStepId.Value, this.Context); break;
                            default: nextStep = new EnterPageStep(this.NextStepId.Value, this.Context); break;
                        }
                        return nextStep;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
        }
예제 #2
0
        //public delegate void StepStartHandler();
        //public delegate void StepSuccessHandler();
        //public delegate void StepFailedHandler();

        //public StepStartHandler OnStartStep;
        //public StepSuccessHandler OnStepSuccess;
        //public StepFailedHandler OnStepFailed;
        private Step CreateNextStep()
        {
            using (var db = new Entities())
            {
                if (this.NextStepId != null)
                {
                    int?nextStepType = GetNextStepType(this.NextStepId);
                    if (nextStepType != null)
                    {
                        Step nextStep;
                        switch (nextStepType)
                        {
                        case 1: nextStep = new EnterPageStep(this.NextStepId.Value, this.Context); break;

                        case 2: nextStep = new EnterInputStep(this.NextStepId.Value, this.Context); break;

                        case 3: nextStep = new ClickStep(this.NextStepId.Value, this.Context); break;

                        case 4: nextStep = new MatchingStep(this.NextStepId.Value, this.Context); break;

                        case 5: nextStep = new GetCaptchaStep(this.NextStepId.Value, this.Context); break;

                        case 6: nextStep = new GetOTPStep(this.NextStepId.Value, this.Context); break;

                        default: nextStep = new EnterPageStep(this.NextStepId.Value, this.Context); break;
                        }
                        return(nextStep);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
        }