private void PageChanged(object sender, AvalonWizard.CurrentPageChangedEventArgs e) { if (AddTicketWizard.CurrentPageIndex == 1 || AddTicketWizard.CurrentPageIndex == 2) { AddTicketWizard.NextButtonContent = "Go to Create Ticket"; AddTicketWizard.BackButtonContent = "Go back to Search Results"; } else if (AddTicketWizard.CurrentPageIndex == 3) { AddTicketWizard.FinishButtonContent = "Create Ticket"; AddTicketWizard.BackButtonContent = "Go Back"; } else { AddTicketWizard.NextButtonContent = "Next"; AddTicketWizard.BackButtonContent = "Back"; } }
private void pStart_Commit(object sender, AvalonWizard.WizardPageConfirmEventArgs e) { if (!File.Exists(tbPathToGameFolder.Text + @"\data\data.txt")) CurrentError = Errors.datatxtnotfound; if (CurrentError != Errors.datatxtnotfound) ParseDatatxt(); else { //go to another page; } }
private void Wizard_Commit(object sender, AvalonWizard.WizardPageConfirmEventArgs e) { switch (e.Page.Name) { case "wzdPage1": Source.Database = ""; Source.RunValidateConnection(); if (!Source.IsValidate) { e.Cancel = true; } else { imgSourceStatus.Visibility = System.Windows.Visibility.Hidden; if (Source.IsRemember) { SavePorperties(Source); } SourceDatabases = LoadDatabases(Source.ConnectionString()); cmbSourceDatabases.ItemsSource = SourceDatabases; cmbSourceDatabases.SelectedIndex = 0; } break; case "wzdPage2": if (ObservTables.Where(t => t.IsChecked == true).Count() < 1) { MessageBox.Show("Please select at least one table."); e.Cancel = true; } break; case "wzdPage3": Destination.Database = ""; Destination.RunValidateConnection(); if (!Destination.IsValidate) { e.Cancel = true; } else { imgDestinationStatus.Visibility = System.Windows.Visibility.Hidden; if (Destination.IsRemember) { SavePorperties(Destination); } if (txtDestinationDatabaseName.Text.Trim() == "") { txtDestinationDatabaseName.Text = Source.Database; } } break; case "wzdPage4": if (String.IsNullOrEmpty(txtDestinationDatabaseName.Text)) { MessageBox.Show("Please input database name for backup"); e.Cancel = true; } else { Destination.Database = txtDestinationDatabaseName.Text; if (String.IsNullOrEmpty(Destination.Database)) { MessageBox.Show("Database name format error!"); e.Cancel = true; } } if ((bool)chkUseDateRange.IsChecked) { if (dpFrom.SelectedDate == null || dpTo.SelectedDate == null) { MessageBox.Show("Please select date range"); e.Cancel = true; } } break; case "wzdPage5": break; } }
// NEXT private void Wizard_Commit(object sender, AvalonWizard.WizardPageConfirmEventArgs e) { switch (e.Page.Name) { case "first": bool source_local_condition = ((cmbSourceSwitcher.SelectedItem as ComboBoxItem).Content.ToString() == "Local"); bool source_remote_condition = ((cmbSourceSwitcher.SelectedItem as ComboBoxItem).Content.ToString() == "Remote") && (!String.IsNullOrEmpty(txtSourceAccount.Text) && !String.IsNullOrEmpty(txtSourceLocation.Text.Trim()) && !String.IsNullOrEmpty(pwdSource.Password.ToString().Trim())); bool source_pass = source_local_condition || source_remote_condition; // add localdb to use. if (txtSourceLocation.Text.Trim().ToLower() == @"(localdb)\v11.0") { source_pass = true; } if (source_pass) { if (DealSourceConnectionString()) { RunValidateConnection(this._source_connstring, "source"); cmbSourceDatabases.ItemsSource = LoadDatabases(this._source_connstring); cmbSourceDatabases.SelectedIndex = 0; lstSourceTables.ItemsSource = _tables; } else { MessageBox.Show("Information Error!!!"); e.Cancel = true; } } else { MessageBox.Show("Information not completed!!!"); e.Cancel = true; } break; case "second": if (_tables.Where(t => t.IsChecked == true).ToList().Count() < 1) { MessageBox.Show("Please choose more than one."); e.Cancel = true; } // check jobs must be selected. if (_tables.Where(t => t.Name == "Jobs" && t.IsChecked == true).ToList().Count() == 0) { MessageBox.Show("Jobs must be select"); e.Cancel = true; } break; case "third": bool target_local_condition = ((cmbTargetSwitcher.SelectedItem as ComboBoxItem).Content.ToString() == "Local"); bool target_remote_condition = ((cmbTargetSwitcher.SelectedItem as ComboBoxItem).Content.ToString() == "Remote") && (!String.IsNullOrEmpty(txtTargetAccount.Text) && !String.IsNullOrEmpty(txtTargetLocation.Text.Trim()) && !String.IsNullOrEmpty(pwdTarget.Password.ToString().Trim())); bool target_pass = target_local_condition || target_remote_condition; // add localdb to use. if (txtTargetLocation.Text.Trim().ToLower() == @"(localdb)\v11.0") { target_pass = true; } if (target_pass) { if (DealTargetConnectionString()) { RunValidateConnection(this._target_connstring, "source"); txtBackupDatabaseName.Text = cmbSourceDatabases.SelectedItem.ToString(); } else { MessageBox.Show("Information Error!!!"); e.Cancel = true; } } else { MessageBox.Show("Information not completed!!!"); e.Cancel = true; } break; case "fourth": if (String.IsNullOrEmpty(txtBackupDatabaseName.Text)) { MessageBox.Show("Please enter database name for backup"); e.Cancel = true; } else { // Fixed issue SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(_target_connstring); builder["Database"] = txtBackupDatabaseName.Text.Trim(); this._target_connstring = builder.ConnectionString; } if ((bool)chkBackupDateRange.IsChecked) { if (dpFrom.SelectedDate != null && dpTo.SelectedDate != null) { this._from = (DateTime)dpFrom.SelectedDate; this._to = (DateTime)dpTo.SelectedDate; } else { MessageBox.Show("Please select date range"); e.Cancel = true; } } break; case "fifth": break; default: break; } }