private void SetOptions_OnCommit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { this.AllowNext = true; string SrcFilename = select_source_file.Text; string SrcFileExt = GetFileExt(SrcFilename); string DestFilename = select_dest_file.Text; string DestFileExt = GetFileExt(DestFilename); string SheetName = options_sheet_select_box.Text; try { this.ReadConvert.Init(SrcFilename, SheetName); this.WriteConvert.Init(DestFilename, SheetName); this.ConversionResults = "Conversion started.\r\n"; List <JB64Header> Headers = new List <JB64Header>(); foreach (SetOptionsEntry TempEntry in this.SetOptionsEntries[this.SetOptionsActiveEntry]) { if (TempEntry.Enabled) { Headers.Add(new JB64Header(TempEntry.Name, TempEntry.Type)); } } this.WriteConvert.WriteHeaders(Headers); this.ConversionResults += "Headers successfully written.\r\n"; } catch (Exception ex) { MessageBox.Show("An exception occurred while attempting to initialize the conversion.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error"); this.AllowNext = false; } if (this.AllowNext) { // Save the sheet name if using a dropdown. if (options_sheet_select_box.DropDownStyle == ComboBoxStyle.DropDown) { System.Collections.Specialized.StringCollection TempCollection = new System.Collections.Specialized.StringCollection(); TempCollection.Add(SheetName); if (Properties.Settings.Default.SheetNamesHistory != null) { for (int x = 0; x < Properties.Settings.Default.SheetNamesHistory.Count; x++) { string Name = Properties.Settings.Default.SheetNamesHistory[x]; if (TempCollection.Count < 10 && Name != SheetName) { TempCollection.Add(Name); } } } Properties.Settings.Default.SheetNamesHistory = TempCollection; Properties.Settings.Default.Save(); } ProgressDialog Dlg = new ProgressDialog(this.WriteConvert.GetConversionMessage(), RunConversion); Dlg.ShowDialog(); } if (!this.AllowNext) { e.Cancel = true; } }
private void SetOptions_OnCommit(object sender, AeroWizard.WizardPageConfirmEventArgs e) { this.AllowNext = true; string SrcFilename = select_source_file.Text; string SrcFileExt = GetFileExt(SrcFilename); string DestFilename = select_dest_file.Text; string DestFileExt = GetFileExt(DestFilename); string SheetName = options_sheet_select_box.Text; try { this.ReadConvert.Init(SrcFilename, SheetName); this.WriteConvert.Init(DestFilename, SheetName); this.ConversionResults = "Conversion started.\r\n"; List<JB64Header> Headers = new List<JB64Header>(); foreach (SetOptionsEntry TempEntry in this.SetOptionsEntries[this.SetOptionsActiveEntry]) { if (TempEntry.Enabled) { Headers.Add(new JB64Header(TempEntry.Name, TempEntry.Type)); } } this.WriteConvert.WriteHeaders(Headers); this.ConversionResults += "Headers successfully written.\r\n"; } catch (Exception ex) { MessageBox.Show("An exception occurred while attempting to initialize the conversion.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error"); this.AllowNext = false; } if (this.AllowNext) { // Save the sheet name if using a dropdown. if (options_sheet_select_box.DropDownStyle == ComboBoxStyle.DropDown) { System.Collections.Specialized.StringCollection TempCollection = new System.Collections.Specialized.StringCollection(); TempCollection.Add(SheetName); if (Properties.Settings.Default.SheetNamesHistory != null) { for (int x = 0; x < Properties.Settings.Default.SheetNamesHistory.Count; x++) { string Name = Properties.Settings.Default.SheetNamesHistory[x]; if (TempCollection.Count < 10 && Name != SheetName) { TempCollection.Add(Name); } } } Properties.Settings.Default.SheetNamesHistory = TempCollection; Properties.Settings.Default.Save(); } ProgressDialog Dlg = new ProgressDialog(this.WriteConvert.GetConversionMessage(), RunConversion); Dlg.ShowDialog(); } if (!this.AllowNext) e.Cancel = true; }