private void SelectWizard(WizardControl wizardControl, IDesignerHost host) { if (wizardControl == null) { return; } if (host == null) { return; } while (true) { WizardDesigner designer = (WizardDesigner) host.GetDesigner(wizardControl); if (designer == null) { return; } ISelectionService service = (ISelectionService) host.GetService(typeof (ISelectionService)); if (service == null) { return; } object[] components = new object[] {wizardControl}; service.SetSelectedComponents(components, SelectionTypes.Replace); return; } }
private static bool HitTestCancel(WizardControl control, Point point) { if (!control.CancelButton.Visible) { return(HitTestHelp(control, point)); } Point pt = control.CancelButton.PointToClient(point); Rectangle rect = control.CancelButton.ClientRectangle; if (!rect.Contains(pt)) { return(HitTestHelp(control, point)); } return(true); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { GenericCollection <WizardStep> steps = (GenericCollection <WizardStep>)value; WizardControl owner = (WizardControl)steps.Owner; IDesignerHost container = (IDesignerHost)context.Container; int count = steps.Count; object obj2 = base.EditValue(context, provider, value); if (steps.Count >= count) { return(obj2); } SelectWizard(owner, container); return(obj2); }
///<summary> ///Initializes the designer with the specified component. ///</summary> /// ///<param name="component">The <see cref="T:System.ComponentModel.IComponent"></see> to associate with the designer. </param> public override void Initialize(IComponent component) { base.Initialize(component); AutoResizeHandles = true; ISelectionService service = (ISelectionService)GetService(typeof(ISelectionService)); if (service != null) { service.SelectionChanged += OnSelectionChanged; } WizardControl control = (WizardControl)Control; wizardDesignerActionList = new WizardDesignerActionList(control); actionListCollection.Add(wizardDesignerActionList); control.CurrentStepIndexChanged += CurrentStepIndexChanged; control.WizardSteps.Inserted += RefreshComponent; }
protected internal virtual void RemoveStep() { IDesignerHost service = (IDesignerHost)GetService(typeof(IDesignerHost)); if (WizardControl == null || service == null) { return; } if (MessageBox.Show(WizardControl.FindForm(), "Are you sure you want to remove the step?", "Remove Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { WizardStep step = WizardControl.WizardSteps[WizardControl.CurrentStepIndex]; WizardControl.WizardSteps.Remove(step); service.DestroyComponent(step); step.Dispose(); } SelectWizard(); }
protected void SelectWizard() { WizardControl wizardControl = WizardControl; if (wizardControl == null) { return; } ISelectionService service = (ISelectionService)GetService(typeof(ISelectionService)); if (service == null) { return; } object[] components = new object[] { wizardControl }; service.SetSelectedComponents(components, SelectionTypes.Replace); return; }
private void OnSelectionChanged(object sender, EventArgs e) { ISelectionService service = (ISelectionService)GetService(typeof(ISelectionService)); if (service == null) { return; } isSelected = false; ICollection selectedComponents = service.GetSelectedComponents(); if (selectedComponents == null) { return; } WizardControl control = (WizardControl)Control; IEnumerator enumerator = selectedComponents.GetEnumerator(); if (enumerator == null) { return; } try { while (enumerator.MoveNext()) { object current = enumerator.Current; if (current == control) { isSelected = true; break; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
///<summary> ///Called when a drag-and-drop operation enters the control designer view. ///</summary> /// ///<param name="de">A <see cref="T:System.Windows.Forms.DragEventArgs"></see> that provides data for the event. </param> protected override void OnDragEnter(DragEventArgs de) { WizardControl control = (WizardControl)Control; if (control.WizardSteps.Count <= 0) { base.OnDragEnter(de); return; } WizardStep step = control.WizardSteps[control.CurrentStepIndex]; Point pt = step.PointToClient(new Point(de.X, de.Y)); Rectangle clientRectangle = step.ClientRectangle; if (!clientRectangle.Contains(pt)) { base.OnDragEnter(de); return; } GetWizardStepDesigner(step).OnDragEnterInternal(de); forwardOnDrag = true; }
///<summary> ///Called when a drag-and-drop object is dragged over the control designer view. ///</summary> /// ///<param name="de">A <see cref="T:System.Windows.Forms.DragEventArgs"></see> that provides data for the event. </param> protected override void OnDragOver(DragEventArgs de) { WizardControl control = Control as WizardControl; if (control == null || control.WizardSteps.Count <= 0) { de.Effect = DragDropEffects.None; return; } WizardStep step = control.WizardSteps[control.CurrentStepIndex]; Point pt = step.PointToClient(new Point(de.X, de.Y)); WizardStepDesigner wizardStepDesigner = GetWizardStepDesigner(step); Rectangle clientRectangle = step.ClientRectangle; if (!clientRectangle.Contains(pt)) { if (!forwardOnDrag) { de.Effect = DragDropEffects.None; return; } forwardOnDrag = false; wizardStepDesigner.OnDragLeaveInternal(EventArgs.Empty); base.OnDragEnter(de); return; } else { if (!forwardOnDrag) { base.OnDragLeave(EventArgs.Empty); wizardStepDesigner.OnDragEnterInternal(de); forwardOnDrag = true; return; } wizardStepDesigner.OnDragOverInternal(de); return; } }
protected internal virtual void RemoveAllSteps() { IDesignerHost service = (IDesignerHost)GetService(typeof(IDesignerHost)); if (WizardControl == null || service == null) { return; } if (MessageBox.Show(WizardControl.FindForm(), "Are you sure you want to remove all the steps?", "Remove Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } WizardStep[] array = new WizardStep[WizardControl.WizardSteps.Count]; ((ICollection)WizardControl.WizardSteps).CopyTo(array, 0); WizardControl.WizardSteps.Clear(); WizardStep[] stepArray2 = array; for (int index = 0; index < stepArray2.Length; index++) { WizardStep component = stepArray2[index]; service.DestroyComponent(component); index++; } SelectWizard(); }
private WizardStepDesigner GetDesigner() { WizardControl control = Control as WizardControl; WizardStep component = null; IDesignerHost service = null; WizardStepDesigner designer = null; if (control != null && control.WizardSteps.Count >= 0) { component = control.WizardSteps[control.CurrentStepIndex]; service = (IDesignerHost)GetService(typeof(IDesignerHost)); designer = null; } if (service == null) { return(designer); } if (component == null) { return(designer); } designer = (WizardStepDesigner)service.GetDesigner(component); return(designer); }
public WizardNextButtonClickEventArgs(WizardControl wizardControl) { this.wizardControl = wizardControl; }
internal WizardStepCollection(WizardControl owner) { this.owner = owner; WizardSteps = new List <WizardStep>(); }
private static bool HitTestHelp(WizardControl control, Point point) { if (!control.HelpButton.Visible) { return false; } Point pt = control.HelpButton.PointToClient(point); Rectangle rect = control.HelpButton.ClientRectangle; if (!rect.Contains(pt)) { return false; } return true; }
private static bool HitTestNext(WizardControl control, Point point) { if (!control.NextButton.Visible) { return HitTestCancel(control, point); } Point pt = control.NextButton.PointToClient(point); Rectangle rect = control.NextButton.ClientRectangle; if (!rect.Contains(pt)) { return HitTestCancel(control, point); } return true; }
internal WizardStepCollection(WizardControl owner) { this.owner = owner; WizardSteps = new List<WizardStep>(); }
private void wizardControl_NextButtonClick(WizardControl sender, WizardNextButtonClickEventArgs e) { switch (wizardControl.CurrentStepIndex) { case 0: dataTable = null; break; case 1: if (File.Exists(tbDatapath.Text) && loadDataTable()) { loadInputCombobox(); } else { e.Cancel = true; } break; case 2: loadOutputCombobox(); break; case 3: loadStringCombobox(); break; default: break; } }
private DesignerActionItemCollection AddStepMenu(WizardControl wizardControl) { DesignerActionItemCollection items = new DesignerActionItemCollection(); items.Add(new DesignerActionHeaderItem("Add Steps")); items.Add(new DesignerActionPropertyItem("WizardSteps", "New Wizard Step", "Add Steps")); items.Add(new DesignerActionMethodItem(this, "AddStartStep", "Add Start Step", "Add Steps", true)); items.Add(new DesignerActionMethodItem(this, "AddCustomStep", "Add Custom Step", "Add Steps", true)); items.Add(new DesignerActionMethodItem(this, "AddFinishStep", "Add Finish Step", "Add Steps", true)); if (wizardControl.CurrentStepIndex == -1) { return items; } items.Add(new DesignerActionHeaderItem("Remove Step")); items.Add(new DesignerActionMethodItem(this, "RemoveStep", "Remove Step", "Remove Step", true)); items.Add(new DesignerActionMethodItem(this, "RemoveAllSteps", "Remove All Steps", "Remove Step", true)); if (wizardControl.WizardSteps.Count >= 1) { items.Add(new DesignerActionHeaderItem("Step navigation")); if (wizardControl.CurrentStepIndex > 0) { items.Add(new DesignerActionMethodItem(this, "PreviousStep", "Previous Step", "Step navigation", true)); } if (wizardControl.CurrentStepIndex != (wizardControl.WizardSteps.Count - 1)) { items.Add(new DesignerActionMethodItem(this, "NextStep", "Next Step", "Step navigation", true)); } } items.Add(new DesignerActionHeaderItem("Layout")); items.Add(new DesignerActionPropertyItem("DockStyle", "Dock editor", "Layout")); return items; }
private void setOperationCompleted(ProgressBar prgBar, WizardControl wizard) { if (f_traceSwitch.TraceVerbose) { f_traceHelper.TraceVerbose(string.Format("setOperationCompleted: Entered setOperationCompleted " + "with progress bar '{0}' and wizard instance.", prgBar.Name)); } // only need to check one of the controls.. if (prgBar.InvokeRequired) { if (f_traceSwitch.TraceInfo) { f_traceHelper.TraceInfo(string.Format("setOperationCompleted: Invoke was required on progress bar '{0}', " + "about to invoke delegate.", prgBar.Name)); } updateOnDeploymentComplete delSetCompleted = new updateOnDeploymentComplete(setOperationCompleted); this.Invoke(delSetCompleted, new object[] { prgBar, wizard }); } else { prgBar.Value = prgBar.Maximum; wizardControl1.CancelButtonEnabled = true; lblItemAction.Visible = false; prgBar.Value = 0; btnReturnToStart.Visible = true; lblExportLogFilePathValue.Enabled = true; lblExportPathValue.Enabled = true; lblImportPathValueFinish.Enabled = true; lblImportLogFilePathValueFinish.Enabled = true; if (f_traceSwitch.TraceInfo) { f_traceHelper.TraceInfo(string.Format("setOperationCompleted: Filled progress bar '{0}' " + "and set button state of wizard.", prgBar.Name)); } } if (f_traceSwitch.TraceVerbose) { f_traceHelper.TraceVerbose("setOperationCompleted: Exiting setOperationCompleted."); } }