public WizardForm(IWizardStep step, string t) : base() { currentStep = step; title = t; InitializeComponent(); }
private void FireStepChanged(IWizardStep wizardStep) { if (StepChanged != null) { StepChanged(wizardStep); } }
/// <summary> /// Changes the current step. /// </summary> /// <param name="step">The new current step.</param> /// <param name="forward"><c>true</c> if we're stepping forward in the wizard.</param> public void StepTo(IWizardStep step, bool forward) { try { inStepTo = true; if (current != null && !current.OnStepOut(this, forward)) { return; } current = step; if (step != null) { step.OnStepIn(this); } wizard.OnStep(this, step); } finally { inStepTo = false; if (skipToFinish) { skipToFinish = false; StepTo(LastStep, false); } } }
public SplitDistro(RedistrictingOptions o, IWizardStep p) : base() { prev = p; options = o; InitializeComponent(); }
public StepAdminLevelImport(AdminLevelType type, IWizardStep p, DateTime d, bool isImport) : base() { isSingleImport = isImport; demoDate = d; Init(type, p, true, null); }
private void UpdateButtonEnabling(IWizardStep <IStepView> currentStep) { _view.SetPreviousEnabled(!IsFirstStep()); _view.SetNextEnabled(!IsLastStep()); _view.SetFinishEnabled(IsLastStep()); _view.SetFastForwardEnabled(!IsLastStep() && currentStep.IsValid()); }
public void GoToStep(IWizardStep step) { if (step is Controls.Welcome) { _history.Clear(); } var ctrl = step as Control; if (ctrl == null) { throw new ArgumentException("Each step must be a control."); } var curr = tblMain.GetControlFromPosition(1, 3); if (curr != null) { tblMain.Controls.Remove(curr); } ctrl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; tblMain.Controls.Add(ctrl, 1, 3); this.Message = ""; this.NextLabel = "&Next"; step.Configure(this); btnPrevious.Enabled = _history.Any(); _history.Push(step); }
public void TestHeaderLabelEnabledWhen_WizardStepTextSet() { //---------------Set up test pack------------------- IWizardControllerSpy wizardController = CreateWizardControllerStub(); IWizardControl wizardControl = GetControlFactory().CreateWizardControl(wizardController); SetWizardControlSize(wizardControl); wizardControl.Start(); //--------------Assert PreConditions---------------- Assert.AreEqual("ControlForStep1", wizardControl.CurrentControl.Name); //Assert.IsFalse(wizardControl.HeadingLabel.Visible); //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62, wizardControl.WizardStepPanel.Height); //---------------Execute Test ---------------------- wizardControl.Next(); //---------------Test Result ----------------------- IWizardStep currentStep = wizardController.GetCurrentStep(); Assert.AreEqual("ControlForStep2", wizardControl.CurrentControl.Name); Assert.AreSame(currentStep, wizardControl.CurrentControl); Assert.IsTrue(((IWizardStepStub)currentStep).IsInitialised); //Assert.IsTrue(wizardControl.HeadingLabel.Visible); //Assert.IsTrue(wizardControl.HeadingLabel.Text.Length > 0); //Assert.AreEqual(step.HeaderText, wizardControl.HeadingLabel.Text); //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62 - wizardControl.HeadingLabel.Height, wizardControl.WizardStepPanel.Height); }
public void Test_FinishError() { WizardController wizardController = new WizardController(); IWizardStep step1 = MockRepository.GenerateMock <IWizardStep>(); step1.Stub(wizardStep => wizardStep.CanFinish()).Return(false); wizardController.AddStep(step1); wizardController.AddStep(step1); wizardController.GetFirstStep(); //------------------------Assert Precondition---------------- Assert.AreSame(step1, wizardController.GetCurrentStep()); Assert.IsFalse(wizardController.IsLastStep()); Assert.IsFalse(wizardController.CanFinish(), "Should not be able to finish this"); //------------------------Execute---------------------------- try { wizardController.Finish(); Assert.Fail("Expected to throw an WizardStepException"); } //---------------Test Result ----------------------- catch (WizardStepException ex) { StringAssert.Contains("Invalid call to Finish(), not at last step", ex.Message); } }
public ImportStepResult(ImportResult r, IWizardStep p) : base() { result = r; prev = p; InitializeComponent(); }
public StepLocations(SavedReport o, IWizardStep p) : base() { prev = p; report = o; InitializeComponent(); }
protected void FireStepChanged(IWizardStep wizardStep) { if (StepChanged != null) { StepChanged(wizardStep); } }
private void HookEventHandlers(IWizardStep wizardStep) { wizardStep.Previous += OnWizardStepOnPrevious; wizardStep.Next += OnWizardStepOnNext; wizardStep.Finish += OnWizardStepOnFinish; wizardStep.Cancel += (sender, e) => CancelWizard(); }
/// <summary/> public void Bind(IWizardStep step, bool isFirst, bool isLast) { _stepName.Text = step.StepName; _optionalIndicator.Visible = step.IsOptional; if (step.IsComplete) { _statusImage.Image = Properties.Resources.WizardStepComplete; } else { _statusImage.Image = Properties.Resources.WizardNotComplete; } _lineToNextImage.Image = Properties.Resources.WizardConnectToStep; _lineToPreviousImage.Image = Properties.Resources.WizardConnectToStep; if (isFirst) { _lineToPreviousImage.Visible = false; } if (isLast) { _lineToNextImage.Visible = false; } if (step.IsCurrent) { _stepName.Font = new Font(_stepName.Font, FontStyle.Bold | FontStyle.Underline); } else { _stepName.Font = new Font(_stepName.Font, FontStyle.Regular); } }
public MergeDestination(RedistrictingOptions o, IWizardStep p) : base() { options = o; prev = p; InitializeComponent(); }
public SplittingSaes(RedistrictingOptions o, IWizardStep p) : base() { InitializeComponent(); options = o; prev = p; }
public void StopWizard(string message = null) { if (!enabledJSON.val) { return; } context.diagnostics.Log("Wizard: Stop"); StopCoroutine(_coroutine); _coroutine = null; if (_step != null) { try { _step.Leave(true); } catch (Exception exc) { SuperController.LogError($"Embody: Wizard {_step}.Leave failed: {exc}"); } _step = null; } context.embody.activeJSON.val = false; context.trackers.previewTrackerOffsetJSON.val = false; context.snug.previewSnugOffsetJSON.val = false; statusJSON.val = message ?? _wizardIntroMessage; _next = false; _skip = false; statusChanged.Invoke(false); enabledJSON.val = false; SuperController.singleton.worldScale = 1f; if (_poseJSON != null) { foreach (var storableJSON in _poseJSON.Childs) { var storableId = storableJSON["id"].Value; if (string.IsNullOrEmpty(storableId)) { continue; } var storable = containingAtom.GetStorableByID(storableId); storable.PreRestore(); storable.RestoreFromJSON(storableJSON.AsObject); storable.PostRestore(); } _poseJSON = null; } if (_navigationRigSnapshot != null) { _navigationRigSnapshot.Restore(); _navigationRigSnapshot = null; } }
private void OnControlRemoved(object sender, ControlEventArgs e) { if (e.Control is IWizardStep) { IWizardStep ws = e.Control as IWizardStep; _WizardSteps.Remove(ws); } }
public IndStepResult(IndicatorUpdateResult r, IWizardStep p) : base() { result = r; prev = p; showFinish = result.WasSuccess; InitializeComponent(); }
public ValidationStepResult(ImportResult r, IWizardStep p) : base() { result = r; prev = p; InitializeComponent(); SetStepTitle(r); }
public ImportStepResult(ImportResult r, IWizardStep p, bool f) : base() { showFinish = f; result = r; prev = p; InitializeComponent(); }
/// <summary> /// Constructs an empty list. /// </summary> /// <param name="wizard">The parent wizard form.</param> public WizardStepList(InstallWizard wizard) { this.wizard = wizard; this.list = new ArrayList(); this.current = null; this.skipToFinish = false; this.inStepTo = false; }
/// <summary> /// Adds a <see cref="IWizardStep"/> to the steps maintained by <see cref="WizardModel"/>. /// </summary> /// <param name="step">The <see cref="IWizardStep"/> to add.</param> protected void AddStep(IWizardStep step) { steps.Add(step); if (steps.Count == 1) { CurrentStep = step; } }
public ValidationStepResult(ImportResult r, IWizardStep p, bool f) : base() { showFinish = f; result = r; prev = p; InitializeComponent(); SetStepTitle(r); }
public void AddStep(IWizardStep step) { if (step != null) { step.CanNext += CanNext; } steps.Add(step); StepMax = steps.Count; }
public ImportStepSurveyNameToSentinel(ImportOptions o, IWizardStep prev, string file, Dictionary<string, SurveyUnitsAndSentinelSite> surveyNamesDict) : base() { options = o; previousStep = prev; filename = file; surveyNamesDictionary = surveyNamesDict; InitializeComponent(); }
public UpdateDbResult(bool s, string r, IWizardStep p, Action restart) : base() { result = r; wasSuccessful = s; OnRestart = restart; prev = p; InitializeComponent(); }
public MessageBoxStep(string title, string message, bool error, IWizardStep p) : base() { wasError = error; StepTitle = title; msg = message; prev = p; InitializeComponent(); }
protected void RegisterStep(IWizardStep step) { step.StepIsValidChangedEvent += OnStepIsValidChangedEvent; _registeredStepList.Add(step); OnPropertyChanged("AllRegisteredSteps"); OnPropertyChanged("TotalStepsCount"); OnPropertyChanged("CurrentStep"); OnPropertyChanged("CurrentStepNumber"); }
public StepDdReview(DdUpdateViewModel v, IWizardStep p) : base() { vm = v; prev = p; SettingsRepository settings = new SettingsRepository(); stepTitle = Translations.UpdateDiseaseDistro + " - " + vm.Diseases[vm.DiseaseStepNumber].DisplayName; InitializeComponent(); }
public void TestGetPreviousStep() { IWizardStep step2 = _mock.StrictMock <IWizardStep>(); _wizardController.AddStep(step2); _wizardController.GetNextStep(); _wizardController.GetNextStep(); Assert.AreSame(_step1, _wizardController.GetPreviousStep()); }
private void ChangeStep(IWizardStep currentStep, Predicate <Int32> canChange, StepIndexChanger stepIndexChanger) { if (canChange(_currentStepIndex)) { currentStep.Hide(); _currentStepIndex = stepIndexChanger(_currentStepIndex); _steps[_currentStepIndex].Show(_wizardOwner, currentStep.BlogDescriptor); } }
private void ChangeStep(IWizardStep currentStep, Predicate<Int32> canChange, StepIndexChanger stepIndexChanger) { if (canChange(_currentStepIndex)) { currentStep.Hide(); _currentStepIndex = stepIndexChanger(_currentStepIndex); _steps[_currentStepIndex].Show(_wizardOwner, currentStep.BlogDescriptor); } }
private void LoadWiz(IWizardStep step) { WizardForm wiz = new WizardForm(step, Translations.StartUpTasks); wiz.OnFinish = () => { }; wiz.OnClose = () => { CheckStatus(); }; wiz.ShowDialog(); }
private void WizardLastStep_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "IsComplete") { IWizardStep lastStep = (WizardStep)sender; NewViewState = (ViewState)((CreateViewWizard4)lastStep).GetViewState(); DialogResult = DialogResult.OK; } }
private void WizardControl_StepChanged(IWizardStep obj) { try { this.Text = this.WizardText + " - " + obj.HeaderText; } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error "); } }
/// <summary> /// Returns the Previous Step and sets the step pointer to that step. /// </summary> /// <exception cref="WizardStepException">Thrown if the current step is the first step.</exception> /// <returns>The previous step.</returns> public virtual IWizardStep GetPreviousStep() { if (CurrentStep > 0) { _visitedSteps.Pop(); IWizardStep previousStep = _visitedSteps.Peek(); CurrentStep = WizardSteps.IndexOf(previousStep); return(previousStep); } throw new WizardStepException("Invalid Wizard Step: " + (CurrentStep - 1)); }
public void AddStep(IWizardStep step) { if (step == null) throw new ArgumentNullException("step"); _steps.Add(step); step.Back += WizardStep_Back; step.Cancel += WizardStep_Cancel; step.Finish += WizardStep_Finish; step.Next += WizardStep_Next; }
public ImportStepSurveyNameUnits(ImportOptions o, IWizardStep prev, string file, Dictionary<string, SurveyUnitsAndSentinelSite> surveyNamesDict, int i) : base() { stepTitle = Translations.ChooseAdminLevels + " - " + surveyNamesDict.Keys.ElementAt(i); index = i; surveyNamesDictionary = surveyNamesDict; filename = file; previousStep = prev; options = o; InitializeComponent(); }
public WizardStepContainerViewModel(WizardControlViewModel parent, int step, IWizardStep stepViewModel) { ParentWizard = parent; Step = step; this.stepViewModel = stepViewModel; parent.PropertyChanged += (o, e) => { if (e.PropertyName.Equals("CurrentStep")) { OnPropertyChanged("StepVisible"); } }; }
public DownloadWindow(Wizard wizard) { InitializeComponent(); Commons.CenterWindow(this); _canceled = false; _wizard = wizard; _wizard.ProgressChanged += new Wizard.ProgressHandler(UpdateProgress); _nextStep = null; progressBar.Maximum = 1; progressBar.Minimum = 0; }
private void OnStepSelected(object sender, EventArgs e) { if (sender is IWizardStep) { IWizardStep ws = sender as IWizardStep; if (CurrentStep != ws.StepNumber) { CurrentStep = ws.StepNumber; SignalStep(); } } } //private void OnStepSelected(
protected virtual Label GetStepLabel(IWizardStep step) { Label label = new Label(); label.Location = new System.Drawing.Point(11, 8); label.Name = "lblStepCaption" + step.Name; label.Size = new Size(pnlStepCaptions.Width, (int)((pnlStepCaptions.Height * .75) / _wizardSteps.Count)); label.Text = $"{step.Index + 1}. {step.Name}"; label.TextAlign = ContentAlignment.MiddleLeft; label.ForeColor = Color.Silver; return(label); }
/// <summary> /// Returns the next step in the list (or <c>null</c>). /// </summary> /// <param name="step">The current step.</param> public IWizardStep GetNext(IWizardStep step) { var pos = list.IndexOf(step); if (pos == -1 || pos >= list.Count - 1) { return(null); } else { return((IWizardStep)list[pos + 1]); } }
public void AddStep(IWizardStep step) { if (step == null) { throw new ArgumentNullException("step"); } _steps.Add(step); step.Back += WizardStep_Back; step.Cancel += WizardStep_Cancel; step.Finish += WizardStep_Finish; step.Next += WizardStep_Next; }
/// <summary> /// Returns the previous step in the list (or <c>null</c>). /// </summary> /// <param name="step">The current step.</param> public IWizardStep GetPrev(IWizardStep step) { var pos = list.IndexOf(step); if (pos <= 0) { return(null); } else { return((IWizardStep)list[pos - 1]); } }
private IWizardStep GetNextWizardStep() { for (int i = _CurrentStep + 1; i <= _WizardSteps.Count; i++) { IWizardStep ws = _WizardSteps[i - 1]; if (ws.StepNumber >= _CurrentStep && ws.Enabled) { return(ws); } } return(null); }
private IWizardStep GetPrevWizardStep() { for (int i = _CurrentStep - 1; i > 0; i--) { IWizardStep ws = _WizardSteps[i - 1]; if (ws.Enabled) { return(ws); } } return(null); }
} //private IWizardStep GetWizardStep(int stepNumber) private void SignalStep() { foreach (IWizardBar wb in _ConnectedWizardBars) { wb.CurrentStep = _CurrentStep; } IWizardStep ws = GetWizardStep(_CurrentStep); if (ws != null && OnWizardStep != null) { OnWizardStep(this, new WizardEventArgs(ws.StepNumber, ws.Text)); } }
} //bool IWizardBar.MoveToFirstStep() bool IWizardBar.MoveToNextStep() { IWizardStep ws = GetNextWizardStep(); if (ws != null) { CurrentStep = ws.StepNumber; SignalStep(); return(true); } return(false); }
private void LoadStep(IWizardStep step) { currentStep = step; step.OnSwitchStep = (s) => { LoadStep(s); }; step.OnRunReport = RunReport; step.OnFinish = DoFinish; lblStepTitle.Text = step.StepTitle; btnPrev.Visible = step.ShowPrev; btnPrev.Enabled = step.EnablePrev; btnNext.Visible = step.ShowNext; btnNext.Enabled = step.EnableNext; btnFinish.Visible = step.ShowFinish; btnFinish.Enabled = step.EnableFinish; pnlContent.Controls.Clear(); pnlContent.Controls.Add((Control)step); }
public DeployWizardController(WizardModel model, IDeployWizardView view, IProfileManager profileManager, IEnumerable<IWizardStep<IStepView>> steps, IWizardStep<IStepView> finishStep) { _model = model; _model.ProfileChanged += ChangeTitle; _profileManager = profileManager; _view = view; _steps = steps; _finishStep = finishStep; _view.PreviousClicked += Previous; _view.NextClicked += Next; _view.FastForwardClicked += FastForward; _view.SaveClicked += SaveProfile; _view.FinishClicked += Finish; _view.CloseClicked += Close; ShowCurrentStep(); }
private void Init(AdminLevelType type, IWizardStep step, bool demoOnly, int? cid) { countryDemoId = cid; isDemoOnly = demoOnly; locationType = type; prev = step; SettingsRepository settings = new SettingsRepository(); DemoRepository demo = new DemoRepository(); if (!isDemoOnly) demoDate = demo.GetCountryDemoRecent().DateDemographyData; if (!isSingleImport) { nextType = settings.GetNextLevel(locationType.LevelNumber); stepTitle = isDemoOnly ? Translations.UpdateDemography + " - " + locationType.DisplayName : Translations.ImportAdminLevels + locationType.DisplayName; importer = new AdminLevelDemoImporter(locationType, countryDemoId); } else stepTitle = Translations.Demography + " - " + locationType.DisplayName; updater = new AdminLevelDemoUpdater(locationType, countryDemoId); InitializeComponent(); }
public Wizard AddStep(IWizardStep step) { step.ParentWizard = this; _steps.Add(step); return this; }
public StepDemoCountryDemo(IWizardStep p, DemoUpdateViewModel v) { vm = v; prev = p; InitializeComponent(); }
private void SetStep(IWizardStep step) { if (step == null) throw new ArgumentNullException("step"); IControlHabanero stepControl = step; CurrentControl = stepControl; FireStepChanged(step); _wizardStepPanel.Controls.Clear(); stepControl.Top = WizardControl.PADDING; stepControl.Left = WizardControl.PADDING; stepControl.Width = _wizardStepPanel.Width - WizardControl.PADDING*2; stepControl.Height = _wizardStepPanel.Height - WizardControl.PADDING*2; _wizardStepPanel.Controls.Add(stepControl); step.InitialiseStep(); }
private void UpdateButtonEnabling(IWizardStep<IStepView> currentStep) { _view.SetPreviousEnabled(!IsFirstStep()); _view.SetNextEnabled(!IsLastStep()); _view.SetFinishEnabled(IsLastStep()); _view.SetFastForwardEnabled(!IsLastStep() && currentStep.IsValid()); }
private bool IsLast(IWizardStep step) { return steps.Any() && steps.Last() == step; }