From d4eab7e7b8be9148a7821ae03b9d55484874d425 Mon Sep 17 00:00:00 2001 From: Rui Guerra Date: Thu, 20 May 2021 23:08:37 +0100 Subject: [PATCH 1/3] added feature to support single and multiple fileds filtering based on string split (cherry picked from commit 6d91333cf28a56526d0e9d3c9efad7b3efe01f79) --- .../FieldSelectionDialog.Designer.cs | 69 +++++++++++----- src/ParquetFileViewer/FieldSelectionDialog.cs | 78 +++++++++++++++++-- 2 files changed, 122 insertions(+), 25 deletions(-) diff --git a/src/ParquetFileViewer/FieldSelectionDialog.Designer.cs b/src/ParquetFileViewer/FieldSelectionDialog.Designer.cs index a5897a5..5018512 100644 --- a/src/ParquetFileViewer/FieldSelectionDialog.Designer.cs +++ b/src/ParquetFileViewer/FieldSelectionDialog.Designer.cs @@ -32,21 +32,26 @@ private void InitializeComponent() this.allFieldsRadioButton = new System.Windows.Forms.RadioButton(); this.showSelectedFieldsRadioButton = new System.Windows.Forms.RadioButton(); this.fieldsPanel = new System.Windows.Forms.Panel(); - this.doneButton = new System.Windows.Forms.Button(); this.allFieldsRememberRadioButton = new System.Windows.Forms.RadioButton(); + this.doneButton = new System.Windows.Forms.Button(); + this.filterColumnsTextbox = new System.Windows.Forms.TextBox(); + this.clearfilterColumnsButton = new System.Windows.Forms.Button(); this.mainTableLayoutPanel.SuspendLayout(); this.SuspendLayout(); // // mainTableLayoutPanel // - this.mainTableLayoutPanel.ColumnCount = 2; + this.mainTableLayoutPanel.ColumnCount = 3; this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.mainTableLayoutPanel.Controls.Add(this.allFieldsRadioButton, 0, 0); this.mainTableLayoutPanel.Controls.Add(this.showSelectedFieldsRadioButton, 0, 2); - this.mainTableLayoutPanel.Controls.Add(this.fieldsPanel, 1, 3); - this.mainTableLayoutPanel.Controls.Add(this.doneButton, 1, 4); + this.mainTableLayoutPanel.Controls.Add(this.fieldsPanel, 1, 4); this.mainTableLayoutPanel.Controls.Add(this.allFieldsRememberRadioButton, 0, 1); + this.mainTableLayoutPanel.Controls.Add(this.doneButton, 1, 5); + this.mainTableLayoutPanel.Controls.Add(this.filterColumnsTextbox, 1, 3); + this.mainTableLayoutPanel.Controls.Add(this.clearfilterColumnsButton, 2, 3); this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0); this.mainTableLayoutPanel.Name = "mainTableLayoutPanel"; @@ -54,6 +59,7 @@ private void InitializeComponent() this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.mainTableLayoutPanel.Size = new System.Drawing.Size(429, 346); @@ -92,25 +98,14 @@ private void InitializeComponent() // fieldsPanel // this.fieldsPanel.AutoScroll = true; + this.mainTableLayoutPanel.SetColumnSpan(this.fieldsPanel, 2); this.fieldsPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.fieldsPanel.Enabled = false; - this.fieldsPanel.Location = new System.Drawing.Point(23, 93); + this.fieldsPanel.Location = new System.Drawing.Point(23, 121); this.fieldsPanel.Name = "fieldsPanel"; - this.fieldsPanel.Size = new System.Drawing.Size(403, 220); + this.fieldsPanel.Size = new System.Drawing.Size(403, 192); this.fieldsPanel.TabIndex = 2; // - // doneButton - // - this.doneButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.doneButton.Location = new System.Drawing.Point(329, 319); - this.doneButton.Name = "doneButton"; - this.doneButton.Size = new System.Drawing.Size(97, 24); - this.doneButton.TabIndex = 3; - this.doneButton.Text = "Done"; - this.doneButton.UseVisualStyleBackColor = true; - this.doneButton.Click += new System.EventHandler(this.doneButton_Click); - // // allFieldsRememberRadioButton // this.allFieldsRememberRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -125,6 +120,42 @@ private void InitializeComponent() this.allFieldsRememberRadioButton.UseVisualStyleBackColor = true; this.allFieldsRememberRadioButton.CheckedChanged += new System.EventHandler(this.AllFieldsRememberRadioButton_CheckedChanged); // + // doneButton + // + this.doneButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.mainTableLayoutPanel.SetColumnSpan(this.doneButton, 2); + this.doneButton.Location = new System.Drawing.Point(329, 319); + this.doneButton.Name = "doneButton"; + this.doneButton.Size = new System.Drawing.Size(97, 24); + this.doneButton.TabIndex = 3; + this.doneButton.Text = "Done"; + this.doneButton.UseVisualStyleBackColor = true; + this.doneButton.Click += new System.EventHandler(this.doneButton_Click); + // + // filterColumnsTextbox + // + this.filterColumnsTextbox.Enabled = false; + this.filterColumnsTextbox.Location = new System.Drawing.Point(23, 93); + this.filterColumnsTextbox.Name = "filterColumnsTextbox"; + this.filterColumnsTextbox.Size = new System.Drawing.Size(373, 20); + this.filterColumnsTextbox.TabIndex = 0; + this.filterColumnsTextbox.TextChanged += new System.EventHandler(this.filterColumnsTextbox_TextChanged); + // + // clearfilterColumnsButton + // + this.clearfilterColumnsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.clearfilterColumnsButton.Enabled = false; + this.clearfilterColumnsButton.Location = new System.Drawing.Point(402, 93); + this.clearfilterColumnsButton.Name = "clearfilterColumnsButton"; + this.clearfilterColumnsButton.Size = new System.Drawing.Size(24, 22); + this.clearfilterColumnsButton.TabIndex = 4; + this.clearfilterColumnsButton.Text = "X"; + this.clearfilterColumnsButton.TextAlign = System.Drawing.ContentAlignment.TopCenter; + this.clearfilterColumnsButton.UseVisualStyleBackColor = true; + this.clearfilterColumnsButton.Click += new System.EventHandler(this.clearfilterColumnsButton_Click); + // // FieldsToLoadForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -150,5 +181,7 @@ private void InitializeComponent() private System.Windows.Forms.Panel fieldsPanel; private System.Windows.Forms.Button doneButton; private System.Windows.Forms.RadioButton allFieldsRememberRadioButton; + private System.Windows.Forms.TextBox filterColumnsTextbox; + private System.Windows.Forms.Button clearfilterColumnsButton; } } \ No newline at end of file diff --git a/src/ParquetFileViewer/FieldSelectionDialog.cs b/src/ParquetFileViewer/FieldSelectionDialog.cs index a4443b3..580e268 100644 --- a/src/ParquetFileViewer/FieldSelectionDialog.cs +++ b/src/ParquetFileViewer/FieldSelectionDialog.cs @@ -13,9 +13,10 @@ public partial class FieldsToLoadForm : Form private const int DynamicFieldCheckboxYIncrement = 30; public static readonly List UnsupportedSchemaTypes = new List() { SchemaType.List, SchemaType.Map, SchemaType.Struct }; - public IEnumerable PreSelectedFields { get; set; } + public List PreSelectedFields { get; set; } public IEnumerable AvailableFields { get; set; } public List NewSelectedFields { get; set; } + public List PreserveSelectedFields { get; set; } public FieldsToLoadForm() { @@ -29,19 +30,24 @@ public FieldsToLoadForm(IEnumerable availableFields, IEnumerable { InitializeComponent(); this.AvailableFields = availableFields; - this.PreSelectedFields = preSelectedFields ?? new List(); + this.PreSelectedFields = preSelectedFields.ToList() ?? new List(); this.NewSelectedFields = new List(); } private void FieldsToLoadForm_Load(object sender, EventArgs e) { this.CenterToParent(); + this.RenderFieldsCheckboxes(this.AvailableFields, this.PreSelectedFields); + } + + private void RenderFieldsCheckboxes(IEnumerable availableFields, IEnumerable preSelectedFields) + { this.fieldsPanel.SuspendLayout(); //Suspending the layout while dynamically adding controls adds significant performance improvement this.fieldsPanel.Controls.Clear(); try { - if (this.AvailableFields != null) + if (availableFields != null) { int locationX = 0; int locationY = 5; @@ -49,15 +55,15 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) HashSet fieldNames = new HashSet(); bool isClearingSelectAllCheckbox = false; - foreach (Field field in this.AvailableFields) + foreach (Field field in availableFields) { if (isFirst) //Add toggle all checkbox and some other setting changes { isFirst = false; - if (this.PreSelectedFields != null) + if (preSelectedFields != null) { - foreach (string preSelectedField in this.PreSelectedFields) + foreach (string preSelectedField in preSelectedFields) { this.showSelectedFieldsRadioButton.Checked = true; break; @@ -77,6 +83,10 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) selectAllCheckbox.CheckedChanged += (object checkboxSender, EventArgs checkboxEventArgs) => { var selectAllCheckBox = (CheckBox)checkboxSender; + var showFilterControls = !(selectAllCheckBox.Enabled && selectAllCheckBox.Checked && string.IsNullOrWhiteSpace(this.filterColumnsTextbox.Text)); + this.filterColumnsTextbox.Enabled = showFilterControls; + this.clearfilterColumnsButton.Enabled = showFilterControls; + if (!isClearingSelectAllCheckbox) { foreach (Control control in this.fieldsPanel.Controls) @@ -84,7 +94,10 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) if (!control.Tag.Equals(SelectAllCheckboxName) && control is CheckBox checkbox) { if (checkbox.Enabled) + { checkbox.Checked = selectAllCheckBox.Checked; + //this.PreSelectedFields.Remove((string)checkbox.Tag); + } } } } @@ -102,7 +115,7 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) Name = string.Concat("checkbox_", field.Name), Text = string.Concat(field.Name, isUnsupportedFieldType ? "(Unsupported)" : string.Empty), Tag = field.Name, - Checked = this.PreSelectedFields.Contains(field.Name), + Checked = preSelectedFields.Contains(field.Name), Location = new Point(locationX, locationY), AutoSize = true, Enabled = !isUnsupportedFieldType @@ -110,6 +123,17 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) fieldCheckbox.CheckedChanged += (object checkboxSender, EventArgs checkboxEventArgs) => { var fieldCheckBox = (CheckBox)checkboxSender; + + if (fieldCheckBox.Checked) + { + this.PreSelectedFields.Add((string)fieldCheckBox.Tag); + } + else + { + this.PreSelectedFields.Remove((string)fieldCheckBox.Tag); + } + + if (!fieldCheckBox.Checked) { foreach (Control control in this.fieldsPanel.Controls) @@ -120,6 +144,7 @@ private void FieldsToLoadForm_Load(object sender, EventArgs e) { isClearingSelectAllCheckbox = true; checkbox.Checked = false; + this.PreSelectedFields.Remove((string)fieldCheckBox.Tag); isClearingSelectAllCheckbox = false; break; } @@ -150,6 +175,8 @@ private void allFieldsRadioButton_CheckedChanged(object sender, EventArgs e) if (((RadioButton)sender).Checked) { this.fieldsPanel.Enabled = false; + this.filterColumnsTextbox.Enabled = false; + this.clearfilterColumnsButton.Enabled = false; this.allFieldsRememberRadioButton.Checked = false; this.showSelectedFieldsRadioButton.Checked = false; } @@ -160,6 +187,8 @@ private void AllFieldsRememberRadioButton_CheckedChanged(object sender, EventArg if (((RadioButton)sender).Checked) { this.fieldsPanel.Enabled = false; + this.filterColumnsTextbox.Enabled = false; + this.clearfilterColumnsButton.Enabled = false; this.allFieldsRadioButton.Checked = false; this.showSelectedFieldsRadioButton.Checked = false; } @@ -170,6 +199,8 @@ private void showSelectedFieldsRadioButton_CheckedChanged(object sender, EventAr if (((RadioButton)sender).Checked) { this.fieldsPanel.Enabled = true; + this.filterColumnsTextbox.Enabled = true; + this.clearfilterColumnsButton.Enabled = true; this.allFieldsRadioButton.Checked = false; this.allFieldsRememberRadioButton.Checked = false; } @@ -225,5 +256,38 @@ private void ShowError(Exception ex, string customMessage = null, bool showStack { MessageBox.Show(string.Concat(customMessage ?? "Something went wrong:", Environment.NewLine, showStackTrace ? ex.ToString() : ex.Message), ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } + + + private void filterColumnsTextbox_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrWhiteSpace(this.filterColumnsTextbox.Text)) + { + IEnumerable filteredFields; + var filteredColumnsNames = this.filterColumnsTextbox.Text.Split(',').ToList(); + + if (filteredColumnsNames.Count == 1) + { + var filter = filteredColumnsNames[0]; + filteredFields = this.AvailableFields.Where(w => w.Name.Contains(filter)); + } + else + { + char[] charsToTrim = { '"', ' ', '\'' }; + filteredColumnsNames = filteredColumnsNames.Select(s => s.Trim(charsToTrim)).ToList(); + filteredFields = this.AvailableFields.Where(w => filteredColumnsNames.Contains(w.Name)); + } + + this.RenderFieldsCheckboxes(filteredFields, this.PreSelectedFields); + } + else + { + this.RenderFieldsCheckboxes(this.AvailableFields, this.PreSelectedFields); + } + } + + private void clearfilterColumnsButton_Click(object sender, EventArgs e) + { + this.filterColumnsTextbox.Text = string.Empty; + } } } From d510c902b87b9fa6f5f346921a94d13e002538ac Mon Sep 17 00:00:00 2001 From: Sal Date: Fri, 10 Sep 2021 17:39:12 -0400 Subject: [PATCH 2/3] update version no --- src/ParquetFileViewer/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ParquetFileViewer/Properties/AssemblyInfo.cs b/src/ParquetFileViewer/Properties/AssemblyInfo.cs index 5562f79..c2d1bf4 100644 --- a/src/ParquetFileViewer/Properties/AssemblyInfo.cs +++ b/src/ParquetFileViewer/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.3.*")] -[assembly: AssemblyFileVersion("2.3.3.*")] +[assembly: AssemblyVersion("2.3.5.*")] +[assembly: AssemblyFileVersion("2.3.5.*")] From e0fc7c3693c46c84c833cf88942cbb82ff6a8540 Mon Sep 17 00:00:00 2001 From: Sal Date: Fri, 10 Sep 2021 17:57:41 -0400 Subject: [PATCH 3/3] some light maintenance --- src/ParquetFileViewer/AppSettings.cs | 39 ++++++++++++----- src/ParquetFileViewer/FieldSelectionDialog.cs | 12 ++---- src/ParquetFileViewer/MainForm.cs | 43 +++++++------------ 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/src/ParquetFileViewer/AppSettings.cs b/src/ParquetFileViewer/AppSettings.cs index d33b2bc..741182e 100644 --- a/src/ParquetFileViewer/AppSettings.cs +++ b/src/ParquetFileViewer/AppSettings.cs @@ -12,19 +12,30 @@ public static bool UseISODateFormat { get { - using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + try { - bool value = false; - bool.TryParse(registryKey.GetValue(UseISODateFormatKey)?.ToString(), out value); - return value; + using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + { + bool value = false; + bool.TryParse(registryKey.GetValue(UseISODateFormatKey)?.ToString(), out value); + return value; + } + } + catch + { + return false; } } set { - using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + try { - registryKey.SetValue(UseISODateFormatKey, value.ToString()); + using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + { + registryKey.SetValue(UseISODateFormatKey, value.ToString()); + } } + catch { } } } @@ -48,10 +59,14 @@ public static bool AlwaysSelectAllFields } set { - using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + try { - registryKey.SetValue(AlwaysSelectAllFieldsKey, value.ToString()); + using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + { + registryKey.SetValue(AlwaysSelectAllFieldsKey, value.ToString()); + } } + catch { } } } @@ -77,10 +92,14 @@ public static ParquetEngine ReadingEngine } set { - using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + try { - registryKey.SetValue(ParquetReadingEngineKey, value.ToString()); + using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("ParquetViewer")) + { + registryKey.SetValue(ParquetReadingEngineKey, value.ToString()); + } } + catch { } } } } diff --git a/src/ParquetFileViewer/FieldSelectionDialog.cs b/src/ParquetFileViewer/FieldSelectionDialog.cs index 580e268..4c6d879 100644 --- a/src/ParquetFileViewer/FieldSelectionDialog.cs +++ b/src/ParquetFileViewer/FieldSelectionDialog.cs @@ -210,14 +210,10 @@ private void doneButton_Click(object sender, EventArgs e) { try { - try - { - if (this.allFieldsRememberRadioButton.Checked) - AppSettings.AlwaysSelectAllFields = true; - else - AppSettings.AlwaysSelectAllFields = false; - } - catch { /* just in case */ } + if (this.allFieldsRememberRadioButton.Checked) + AppSettings.AlwaysSelectAllFields = true; + else + AppSettings.AlwaysSelectAllFields = false; this.NewSelectedFields.Clear(); if (this.allFieldsRadioButton.Checked || this.allFieldsRememberRadioButton.Checked || ((CheckBox)(this.fieldsPanel.Controls.Find(SelectAllCheckboxName, true)[0])).Checked) diff --git a/src/ParquetFileViewer/MainForm.cs b/src/ParquetFileViewer/MainForm.cs index f9b80de..d380bf7 100644 --- a/src/ParquetFileViewer/MainForm.cs +++ b/src/ParquetFileViewer/MainForm.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; -using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -33,10 +32,7 @@ public partial class MainForm : Form private string openFilePath; private string OpenFilePath { - get - { - return this.openFilePath; - } + get => this.openFilePath; set { this.openFileSchema = null; @@ -69,10 +65,7 @@ private string OpenFilePath private List selectedFields = null; private List SelectedFields { - get - { - return this.selectedFields; - } + get => this.selectedFields; set { this.selectedFields = value; @@ -86,7 +79,7 @@ private List SelectedFields private int currentOffset = DefaultOffset; private int CurrentOffset { - get { return this.currentOffset; } + get => this.currentOffset; set { this.currentOffset = value; @@ -98,7 +91,7 @@ private int CurrentOffset private int currentMaxRowCount = DefaultRowCount; private int CurrentMaxRowCount { - get { return this.currentMaxRowCount; } + get => this.currentMaxRowCount; set { this.currentMaxRowCount = value; @@ -118,7 +111,7 @@ private bool IsAnyFileOpen private DataTable mainDataSource; private DataTable MainDataSource { - get { return this.mainDataSource; } + get => this.mainDataSource; set { this.mainDataSource = value; @@ -173,20 +166,16 @@ private void MainForm_Load(object sender, EventArgs e) this.OpenNewFile(this.fileToLoadOnLaunch); } - try - { - //Setup date format checkboxes - if (AppSettings.UseISODateFormat) - this.iSO8601ToolStripMenuItem.Checked = true; - else - this.defaultToolStripMenuItem.Checked = true; + //Setup date format checkboxes + if (AppSettings.UseISODateFormat) + this.iSO8601ToolStripMenuItem.Checked = true; + else + this.defaultToolStripMenuItem.Checked = true; - if (AppSettings.ReadingEngine == ParquetEngine.Default) - this.defaultParquetEngineToolStripMenuItem.Checked = true; - else if (AppSettings.ReadingEngine == ParquetEngine.Default_Multithreaded) - this.multithreadedParquetEngineToolStripMenuItem.Checked = true; - } - catch { /* just in case */ } + if (AppSettings.ReadingEngine == ParquetEngine.Default) + this.defaultParquetEngineToolStripMenuItem.Checked = true; + else if (AppSettings.ReadingEngine == ParquetEngine.Default_Multithreaded) + this.multithreadedParquetEngineToolStripMenuItem.Checked = true; } #region Event Handlers @@ -694,7 +683,7 @@ private void mainGridView_DataBindingComplete(object sender, DataGridViewBinding { this.actualShownRecordCountLabel.Text = this.mainGridView.RowCount.ToString(); - foreach(DataGridViewColumn column in ((DataGridView)sender).Columns) + foreach (DataGridViewColumn column in ((DataGridView)sender).Columns) { if (column is DataGridViewCheckBoxColumn checkboxColumn) { @@ -969,7 +958,7 @@ private void MetadataViewerToolStripMenuItem_Click(object sender, EventArgs e) metadataViewer.ShowDialog(this); } } - catch(Exception ex) + catch (Exception ex) { this.ShowError(ex); }