/// <summary> /// Raises the <see cref="Rollback"/> event. /// </summary> /// <returns><c>true</c> if handler does not set the <see cref="WizardPageConfirmEventArgs.Cancel"/> to <c>true</c>; otherwise, <c>false</c>.</returns> protected virtual bool OnRollback() { var e = new WizardPageConfirmEventArgs(this); Rollback?.Invoke(this, e); return(!e.Cancel); }
/// <summary> /// Raises the <see cref="Commit" /> event. /// </summary> /// <returns><c>true</c> if handler does not set the <see cref="WizardPageConfirmEventArgs.Cancel"/> to <c>true</c>; otherwise, <c>false</c>.</returns> protected virtual bool OnCommit() { var e = new WizardPageConfirmEventArgs(this); Commit?.Invoke(this, e); return(!e.Cancel); }
private void WizardPageCommit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { var wp = sender as WizardPage; if (Validation.HasValidationErrors(wp.Controls)) { e.Cancel = true; } }
/// <summary> /// Raises the <see cref="Rollback"/> event. /// </summary> /// <returns><c>true</c> if handler does not set the <see cref="WizardPageConfirmEventArgs.Cancel"/> to <c>true</c>; otherwise, <c>false</c>.</returns> protected virtual bool OnRollback() { EventHandler <WizardPageConfirmEventArgs> handler = Rollback; WizardPageConfirmEventArgs e = new WizardPageConfirmEventArgs(this); if (handler != null) { handler(this, e); } return(!e.Cancel); }
void wizardPage_Commit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { wizardControl.Pages[wizardControl.Pages.Count - 1].Tag = wizardControl.Pages.Count - 1; wizardControl.Pages[wizardControl.Pages.Count - 1].Text = (wizardControl.Pages.Count - 1).ToString(); wizardControl.Pages[wizardControl.Pages.Count - 1].Commit += wizardPage_Commit; WizardPage nextpage = new WizardPage(); wizardControl.Pages.Insert(wizardControl.Pages.Count, nextpage); //wizardControl.RestartPages(); }
void wizardPage_Commit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { // If the user hasn't provided a sufficiently long zip code, don't allow the commit DBMethods db = new DBMethods(); int forms_visit_id = 0; #region Save_results Forms forms = db.GetFormsById(271); forms_visit_id = db.SetFormVisit(forms.Id_Form); FlowLayoutPanel flpanel = (FlowLayoutPanel)e.Page.Controls[FlowPanelName]; RadioButton rb = new RadioButton(); foreach (Control cntrl in flpanel.Controls) { rb = (RadioButton)cntrl; if (rb.Checked == true) { db.SetFormAnsAbo(new Form_Ans_Abo() { Id_Query = ((Form_Ans)rb.Tag).Id_Query, Id_Ans = ((Form_Ans)rb.Tag).Id_Ans, Id_Visit = forms_visit_id }); break; } } #endregion #region GetNext Form_Query form_query = db.GetNextQuery(forms_visit_id, ((Form_Ans)rb.Tag).Id_Query); if (form_query.Num_Query != 0) { e.Page.NextPage = wizardControl.Pages.Find(delegate(WizardPage pg) { return(((Form_Query)pg.Tag).Id_Query == form_query.Id_Query); }); } else { e.Page.NextPage = wizardControl.Pages[wizardControl.Pages.Count - 1]; } #endregion }
/// <summary> /// Raises the <see cref="Rollback"/> event. /// </summary> /// <returns></returns> protected virtual bool OnRollback() { EventHandler<WizardPageConfirmEventArgs> handler = Rollback; WizardPageConfirmEventArgs e = new WizardPageConfirmEventArgs(this); if (handler != null) handler(this, e); return !e.Cancel; }
private void securityPage_Commit(object sender, WizardPageConfirmEventArgs e) { _feedBuilder.SecretKey = comboBoxKeys.SelectedItem as OpenPgpSecretKey; try { _feedBuilder.Uri = (textBoxInterfaceUri.Uri == null) ? null : new FeedUri(textBoxInterfaceUri.Uri); } #region Error handling catch (UriFormatException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } #endregion if (_feedBuilder.SecretKey == null || _feedBuilder.Uri == null) if (!Msg.YesNo(this, Resources.AskSkipSecurity, MsgSeverity.Info)) e.Cancel = true; }
private void installerCaptureDiffPage_Rollback(object sender, WizardPageConfirmEventArgs e) { _installerCapture.CaptureSession = null; }
private void installerAltDownloadPage_Commit(object sender, WizardPageConfirmEventArgs e) { try { Retrieve( new Archive {Href = textBoxAltDownloadUrl.Uri}, checkAltLocalCopy.Checked ? textBoxAltLocalPath.Text : null); installerAltDownloadPage.NextPage = pageArchiveExtract; } #region Error handling catch (OperationCanceledException) { e.Cancel = true; } catch (ArgumentException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (IOException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Error); } catch (WebException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (NotSupportedException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } #endregion }
private void entryPointPage_Commit(object sender, WizardPageConfirmEventArgs e) { _feedBuilder.MainCandidate = listBoxEntryPoint.SelectedItem as Candidate; if (_feedBuilder.MainCandidate == null) { e.Cancel = true; return; } // Command generating is handled differently when capturing an installer if (_installerCapture.CaptureSession == null) _feedBuilder.GenerateCommands(); else _installerCapture.CaptureSession.Finish(); }
private void donePage_Commit(object sender, WizardPageConfirmEventArgs e) { _signedFeed = _feedBuilder.Build(); }
private void pageExistingCryptoKey_Commit(object sender, WizardPageConfirmEventArgs e) { _cryptoKey = textBoxCryptoKey.Text; try { using (var handler = new DialogTaskHandler(this)) handler.RunTask(new SimpleTask(Text, CheckCryptoKey)); } #region Error handling catch (WebException ex) { Log.Warn(ex); Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; } catch (InvalidDataException ex) { Log.Warn(ex); Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; } catch (OperationCanceledException) { e.Cancel = true; } #endregion pageExistingCryptoKey.NextPage = _troubleshooting ? pageChangeCryptoKey : pageSetupFinished; }
private void pageCredentials_Commit(object sender, WizardPageConfirmEventArgs e) { _server.Username = textBoxUsername.Text; _server.Password = textBoxPassword.Text; try { using (var handler = new DialogTaskHandler(this)) handler.RunTask(new SimpleTask(Text, CheckCredentials)); } #region Error handling catch (WebException ex) { Log.Warn(ex); Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; return; } catch (OperationCanceledException) { e.Cancel = true; return; } #endregion pageCredentials.NextPage = _existingAccount ? pageExistingCryptoKey : pageNewCryptoKey; }
private void pageServer_Commit(object sender, WizardPageConfirmEventArgs e) { if (optionOfficalServer.Checked) { _server.Uri = new Uri(Config.DefaultSyncServer); pageServer.NextPage = _existingAccount ? pageCredentials : pageRegister; } else if (optionCustomServer.Checked) { if (textBoxCustomServer.Uri.Scheme != "https") { if (!Msg.YesNo(this, Resources.UnencryptedSyncServer, MsgSeverity.Warn)) { e.Cancel = true; return; } } _server.Uri = textBoxCustomServer.Uri; pageServer.NextPage = pageCredentials; } else if (optionFileShare.Checked) { try { _server.Uri = new Uri(textBoxFileShare.Text); } #region Sanity checks catch (UriFormatException ex) { Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; return; } #endregion _server.Username = null; _server.Password = null; pageServer.NextPage = _existingAccount ? pageExistingCryptoKey : pageNewCryptoKey; } else e.Cancel = true; }
private void archiveExtractPage_Commit(object sender, WizardPageConfirmEventArgs e) { using (var handler = new GuiTaskHandler(this)) { if (FileUtils.IsBreakoutPath(listBoxExtract.Text)) { e.Cancel = true; Msg.Inform(this, Resources.ArchiveBreakoutPath, MsgSeverity.Error); return; } _archive.Extract = listBoxExtract.Text ?? ""; _feedBuilder.ImplementationDirectory = Path.Combine(_feedBuilder.TemporaryDirectory, FileUtils.UnifySlashes(_archive.Extract)); try { // Candidate detection is handled differently when capturing an installer if (_installerCapture.CaptureSession == null) _feedBuilder.DetectCandidates(handler); _feedBuilder.CalculateDigest(handler); } #region Error handling catch (OperationCanceledException) { e.Cancel = true; return; } catch (ArgumentException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } catch (IOException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Error); return; } #endregion } if (_feedBuilder.ManifestDigest.PartialEquals(ManifestDigest.Empty)) { Msg.Inform(this, Resources.EmptyImplementation, MsgSeverity.Warn); e.Cancel = true; } if (_feedBuilder.MainCandidate == null) { Msg.Inform(this, Resources.NoEntryPointsFound, MsgSeverity.Warn); e.Cancel = true; } }
private void detailsPage_Commit(object sender, WizardPageConfirmEventArgs e) { if (string.IsNullOrEmpty(_feedBuilder.MainCandidate.Name) || string.IsNullOrEmpty(_feedBuilder.MainCandidate.Summary) || _feedBuilder.MainCandidate.Version == null) { e.Cancel = true; Msg.Inform(this, labelDetails.Text, MsgSeverity.Warn); } }
private void pageNewCryptoKey_Commit(object sender, WizardPageConfirmEventArgs e) { _cryptoKey = textBoxCryptoKeyNew.Text; }
private void downloadPage_Commit(object sender, WizardPageConfirmEventArgs e) { var fileName = checkLocalCopy.Checked ? textBoxLocalPath.Text : textBoxDownloadUrl.Text; try { if (fileName.EndsWithIgnoreCase(@".exe")) { switch (Msg.YesNoCancel(this, Resources.AskInstallerEXE, MsgSeverity.Info, Resources.YesInstallerExe, Resources.NoSingleExecutable)) { case DialogResult.Yes: OnInstaller(); break; case DialogResult.No: OnSingleFile(); break; default: e.Cancel = true; break; } } else { switch (Archive.GuessMimeType(fileName)) { case Archive.MimeTypeMsi: OnInstaller(); break; case null: OnSingleFile(); break; default: OnArchive(); break; } } } #region Error handling catch (OperationCanceledException) { e.Cancel = true; } catch (ArgumentException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (IOException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Error); } catch (WebException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (NotSupportedException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } #endregion }
private void pageSetupFinished_Commit(object sender, WizardPageConfirmEventArgs e) { if (!SaveConfig()) { e.Cancel = true; return; } Program.RunCommand(SyncApps.Name); }
private void iconPage_Commit(object sender, WizardPageConfirmEventArgs e) { _feedBuilder.Icons.Clear(); try { if (textBoxHrefIco.Uri != null) _feedBuilder.Icons.Add(new Store.Model.Icon {Href = textBoxHrefIco.Uri, MimeType = Store.Model.Icon.MimeTypeIco}); if (textBoxHrefPng.Uri != null) _feedBuilder.Icons.Add(new Store.Model.Icon {Href = textBoxHrefPng.Uri, MimeType = Store.Model.Icon.MimeTypePng}); } #region Error handling catch (UriFormatException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } #endregion if (_feedBuilder.Icons.Count != 2) if (!Msg.YesNo(this, Resources.AskSkipIcon, MsgSeverity.Info)) e.Cancel = true; }
private void pageChangeCryptoKey_Commit(object sender, WizardPageConfirmEventArgs e) { string oldKey = _cryptoKey; string newKey = textBoxCryptoKeyChange.Text; try { using (var sync = CreateSync(oldKey)) sync.Sync(); using (var sync = CreateSync(newKey)) sync.Sync(SyncResetMode.Server); } #region Error handling catch (WebException ex) { Log.Warn(ex); Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; return; } catch (InvalidDataException ex) { Log.Warn(ex); Msg.Inform(this, ex.Message, MsgSeverity.Warn); e.Cancel = true; return; } catch (OperationCanceledException) { e.Cancel = true; return; } #endregion _cryptoKey = newKey; if (_troubleshooting) if (!SaveConfig()) e.Cancel = true; }
private void installerCaptureDiffPage_Commit(object sender, WizardPageConfirmEventArgs e) { var session = _installerCapture.CaptureSession; if (session == null) return; try { session.InstallationDir = textBoxInstallationDir.Text; using (var handler = new GuiTaskHandler(this)) session.Diff(handler); } #region Error handling catch (InvalidOperationException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } catch (IOException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); return; } #endregion try { using (var handler = new GuiTaskHandler(this)) _installerCapture.ExtractInstallerAsArchive(_feedBuilder, handler); pageInstallerCaptureDiff.NextPage = pageArchiveExtract; } catch (IOException) { Msg.Inform(this, Resources.InstallerExtractFailed + Environment.NewLine + Resources.InstallerNeedAltSource, MsgSeverity.Info); pageInstallerCaptureDiff.NextPage = pageInstallerCollectFiles; } #region Error handling catch (OperationCanceledException) { e.Cancel = true; } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Error); } #endregion }
private void pageResetClient_Commit(object sender, WizardPageConfirmEventArgs e) { Program.RunCommand(_machineWide, SyncApps.Name, "--reset=client"); }
private void installerCaptureStartPage_Commit(object sender, WizardPageConfirmEventArgs e) { try { var captureSession = CaptureSession.Start(_feedBuilder); using (var handler = new GuiTaskHandler(this)) _installerCapture.RunInstaller(handler); _installerCapture.CaptureSession = captureSession; } #region Error handling catch (OperationCanceledException) { e.Cancel = true; } catch (IOException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (UnauthorizedAccessException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Warn); } catch (InvalidOperationException ex) { e.Cancel = true; Msg.Inform(this, ex.Message, MsgSeverity.Error); } #endregion }
void i_Commit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { System.Diagnostics.Debug.WriteLine($"--> Page {e.Page.Name} committed."); }
private void PageCommit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { if (e.Page == this.authPage) { if (cmbAuthOption.SelectedIndex == 0) { // Azure AD App-Only if (string.IsNullOrEmpty(txtAuthAzureADId.Text) || string.IsNullOrEmpty(txtAuthAzureADDomainName.Text) || string.IsNullOrEmpty(txtAuthAzureADCert.Text) || string.IsNullOrEmpty(txtAuthAzureADCertPassword.Text)) { MessageBox.Show("Please specify an id, domain, pfx file and pfx file password"); e.Cancel = true; return; } if (!System.IO.File.Exists(txtAuthAzureADCert.Text)) { MessageBox.Show("Please specify an existing CSV file name"); e.Cancel = true; return; } } else if (cmbAuthOption.SelectedIndex == 1) { // Azure ACS App-Only if (string.IsNullOrEmpty(txtAzureACSClientId.Text) || string.IsNullOrEmpty(txtAzureADClientSecret.Text)) { MessageBox.Show("Please specify an id and secret"); e.Cancel = true; return; } } else if (cmbAuthOption.SelectedIndex == 2) { // Username + pwd if (string.IsNullOrEmpty(txtCredentialsUser.Text) || string.IsNullOrEmpty(txtCredentialsPassword.Text)) { MessageBox.Show("Please specify an user id and password"); e.Cancel = true; return; } } else if (cmbAuthOption.SelectedIndex == 3) { // 2FA if (!this.accessTokenObtained) { MessageBox.Show("Please login before continuing"); e.Cancel = true; return; } } } else if (e.Page == this.scopePage) { if (cmbSiteSelectionOption.SelectedIndex == 0) { // tenant if (string.IsNullOrEmpty(txtSitesTenantName.Text)) { MessageBox.Show("Please specify an tenant name"); e.Cancel = true; return; } } else if (cmbSiteSelectionOption.SelectedIndex == 1) { // urls if (lstSitesUrlsToScan.Items.Count == 0) { MessageBox.Show("Please specify at least 1 (wildcard) url"); e.Cancel = true; return; } } else if (cmbSiteSelectionOption.SelectedIndex == 2) { // CSV file if (string.IsNullOrEmpty(txtSitesCSVFile.Text)) { MessageBox.Show("Please specify an CSV file name"); e.Cancel = true; return; } if (!System.IO.File.Exists(txtSitesCSVFile.Text)) { MessageBox.Show("Please specify an existing CSV file name"); e.Cancel = true; return; } } } }
void wizardPage_Commit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { //int forms_visit_id = 0; //FlowLayoutPanel flpanel = (FlowLayoutPanel)e.Page.Controls[FlowPanelName]; //RadioButton rb = new RadioButton(); if (1 != 0) { page_index++; //if ((page_index >= 3) && (page_index % 2 == 1)) // a = true; //if ((page_index >= 4) && (page_index % 2 == 0) && a) //{ // page_index = page_index - 1; // a = false; //} wizardControl.Pages[page_index].Text = page_index.ToString(); wizardControl.Pages[page_index].Commit += wizardPage_Commit; //wizardControl.Pages[page_index].Initialize += wizardPage_Initialize; FlowLayoutPanel flpanel_next = new FlowLayoutPanel(); flpanel_next.FlowDirection = FlowDirection.TopDown; flpanel_next.AutoSize = true; flpanel_next.AutoSizeMode = AutoSizeMode.GrowAndShrink; flpanel_next.WrapContents = true; flpanel_next.Dock = DockStyle.Fill; flpanel_next.Name = FlowPanelName; wizardControl.Pages[page_index].Controls.Add(flpanel_next); for (int i = 0; i < 10; i++) { RadioButton box = new RadioButton(); box.Text = i.ToString(); box.AutoSize = true; box.Dock = System.Windows.Forms.DockStyle.Fill; box.Tag = i; flpanel_next.Controls.Add(box); } wizardControl.Pages[page_index].Controls.Add(flpanel_next); WizardPage page = new WizardPage(); page.Text = page_index.ToString(); wizardControl.Pages.Insert(page_index, page); wizardControl.Pages.Add(wizardControl.Pages[page_index]); //wizardControl.PreviousPage(); //wizardControl.RestartPages(); //wizardControl.NextPage(wizardControl.Pages[page_index]); } else { WizardPage finish_page = new WizardPage(); finish_page.IsFinishPage = true; wizardControl.Pages.Add(finish_page); } }