private void GoToStep(int step) { if (step == 1 && DoesntNeedOptions()) { step++; } BrowserBtns.SetPreviousButtonState(step > 0); if (step >= stepsList.Count) { return; } else if (step >= 2) { // Custom steps #if false List <CustomStep> customSteps = handlerData.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.DataManager = handlerDataManager; } else { BrowserBtns.SetPlayButtonState(true); return; } #endif } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = panel_steps.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; #if false currentStep.Initialize(handlerData, userGame, currentProfile); #endif BrowserBtns.SetNextButtonState(currentStep.CanProceed && step != stepsList.Count - 1); panel_steps.Controls.Add(currentStep); currentStep.Size = panel_steps.Size; // for some reason this line must exist or the PositionsControl get messed up MainForm.Instance.ChangeTitle(currentStep.Title, currentStep.Image); }
/// <summary> /// Adds an additional step to the Custom Steps list dependent on the data from a GameOption /// </summary> /// <param name="optionKey"></param> /// <param name="required"></param> /// <param name="title"></param> /// <returns></returns> public CustomStep ShowOptionAsStep(string optionKey, bool required, string title) { GameOption option = Options.First(c => c.Key == optionKey); option.Hidden = true; CustomStep step = new CustomStep(); step.Option = option; step.Required = required; step.Title = title; CustomSteps.Add(step); return(step); }
private void GoToStep(int step) { btnBack.Enabled = step > 0; if (step >= stepsList.Count) { return; } if (step >= 2) { // Custom steps List <CustomStep> customSteps = currentGame.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.UpdateRequired != null) { customStep.UpdateRequired(); } if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.Content = content; } else { EnablePlay(); return; } } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = StepPanel.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; currentStep.Initialize(currentGameInfo, currentProfile); btn_Next.Enabled = currentStep.CanProceed && step != stepsList.Count - 1; StepPanel.Controls.Add(currentStep); currentStep.Size = StepPanel.Size; // for some reason this line must exist or the PositionsControl get messed up label_StepTitle.Text = currentStep.Title; }
private void GoToStep(int step) { btn_Previous.Enabled = step > 0; if (step >= stepsList.Count) { return; } if (step >= 2) { // Custom steps List <CustomStep> customSteps = handlerData.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.DataManager = handlerDataManager; } else { EnablePlay(); return; } } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = panel_Steps.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; currentStep.Initialize(handlerData, selectedControl.UserGameInfo, currentProfile); btn_Next.Enabled = currentStep.CanProceed && step != stepsList.Count - 1; panel_Steps.Controls.Add(currentStep); currentStep.Size = panel_Steps.Size; // for some reason this line must exist or the PositionsControl get messed up lbl_StepTitle.Text = currentStep.Title; }
private static IEnumerable <CustomStep> GetCustomSteps(RhinoTestCase testCase) { // setup var customSteps = new List <CustomStep>(); // apply foreach (var step in testCase.Steps) { // extract exception if possible var excption = step?.Exception?.InnerException != null ? step.Exception.InnerException : step.Exception; // build custom-step var customStep = new CustomStep { Content = step.Action, Expected = step.Expected }; customStep.StatusId = step.Actual ? 1 : 5; customStep.Actual = string.IsNullOrEmpty($"{excption}") ? step.ReasonPhrase : $"{excption}"; customSteps.Add(customStep); } // get return(customSteps); }