} // WizardTabControl_Selected protected override void OnSelecting(TabControlCancelEventArgs e) { bool isAllowed; base.OnSelecting(e); if (DesignMode) { return; } if (e.TabPage == null) { return; } isAllowed = (IsPageAllowed.TryGetValue(e.TabPage.Name, out isAllowed)) ? isAllowed : false; e.Cancel = !isAllowed; if (isAllowed) { Action init; if (Initialization.TryGetValue(e.TabPage.Name, out init)) { Initialization.Remove(e.TabPage.Name); init(); BasicGoogleTelemetry.SendScreenHit(this.FindForm(), e.TabPage.Text); } // if } // if } // OnSelecting
} // NextButton_Click public void UpdateWizardButtons() { bool isAllowed; isAllowed = false; if (this.SelectedIndex > 0) { var page = TabPages[this.SelectedIndex - 1]; isAllowed = (IsPageAllowed.TryGetValue(page.Name, out isAllowed)) ? isAllowed : false; } // if PreviousButton.Enabled = isAllowed; isAllowed = false; if ((this.SelectedIndex + 1) < this.TabCount) { var page = TabPages[this.SelectedIndex + 1]; isAllowed = (IsPageAllowed.TryGetValue(page.Name, out isAllowed)) ? isAllowed : false; } // if NextButton.Enabled = isAllowed; } // UpdateWizardButtons