private void itemCreatorWizard_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.OldPage == itemDetailsWizardPage) { //if (string.IsNullOrEmpty(itemNameTextBox.Text) || string.IsNullOrEmpty( } }
private void Wizard1WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (Wizard1.SelectedPageIndex == 9) { SaveSettings(); } }
/// <summary> /// Wizard is changing to another page. /// </summary> private void OnWizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if ((e.OldPage == connectionTypePage) && (e.PageChangeSource == eWizardPageChangeSource.NextButton)) { if (cbConnectViaUsb.Checked) { e.NewPage = enableUsbDebuggingPage; } } if (e.NewPage != null) { e.NewPage.BackColor = Color.White; } if (e.NewPage == manufacturerInfoPage) { // Is a manufacturer set? var manufacturer = SelectedManufacturer as ManufacturerInfo; if (manufacturer == null) { // Cancel e.Cancel = true; if (e.PageChangeSource == eWizardPageChangeSource.NextButton) { // Go to "cannot connect" instead wizard.SelectedPage = cannotConnectPage; } else if (e.PageChangeSource == eWizardPageChangeSource.BackButton) { // Go to "select manufacturer" page. wizard.SelectedPage = manufacturerSelectionPage; } } } }
private void wizard_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.OldPage == npcDetailsWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (NameTextBoxX.Text == String.Empty || entryIDIntegerInput.Value == 0 || displayIDIntegerInput.Value == 0) { e.Cancel = true; } } }
private void _wizard_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.PageChangeSource == eWizardPageChangeSource.NextButton) { e.NewPage = GetNextPage(e.OldPage); } else if (e.PageChangeSource == eWizardPageChangeSource.BackButton) { e.NewPage = GetPreviousPage(e.OldPage); } }
private void wpCollectKeyInfo_BeforePageDisplayed(object sender, WizardCancelPageChangeEventArgs e) { if (e.PageChangeSource == eWizardPageChangeSource.NextButton) { //TODO 檢查來源資料中是否所有必要欄位都有了。 //如果沒有包含所有必要欄位,必須回到上一頁。 //Insert 與 Update 的必要欄位不相同。 if (Context.CurrentMode == ImportMode.Insert) { e.NewPage = wpSelectField; } else { e.NewPage = wpCollectKeyInfo; } } }
private void wizard1_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.PageChangeSource == eWizardPageChangeSource.BackButton || e.PageChangeSource == eWizardPageChangeSource.Code) { return; } Page currentPage = GetPageFromWizardPage(e.OldPage); if (currentPage == Page.Finish) { return; } Page newPage = pageTransitions.GetNextPage(currentPage); e.NewPage = GetWizardPageFromPage(newPage); if (onPageLoadActions.ContainsKey(newPage)) { onPageLoadActions[newPage](); } }
private async void wizard1_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (e.OldPage == connectOptionPage) { if (remoteCheckBox.Checked) { e.NewPage = raDetailsPage; } else if (localCheckBox.Checked) { e.NewPage = trinitySFolderPage; } else { MessageBoxEx.Show(this, "You must select one of the options before continuing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } } else if (e.OldPage == trinitySFolderPage) { if (string.IsNullOrEmpty(folderTextBox.Text)) { MessageBoxEx.Show(this, "You must select the folder for TrinityCore", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } else { e.NewPage = mysqlDetailsPage; } } else if (e.OldPage == raDetailsPage) { string host = hostTextBox.Text; int port = portIntegerInput.Value; string username = usernameTextBox.Text; string password = passwordTextBox.Text; if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { MessageBoxEx.Show(this, "You must fill in all of the Remote Access details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } else { e.NewPage = mysqlDetailsPage; } } else if (e.OldPage == mysqlDetailsPage) { string host = mySqlHostTextBox.Text; int port = MySQLIntegerInputX.Value; string username = mySqlUsernameTextBox.Text; string password = mySqlPassTextBox.Text; if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { MessageBoxEx.Show(this, "MySQL details required!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } else { var connStr = new MySqlConnectionStringBuilder(); connStr.Server = host; connStr.Port = (uint)port; connStr.UserID = username; connStr.Password = password; connStr.Database = "mysql"; mySqlConnectionProgressBar.Visible = true; mysqlDetailsPage.NextButtonEnabled = eWizardButtonState.False; e.Cancel = true; bool success = await Task.Run(() => { using (var conn = new MySqlConnection(connStr.ToString())) { try { conn.Open(); conn.Close(); return(true); } catch (Exception) { return(false); } } }); mySqlConnectionProgressBar.Visible = false; if (success) { wizard1.SelectedPage = createDBsPage; } else { MessageBoxEx.Show(this, "Could not connect to MySQL!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } mysqlDetailsPage.NextButtonEnabled = eWizardButtonState.True; } } else if (e.OldPage == dbDetailsPage) { string authDB = authDBTextBox.Text; string charDB = charactersDBTextBox.Text; string worldDB = worldDBTextBox.Text; if (string.IsNullOrEmpty(authDB) || string.IsNullOrEmpty(charDB) || string.IsNullOrEmpty(worldDB)) { MessageBoxEx.Show(this, "Everything must be filled out!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } } } }
private void wizard_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.OldPage == TCMTypeWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { switch (localRemoteComboBoxEX.SelectedIndex) { case 0: e.NewPage = localWizardPage; break; case 1: e.NewPage = raWizardPage; break; } } else if (e.OldPage == raWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (hostTextBoxX.Text != String.Empty && portIntegerInput.Value != 0 && usernameTextBoxX.Text != String.Empty && passwordTextBoxX.Text != String.Empty) { remoteAccess = true; } else { e.Cancel = true; } } else if (e.OldPage == localWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (trinityFolderTextBoxX.Text == String.Empty) { e.Cancel = true; } else { e.NewPage = MySQLWizardPage; } } else if (e.OldPage == MySQLWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLHostTextBoxX.Text != String.Empty && MySQLIntegerInputX.Value != 0 && MySQLUsernameTextBoxX.Text != String.Empty && MySQLPasswordTextBoxX.Text != String.Empty) { host = MySQLHostTextBoxX.Text; port = MySQLIntegerInputX.Value; username = MySQLUsernameTextBoxX.Text; password = MySQLPasswordTextBoxX.Text; MySQLTestConnectionProgressBarX.Visible = true; mysql = new SQLMethods(host, port, username, password); if (mysql != null) { bool MySQLTest = mysql.TestMySQLConnection(); Application.DoEvents(); MySQLTestConnectionProgressBarX.Visible = false; if (MySQLTest) { switch (MySQLNewExistComboBoxEX.SelectedIndex) { case 0: //New Database e.NewPage = setupTCDBWizardPage; break; case 1: //Existing Database e.NewPage = ExistingTCDBWizardPage; break; } } else { e.Cancel = true; TaskDialog.Show(new TaskDialogInfo("Error", eTaskDialogIcon.Stop, "An error has occured!", "Could not connect to MySQL!", eTaskDialogButton.Ok)); } } } else { e.Cancel = true; } } else if ((e.OldPage == localWizardPage || e.OldPage == raWizardPage) && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLHostTextBoxX.Text == String.Empty || portIntegerInput.Value == 0 || MySQLUsernameTextBoxX.Text == String.Empty || MySQLPasswordTextBoxX.Text == String.Empty) { e.Cancel = true; } } else if (e.OldPage == setupTCDBWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (remoteAccess) { e.NewPage = finishedWizardPage; } else { e.NewPage = otherWizardPage; } } else if (e.OldPage == ExistingTCDBWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLAuthDBTextBoxX.Text == String.Empty || MySQLCharDBTextBoxX.Text == String.Empty || MySQLWorldDBTextBoxX.Text == String.Empty) { e.Cancel = true; } else { aDB = MySQLAuthDBTextBoxX.Text; cDB = MySQLCharDBTextBoxX.Text; wDB = MySQLWorldDBTextBoxX.Text; if (remoteAccess) { e.NewPage = finishedWizardPage; } else { e.NewPage = otherWizardPage; } } } if (e.NewPage == setupTCDBWizardPage) { setupTCDBWizardPage.NextButtonEnabled = eWizardButtonState.False; } }