From d1879170073acf0f2e4c600b0136b37c1d785dba Mon Sep 17 00:00:00 2001 From: Hirogen Date: Fri, 19 Aug 2022 16:18:42 +0200 Subject: [PATCH 1/3] add setting to prevent error message from opening again --- src/LogExpert/Config/Preferences.cs | 2 + ...llowOnlyOneInstanceErrorDialog.Designer.cs | 96 ++++++++++++++ .../AllowOnlyOneInstanceErrorDialog.cs | 25 ++++ .../AllowOnlyOneInstanceErrorDialog.resx | 123 ++++++++++++++++++ .../Dialogs/SettingsDialog.Designer.cs | 26 +++- src/LogExpert/Dialogs/SettingsDialog.cs | 3 + src/LogExpert/Dialogs/SettingsDialog.resx | 18 --- src/LogExpert/LogExpert.csproj | 9 ++ src/LogExpert/Program.cs | 11 +- 9 files changed, 287 insertions(+), 26 deletions(-) create mode 100644 src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs create mode 100644 src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.cs create mode 100644 src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx diff --git a/src/LogExpert/Config/Preferences.cs b/src/LogExpert/Config/Preferences.cs index 6e4c99b0..a55fba26 100644 --- a/src/LogExpert/Config/Preferences.cs +++ b/src/LogExpert/Config/Preferences.cs @@ -98,6 +98,8 @@ public class Preferences public bool useLegacyReader; + public bool DoNotShowAllowOnlyOneInstances { get; set; } + #endregion } } \ No newline at end of file diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs new file mode 100644 index 00000000..fa52c99f --- /dev/null +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs @@ -0,0 +1,96 @@ + +namespace LogExpert.Dialogs +{ + partial class AllowOnlyOneInstanceErrorDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.checkBoxIgnoreMessage = new System.Windows.Forms.CheckBox(); + this.buttonOk = new System.Windows.Forms.Button(); + this.labelErrorText = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // checkBoxIgnoreMessage + // + this.checkBoxIgnoreMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxIgnoreMessage.AutoSize = true; + this.checkBoxIgnoreMessage.Location = new System.Drawing.Point(13, 88); + this.checkBoxIgnoreMessage.Name = "checkBoxIgnoreMessage"; + this.checkBoxIgnoreMessage.Size = new System.Drawing.Size(253, 24); + this.checkBoxIgnoreMessage.TabIndex = 0; + this.checkBoxIgnoreMessage.Text = "Show this message only once?"; + this.checkBoxIgnoreMessage.UseVisualStyleBackColor = true; + // + // buttonOk + // + this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOk.Location = new System.Drawing.Point(272, 82); + this.buttonOk.Name = "buttonOk"; + this.buttonOk.Size = new System.Drawing.Size(105, 36); + this.buttonOk.TabIndex = 1; + this.buttonOk.Text = "Ok"; + this.buttonOk.UseVisualStyleBackColor = true; + this.buttonOk.Click += new System.EventHandler(this.OnButtonOkClick); + // + // labelErrorText + // + this.labelErrorText.AutoEllipsis = true; + this.labelErrorText.Location = new System.Drawing.Point(13, 13); + this.labelErrorText.Name = "labelErrorText"; + this.labelErrorText.Size = new System.Drawing.Size(367, 66); + this.labelErrorText.TabIndex = 2; + this.labelErrorText.Text = "Only one instance allowed, uncheck \\\"View Settings => Allow only 1 Instances\\\" to" + + " start multiple instances!"; + // + // AllowOnlyOneInstanceErrorDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(392, 130); + this.Controls.Add(this.labelErrorText); + this.Controls.Add(this.buttonOk); + this.Controls.Add(this.checkBoxIgnoreMessage); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "AllowOnlyOneInstanceErrorDialog"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "AllowOnlyOneInstanceErrorDialog"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox checkBoxIgnoreMessage; + private System.Windows.Forms.Button buttonOk; + private System.Windows.Forms.Label labelErrorText; + } +} \ No newline at end of file diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.cs b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.cs new file mode 100644 index 00000000..2c2c29f1 --- /dev/null +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.cs @@ -0,0 +1,25 @@ +using System.Windows.Forms; + +namespace LogExpert.Dialogs +{ + public partial class AllowOnlyOneInstanceErrorDialog : Form + { + public bool DoNotShowThisMessageAgain { get; private set; } + + public AllowOnlyOneInstanceErrorDialog() + { + InitializeComponent(); + SetText(); + } + + private void SetText() + { + labelErrorText.Text = @"Only one instance allowed, uncheck ""View Settings => Allow only 1 Instances"" to start multiple instances!"; + } + + private void OnButtonOkClick(object sender, System.EventArgs e) + { + DoNotShowThisMessageAgain = checkBoxIgnoreMessage.Checked; + } + } +} diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx new file mode 100644 index 00000000..61bc649b --- /dev/null +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file diff --git a/src/LogExpert/Dialogs/SettingsDialog.Designer.cs b/src/LogExpert/Dialogs/SettingsDialog.Designer.cs index d9a8b28f..bc353eea 100644 --- a/src/LogExpert/Dialogs/SettingsDialog.Designer.cs +++ b/src/LogExpert/Dialogs/SettingsDialog.Designer.cs @@ -151,6 +151,7 @@ private void InitializeComponent() this.buttonImport = new System.Windows.Forms.Button(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.checkBoxShowErrorMessageOnlyOneInstance = new System.Windows.Forms.CheckBox(); this.tabControlSettings.SuspendLayout(); this.tabPageViewSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.upDownMaximumFilterEntriesDisplayed)).BeginInit(); @@ -241,7 +242,7 @@ private void InitializeComponent() 0, 0}); this.upDownMaximumFilterEntriesDisplayed.Name = "upDownMaximumFilterEntriesDisplayed"; - this.upDownMaximumFilterEntriesDisplayed.Size = new System.Drawing.Size(80, 26); + this.upDownMaximumFilterEntriesDisplayed.Size = new System.Drawing.Size(106, 26); this.upDownMaximumFilterEntriesDisplayed.TabIndex = 13; this.upDownMaximumFilterEntriesDisplayed.Value = new decimal(new int[] { 20, @@ -269,7 +270,7 @@ private void InitializeComponent() 0, 0}); this.upDownMaximumFilterEntries.Name = "upDownMaximumFilterEntries"; - this.upDownMaximumFilterEntries.Size = new System.Drawing.Size(80, 26); + this.upDownMaximumFilterEntries.Size = new System.Drawing.Size(106, 26); this.upDownMaximumFilterEntries.TabIndex = 11; this.upDownMaximumFilterEntries.Value = new decimal(new int[] { 30, @@ -304,12 +305,13 @@ private void InitializeComponent() this.comboBoxEncoding.Location = new System.Drawing.Point(688, 29); this.comboBoxEncoding.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.comboBoxEncoding.Name = "comboBoxEncoding"; - this.comboBoxEncoding.Size = new System.Drawing.Size(151, 28); + this.comboBoxEncoding.Size = new System.Drawing.Size(177, 28); this.comboBoxEncoding.TabIndex = 8; this.toolTip.SetToolTip(this.comboBoxEncoding, "Encoding to be used when no BOM header and no persistence data is available."); // // groupBoxMisc // + this.groupBoxMisc.Controls.Add(this.checkBoxShowErrorMessageOnlyOneInstance); this.groupBoxMisc.Controls.Add(this.cpDownColumnWidth); this.groupBoxMisc.Controls.Add(this.checkBoxColumnSize); this.groupBoxMisc.Controls.Add(this.buttonTailColor); @@ -321,14 +323,14 @@ private void InitializeComponent() this.groupBoxMisc.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.groupBoxMisc.Name = "groupBoxMisc"; this.groupBoxMisc.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.groupBoxMisc.Size = new System.Drawing.Size(384, 226); + this.groupBoxMisc.Size = new System.Drawing.Size(410, 226); this.groupBoxMisc.TabIndex = 7; this.groupBoxMisc.TabStop = false; this.groupBoxMisc.Text = "Misc"; // // cpDownColumnWidth // - this.cpDownColumnWidth.Location = new System.Drawing.Point(231, 174); + this.cpDownColumnWidth.Location = new System.Drawing.Point(304, 175); this.cpDownColumnWidth.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.cpDownColumnWidth.Maximum = new decimal(new int[] { 9000, @@ -363,7 +365,7 @@ private void InitializeComponent() // // buttonTailColor // - this.buttonTailColor.Location = new System.Drawing.Point(231, 134); + this.buttonTailColor.Location = new System.Drawing.Point(304, 135); this.buttonTailColor.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.buttonTailColor.Name = "buttonTailColor"; this.buttonTailColor.Size = new System.Drawing.Size(84, 32); @@ -1666,6 +1668,17 @@ private void InitializeComponent() this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.Width = 259; // + // checkBoxShowErrorMessageOnlyOneInstance + // + this.checkBoxShowErrorMessageOnlyOneInstance.AutoSize = true; + this.checkBoxShowErrorMessageOnlyOneInstance.Location = new System.Drawing.Point(210, 66); + this.checkBoxShowErrorMessageOnlyOneInstance.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.checkBoxShowErrorMessageOnlyOneInstance.Name = "checkBoxShowErrorMessageOnlyOneInstance"; + this.checkBoxShowErrorMessageOnlyOneInstance.Size = new System.Drawing.Size(192, 24); + this.checkBoxShowErrorMessageOnlyOneInstance.TabIndex = 7; + this.checkBoxShowErrorMessageOnlyOneInstance.Text = "Show Error Message?"; + this.checkBoxShowErrorMessageOnlyOneInstance.UseVisualStyleBackColor = true; + // // SettingsDialog // this.AcceptButton = this.buttonOk; @@ -1867,5 +1880,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBoxAutoPick; private System.Windows.Forms.CheckBox checkBoxPortableMode; private System.Windows.Forms.RadioButton radioButtonSessionApplicationStartupDir; + private System.Windows.Forms.CheckBox checkBoxShowErrorMessageOnlyOneInstance; } } diff --git a/src/LogExpert/Dialogs/SettingsDialog.cs b/src/LogExpert/Dialogs/SettingsDialog.cs index b1f528ae..ce8320e0 100644 --- a/src/LogExpert/Dialogs/SettingsDialog.cs +++ b/src/LogExpert/Dialogs/SettingsDialog.cs @@ -165,6 +165,7 @@ private void FillDialog() checkBoxAskCloseTabs.Checked = Preferences.askForClose; checkBoxColumnFinder.Checked = Preferences.showColumnFinder; checkBoxLegacyReader.Checked = Preferences.useLegacyReader; + checkBoxShowErrorMessageOnlyOneInstance.Checked = Preferences.ShowErrorMessageAllowOnlyOneInstances; } private void FillPortableMode() @@ -659,6 +660,8 @@ private void OnOkButtonClick(object sender, EventArgs e) Preferences.maximumFilterEntries = (int)upDownMaximumFilterEntries.Value; Preferences.maximumFilterEntriesDisplayed = (int)upDownMaximumFilterEntriesDisplayed.Value; + Preferences.ShowErrorMessageAllowOnlyOneInstances = checkBoxShowErrorMessageOnlyOneInstance.Checked; + SavePluginSettings(); SaveHighlightMaskList(); diff --git a/src/LogExpert/Dialogs/SettingsDialog.resx b/src/LogExpert/Dialogs/SettingsDialog.resx index ded11c9a..9426b76c 100644 --- a/src/LogExpert/Dialogs/SettingsDialog.resx +++ b/src/LogExpert/Dialogs/SettingsDialog.resx @@ -120,15 +120,6 @@ 144, 17 - - 144, 17 - - - True - - - True - True @@ -141,21 +132,12 @@ True - - True - - - True - 17, 17 Note: You can always load your logfiles as MultiFile automatically if the files names follow the MultiFile naming rule (<filename>, <filename>.1, <filename>.2, ...). Simply choose 'MultiFile' from the File menu after loading the first file. - - 17, 17 - diff --git a/src/LogExpert/LogExpert.csproj b/src/LogExpert/LogExpert.csproj index fc5aa1f1..56865f31 100644 --- a/src/LogExpert/LogExpert.csproj +++ b/src/LogExpert/LogExpert.csproj @@ -103,6 +103,12 @@ Form + + Form + + + AllowOnlyOneInstanceErrorDialog.cs + Component @@ -356,6 +362,9 @@ + + AllowOnlyOneInstanceErrorDialog.cs + DateTimeDragControl.cs Designer diff --git a/src/LogExpert/Program.cs b/src/LogExpert/Program.cs index 599e5ef7..26fab581 100644 --- a/src/LogExpert/Program.cs +++ b/src/LogExpert/Program.cs @@ -157,9 +157,16 @@ private static void Sub_Main(string[] orgArgs) MessageBox.Show($"Cannot open connection to first instance ({errMsg})", "LogExpert"); } - if (settings.preferences.allowOnlyOneInstance) + if (settings.preferences.allowOnlyOneInstance && settings.preferences.DoNotShowAllowOnlyOneInstances == false) { - MessageBox.Show($"Only one instance allowed, uncheck \"View Settings => Allow only 1 Instances\" to start multiple instances!", "Logexpert"); + AllowOnlyOneInstanceErrorDialog a = new AllowOnlyOneInstanceErrorDialog(); + if (a.ShowDialog() == DialogResult.OK) + { + settings.preferences.DoNotShowAllowOnlyOneInstances = a.DoNotShowThisMessageAgain; + ConfigManager.Save(SettingsFlags.All); + } + + //MessageBox.Show($"Only one instance allowed, uncheck \"View Settings => Allow only 1 Instances\" to start multiple instances!", "Logexpert"); } } From 5df70e9bee058149143adc4c03038481b961752e Mon Sep 17 00:00:00 2001 From: Hirogen Date: Fri, 19 Aug 2022 16:27:00 +0200 Subject: [PATCH 2/3] error message removable --- src/LogExpert/Config/Preferences.cs | 2 +- ...llowOnlyOneInstanceErrorDialog.Designer.cs | 14 ++--- .../AllowOnlyOneInstanceErrorDialog.resx | 3 -- .../Dialogs/SettingsDialog.Designer.cs | 40 +++++++------- src/LogExpert/Dialogs/SettingsDialog.cs | 52 +++++++++---------- src/LogExpert/Program.cs | 4 +- 6 files changed, 56 insertions(+), 59 deletions(-) diff --git a/src/LogExpert/Config/Preferences.cs b/src/LogExpert/Config/Preferences.cs index a55fba26..d425c565 100644 --- a/src/LogExpert/Config/Preferences.cs +++ b/src/LogExpert/Config/Preferences.cs @@ -98,7 +98,7 @@ public class Preferences public bool useLegacyReader; - public bool DoNotShowAllowOnlyOneInstances { get; set; } + public bool ShowErrorMessageAllowOnlyOneInstances { get; set; } #endregion } diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs index fa52c99f..0acc186b 100644 --- a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs @@ -41,9 +41,9 @@ private void InitializeComponent() this.checkBoxIgnoreMessage.AutoSize = true; this.checkBoxIgnoreMessage.Location = new System.Drawing.Point(13, 88); this.checkBoxIgnoreMessage.Name = "checkBoxIgnoreMessage"; - this.checkBoxIgnoreMessage.Size = new System.Drawing.Size(253, 24); + this.checkBoxIgnoreMessage.Size = new System.Drawing.Size(257, 24); this.checkBoxIgnoreMessage.TabIndex = 0; - this.checkBoxIgnoreMessage.Text = "Show this message only once?"; + this.checkBoxIgnoreMessage.Text = "Show this message only once\\?"; this.checkBoxIgnoreMessage.UseVisualStyleBackColor = true; // // buttonOk @@ -51,9 +51,9 @@ private void InitializeComponent() this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOk.Location = new System.Drawing.Point(272, 82); + this.buttonOk.Location = new System.Drawing.Point(313, 82); this.buttonOk.Name = "buttonOk"; - this.buttonOk.Size = new System.Drawing.Size(105, 36); + this.buttonOk.Size = new System.Drawing.Size(104, 36); this.buttonOk.TabIndex = 1; this.buttonOk.Text = "Ok"; this.buttonOk.UseVisualStyleBackColor = true; @@ -64,7 +64,7 @@ private void InitializeComponent() this.labelErrorText.AutoEllipsis = true; this.labelErrorText.Location = new System.Drawing.Point(13, 13); this.labelErrorText.Name = "labelErrorText"; - this.labelErrorText.Size = new System.Drawing.Size(367, 66); + this.labelErrorText.Size = new System.Drawing.Size(404, 66); this.labelErrorText.TabIndex = 2; this.labelErrorText.Text = "Only one instance allowed, uncheck \\\"View Settings => Allow only 1 Instances\\\" to" + " start multiple instances!"; @@ -73,11 +73,11 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(392, 130); + this.ClientSize = new System.Drawing.Size(432, 130); this.Controls.Add(this.labelErrorText); this.Controls.Add(this.buttonOk); this.Controls.Add(this.checkBoxIgnoreMessage); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.Name = "AllowOnlyOneInstanceErrorDialog"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx index 61bc649b..1af7de15 100644 --- a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - \ No newline at end of file diff --git a/src/LogExpert/Dialogs/SettingsDialog.Designer.cs b/src/LogExpert/Dialogs/SettingsDialog.Designer.cs index bc353eea..b0c51df4 100644 --- a/src/LogExpert/Dialogs/SettingsDialog.Designer.cs +++ b/src/LogExpert/Dialogs/SettingsDialog.Designer.cs @@ -361,7 +361,7 @@ private void InitializeComponent() this.checkBoxColumnSize.TabIndex = 5; this.checkBoxColumnSize.Text = "Set last column width"; this.checkBoxColumnSize.UseVisualStyleBackColor = true; - this.checkBoxColumnSize.CheckedChanged += new System.EventHandler(this.columnSizeCheckBox_CheckedChanged); + this.checkBoxColumnSize.CheckedChanged += new System.EventHandler(this.OnColumnSizeCheckBoxCheckedChanged); // // buttonTailColor // @@ -372,7 +372,7 @@ private void InitializeComponent() this.buttonTailColor.TabIndex = 4; this.buttonTailColor.Text = "Color..."; this.buttonTailColor.UseVisualStyleBackColor = true; - this.buttonTailColor.Click += new System.EventHandler(this.tailColorButton_Click); + this.buttonTailColor.Click += new System.EventHandler(this.OnTailColorButtonClick); // // checkBoxTailState // @@ -499,7 +499,7 @@ private void InitializeComponent() this.buttonChangeFont.TabIndex = 1; this.buttonChangeFont.Text = "Change..."; this.buttonChangeFont.UseVisualStyleBackColor = true; - this.buttonChangeFont.Click += new System.EventHandler(this.changeFontButton_Click); + this.buttonChangeFont.Click += new System.EventHandler(this.OnChangeFontButtonClick); // // labelFont // @@ -596,7 +596,7 @@ private void InitializeComponent() this.buttonTimespreadColor.TabIndex = 7; this.buttonTimespreadColor.Text = "Color..."; this.buttonTimespreadColor.UseVisualStyleBackColor = true; - this.buttonTimespreadColor.Click += new System.EventHandler(this.timespreadColorButton_Click); + this.buttonTimespreadColor.Click += new System.EventHandler(this.OnTimespreadColorButtonClick); // // checkBoxTimeSpread // @@ -720,7 +720,7 @@ private void InitializeComponent() this.buttonToolDelete.TabIndex = 2; this.buttonToolDelete.Text = "Remove"; this.buttonToolDelete.UseVisualStyleBackColor = true; - this.buttonToolDelete.Click += new System.EventHandler(this.toolDeleteButton_Click); + this.buttonToolDelete.Click += new System.EventHandler(this.OnToolDeleteButtonClick); // // buttonToolAdd // @@ -731,7 +731,7 @@ private void InitializeComponent() this.buttonToolAdd.TabIndex = 1; this.buttonToolAdd.Text = "Add new"; this.buttonToolAdd.UseVisualStyleBackColor = true; - this.buttonToolAdd.Click += new System.EventHandler(this.toolAddButton_Click); + this.buttonToolAdd.Click += new System.EventHandler(this.OnToolAddButtonClick); // // buttonToolDown // @@ -742,7 +742,7 @@ private void InitializeComponent() this.buttonToolDown.TabIndex = 4; this.buttonToolDown.Text = "Down"; this.buttonToolDown.UseVisualStyleBackColor = true; - this.buttonToolDown.Click += new System.EventHandler(this.toolDownButton_Click); + this.buttonToolDown.Click += new System.EventHandler(this.OnToolDownButtonClick); // // buttonToolUp // @@ -753,7 +753,7 @@ private void InitializeComponent() this.buttonToolUp.TabIndex = 3; this.buttonToolUp.Text = "Up"; this.buttonToolUp.UseVisualStyleBackColor = true; - this.buttonToolUp.Click += new System.EventHandler(this.toolUpButton_Click); + this.buttonToolUp.Click += new System.EventHandler(this.OnToolUpButtonClick); // // listBoxTools // @@ -763,7 +763,7 @@ private void InitializeComponent() this.listBoxTools.Name = "listBoxTools"; this.listBoxTools.Size = new System.Drawing.Size(406, 165); this.listBoxTools.TabIndex = 0; - this.listBoxTools.SelectedIndexChanged += new System.EventHandler(this.toolListBox_SelectedIndexChanged); + this.listBoxTools.SelectedIndexChanged += new System.EventHandler(this.OnToolListBoxSelectedIndexChanged); // // groupBoxToolSettings // @@ -831,7 +831,7 @@ private void InitializeComponent() this.buttonIcon.Text = " Icon..."; this.buttonIcon.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.buttonIcon.UseVisualStyleBackColor = true; - this.buttonIcon.Click += new System.EventHandler(this.iconButton_Click); + this.buttonIcon.Click += new System.EventHandler(this.OnIconButtonClick); // // labelToolName // @@ -880,7 +880,7 @@ private void InitializeComponent() this.checkBoxSysout.TabIndex = 6; this.checkBoxSysout.Text = "Pipe sysout to tab"; this.checkBoxSysout.UseVisualStyleBackColor = true; - this.checkBoxSysout.CheckedChanged += new System.EventHandler(this.sysoutCheckBoxA_CheckedChanged); + this.checkBoxSysout.CheckedChanged += new System.EventHandler(this.OnSysoutCheckBoxACheckedChanged); // // buttonArguments // @@ -891,7 +891,7 @@ private void InitializeComponent() this.buttonArguments.TabIndex = 5; this.buttonArguments.Text = "..."; this.buttonArguments.UseVisualStyleBackColor = true; - this.buttonArguments.Click += new System.EventHandler(this.argButtonA_Click); + this.buttonArguments.Click += new System.EventHandler(this.OnArgButtonAClick); // // labelTool // @@ -912,7 +912,7 @@ private void InitializeComponent() this.buttonTool.TabIndex = 3; this.buttonTool.Text = "..."; this.buttonTool.UseVisualStyleBackColor = true; - this.buttonTool.Click += new System.EventHandler(this.toolButtonA_Click); + this.buttonTool.Click += new System.EventHandler(this.OnToolButtonAClick); // // textBoxTool // @@ -988,7 +988,7 @@ private void InitializeComponent() this.buttonDelete.TabIndex = 3; this.buttonDelete.Text = "Delete"; this.buttonDelete.UseVisualStyleBackColor = true; - this.buttonDelete.Click += new System.EventHandler(this.deleteButton_Click); + this.buttonDelete.Click += new System.EventHandler(this.OnDeleteButtonClick); // // dataGridViewColumnizer // @@ -1007,7 +1007,7 @@ private void InitializeComponent() this.dataGridViewColumnizer.RowHeadersWidth = 62; this.dataGridViewColumnizer.Size = new System.Drawing.Size(934, 365); this.dataGridViewColumnizer.TabIndex = 2; - this.dataGridViewColumnizer.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.columnizerDataGridView_RowsAdded); + this.dataGridViewColumnizer.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.OnColumnizerDataGridViewRowsAdded); // // columnFileMask // @@ -1249,7 +1249,7 @@ private void InitializeComponent() this.listBoxPlugin.Size = new System.Drawing.Size(322, 344); this.listBoxPlugin.TabIndex = 0; this.listBoxPlugin.ValueMember = "Text"; - this.listBoxPlugin.SelectedIndexChanged += new System.EventHandler(this.pluginListBox_SelectedIndexChanged); + this.listBoxPlugin.SelectedIndexChanged += new System.EventHandler(this.OnPluginListBoxSelectedIndexChanged); // // groupBoxSettings // @@ -1288,7 +1288,7 @@ private void InitializeComponent() this.buttonConfigPlugin.TabIndex = 0; this.buttonConfigPlugin.Text = "Configure..."; this.buttonConfigPlugin.UseVisualStyleBackColor = true; - this.buttonConfigPlugin.Click += new System.EventHandler(this.configPluginButton_Click); + this.buttonConfigPlugin.Click += new System.EventHandler(this.OnConfigPluginButtonClick); // // tabPageSessions // @@ -1365,7 +1365,7 @@ private void InitializeComponent() this.buttonSessionSaveDir.TabIndex = 3; this.buttonSessionSaveDir.Text = "..."; this.buttonSessionSaveDir.UseVisualStyleBackColor = true; - this.buttonSessionSaveDir.Click += new System.EventHandler(this.sessionSaveDirButton_Click); + this.buttonSessionSaveDir.Click += new System.EventHandler(this.OnSessionSaveDirButtonClick); // // radioButtonSessionSaveOwn // @@ -1569,7 +1569,7 @@ private void InitializeComponent() 0, 0, 0}); - this.upDownLinesPerBlock.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + this.upDownLinesPerBlock.ValueChanged += new System.EventHandler(this.OnNumericUpDown1ValueChanged); // // upDownBlockCount // @@ -1702,7 +1702,7 @@ private void InitializeComponent() this.helpProvider.SetShowHelp(this, true); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Settings"; - this.Load += new System.EventHandler(this.SettingsDialog_Load); + this.Load += new System.EventHandler(this.OnSettingsDialogLoad); this.tabControlSettings.ResumeLayout(false); this.tabPageViewSettings.ResumeLayout(false); this.tabPageViewSettings.PerformLayout(); diff --git a/src/LogExpert/Dialogs/SettingsDialog.cs b/src/LogExpert/Dialogs/SettingsDialog.cs index ce8320e0..3dd13317 100644 --- a/src/LogExpert/Dialogs/SettingsDialog.cs +++ b/src/LogExpert/Dialogs/SettingsDialog.cs @@ -149,7 +149,7 @@ private void FillDialog() upDownPollingInterval.Value = Preferences.pollingInterval; checkBoxMultiThread.Checked = Preferences.multiThreadFilter; - dataGridViewColumnizer.DataError += columnizerDataGridView_DataError; + dataGridViewColumnizer.DataError += OnColumnizerDataGridViewDataError; FillColumnizerList(); FillPluginList(); @@ -219,7 +219,7 @@ private void OnToolButtonClick(TextBox textBox) } } - private void ArgsButtonClick(TextBox textBox) + private void OnArgsButtonClick(TextBox textBox) { ToolArgsDialog dlg = new ToolArgsDialog(_logTabWin, this); dlg.Arg = textBox.Text; @@ -229,7 +229,7 @@ private void ArgsButtonClick(TextBox textBox) } } - private void WorkingDirButtonClick(TextBox textBox) + private void OnWorkingDirButtonClick(TextBox textBox) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.RootFolder = Environment.SpecialFolder.MyComputer; @@ -573,12 +573,12 @@ private void FillEncodingList() #region Events handler - private void SettingsDialog_Load(object sender, EventArgs e) + private void OnSettingsDialogLoad(object sender, EventArgs e) { FillDialog(); } - private void changeFontButton_Click(object sender, EventArgs e) + private void OnChangeFontButtonClick(object sender, EventArgs e) { FontDialog dlg = new FontDialog(); dlg.ShowEffects = false; @@ -669,18 +669,18 @@ private void OnOkButtonClick(object sender, EventArgs e) SaveMultifileData(); } - private void toolButtonA_Click(object sender, EventArgs e) + private void OnToolButtonAClick(object sender, EventArgs e) { OnToolButtonClick(textBoxTool); } - private void argButtonA_Click(object sender, EventArgs e) + private void OnArgButtonAClick(object sender, EventArgs e) { - ArgsButtonClick(textBoxArguments); + OnArgsButtonClick(textBoxArguments); } //TODO Remove or refactor this function - private void columnizerDataGridView_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) + private void OnColumnizerDataGridViewRowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { DataGridViewComboBoxCell comboCell = (DataGridViewComboBoxCell) dataGridViewColumnizer.Rows[e.RowIndex].Cells[1]; if (comboCell.Items.Count > 0) @@ -689,7 +689,7 @@ private void columnizerDataGridView_RowsAdded(object sender, DataGridViewRowsAdd } } - private void deleteButton_Click(object sender, EventArgs e) + private void OnDeleteButtonClick(object sender, EventArgs e) { if (dataGridViewColumnizer.CurrentRow != null && !dataGridViewColumnizer.CurrentRow.IsNewRow) { @@ -699,17 +699,17 @@ private void deleteButton_Click(object sender, EventArgs e) } } - private void columnizerDataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e) + private void OnColumnizerDataGridViewDataError(object sender, DataGridViewDataErrorEventArgs e) { e.Cancel = true; } - private void sysoutCheckBoxA_CheckedChanged(object sender, EventArgs e) + private void OnSysoutCheckBoxACheckedChanged(object sender, EventArgs e) { comboBoxColumnizer.Enabled = checkBoxSysout.Checked; } - private void tailColorButton_Click(object sender, EventArgs e) + private void OnTailColorButtonClick(object sender, EventArgs e) { ColorDialog dlg = new ColorDialog(); dlg.Color = Preferences.showTailColor; @@ -720,12 +720,12 @@ private void tailColorButton_Click(object sender, EventArgs e) } } - private void columnSizeCheckBox_CheckedChanged(object sender, EventArgs e) + private void OnColumnSizeCheckBoxCheckedChanged(object sender, EventArgs e) { cpDownColumnWidth.Enabled = checkBoxColumnSize.Checked; } - private void timespreadColorButton_Click(object sender, EventArgs e) + private void OnTimespreadColorButtonClick(object sender, EventArgs e) { ColorDialog dlg = new ColorDialog(); dlg.Color = Preferences.timeSpreadColor; @@ -736,7 +736,7 @@ private void timespreadColorButton_Click(object sender, EventArgs e) } } - private void pluginListBox_SelectedIndexChanged(object sender, EventArgs e) + private void OnPluginListBoxSelectedIndexChanged(object sender, EventArgs e) { _selectedPlugin?.HideConfigForm(); @@ -768,7 +768,7 @@ private void pluginListBox_SelectedIndexChanged(object sender, EventArgs e) } } - private void sessionSaveDirButton_Click(object sender, EventArgs e) + private void OnSessionSaveDirButtonClick(object sender, EventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); @@ -833,7 +833,7 @@ private void OnPortableModeCheckedChanged(object sender, EventArgs e) } - private void configPluginButton_Click(object sender, EventArgs e) + private void OnConfigPluginButtonClick(object sender, EventArgs e) { if (!_selectedPlugin.HasEmbeddedForm()) { @@ -841,12 +841,12 @@ private void configPluginButton_Click(object sender, EventArgs e) } } - private void numericUpDown1_ValueChanged(object sender, EventArgs e) + private void OnNumericUpDown1ValueChanged(object sender, EventArgs e) { //TODO implement } - private void toolListBox_SelectedIndexChanged(object sender, EventArgs e) + private void OnToolListBoxSelectedIndexChanged(object sender, EventArgs e) { GetCurrentToolValues(); _selectedTool = listBoxTools.SelectedItem as ToolEntry; @@ -856,7 +856,7 @@ private void toolListBox_SelectedIndexChanged(object sender, EventArgs e) DisplayCurrentIcon(); } - private void toolUpButton_Click(object sender, EventArgs e) + private void OnToolUpButtonClick(object sender, EventArgs e) { int i = listBoxTools.SelectedIndex; @@ -872,7 +872,7 @@ private void toolUpButton_Click(object sender, EventArgs e) } } - private void toolDownButton_Click(object sender, EventArgs e) + private void OnToolDownButtonClick(object sender, EventArgs e) { int i = listBoxTools.SelectedIndex; @@ -888,13 +888,13 @@ private void toolDownButton_Click(object sender, EventArgs e) } } - private void toolAddButton_Click(object sender, EventArgs e) + private void OnToolAddButtonClick(object sender, EventArgs e) { listBoxTools.Items.Add(new ToolEntry()); listBoxTools.SelectedIndex = listBoxTools.Items.Count - 1; } - private void toolDeleteButton_Click(object sender, EventArgs e) + private void OnToolDeleteButtonClick(object sender, EventArgs e) { int i = listBoxTools.SelectedIndex; @@ -915,7 +915,7 @@ private void toolDeleteButton_Click(object sender, EventArgs e) } } - private void iconButton_Click(object sender, EventArgs e) + private void OnIconButtonClick(object sender, EventArgs e) { if (_selectedTool != null) { @@ -944,7 +944,7 @@ private void OnCancelButtonClick(object sender, EventArgs e) private void OnWorkingDirButtonClick(object sender, EventArgs e) { - WorkingDirButtonClick(textBoxWorkingDir); + OnWorkingDirButtonClick(textBoxWorkingDir); } private void OnMultiFilePatternTextChanged(object sender, EventArgs e) diff --git a/src/LogExpert/Program.cs b/src/LogExpert/Program.cs index 26fab581..45feac8c 100644 --- a/src/LogExpert/Program.cs +++ b/src/LogExpert/Program.cs @@ -157,12 +157,12 @@ private static void Sub_Main(string[] orgArgs) MessageBox.Show($"Cannot open connection to first instance ({errMsg})", "LogExpert"); } - if (settings.preferences.allowOnlyOneInstance && settings.preferences.DoNotShowAllowOnlyOneInstances == false) + if (settings.preferences.allowOnlyOneInstance && settings.preferences.ShowErrorMessageAllowOnlyOneInstances == false) { AllowOnlyOneInstanceErrorDialog a = new AllowOnlyOneInstanceErrorDialog(); if (a.ShowDialog() == DialogResult.OK) { - settings.preferences.DoNotShowAllowOnlyOneInstances = a.DoNotShowThisMessageAgain; + settings.preferences.ShowErrorMessageAllowOnlyOneInstances = a.DoNotShowThisMessageAgain; ConfigManager.Save(SettingsFlags.All); } From 456318a5682ce1b6180bf2992e86e6ec367d0438 Mon Sep 17 00:00:00 2001 From: Patrick Bruner Date: Fri, 16 Dec 2022 11:42:59 +0100 Subject: [PATCH 3/3] add a few more checks --- ...llowOnlyOneInstanceErrorDialog.Designer.cs | 22 ++++++++++++------- src/LogExpert/Program.cs | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs index 0acc186b..d03d6dfa 100644 --- a/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs +++ b/src/LogExpert/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs @@ -39,9 +39,10 @@ private void InitializeComponent() this.checkBoxIgnoreMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxIgnoreMessage.AutoSize = true; - this.checkBoxIgnoreMessage.Location = new System.Drawing.Point(13, 88); + this.checkBoxIgnoreMessage.Location = new System.Drawing.Point(9, 56); + this.checkBoxIgnoreMessage.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.checkBoxIgnoreMessage.Name = "checkBoxIgnoreMessage"; - this.checkBoxIgnoreMessage.Size = new System.Drawing.Size(257, 24); + this.checkBoxIgnoreMessage.Size = new System.Drawing.Size(177, 17); this.checkBoxIgnoreMessage.TabIndex = 0; this.checkBoxIgnoreMessage.Text = "Show this message only once\\?"; this.checkBoxIgnoreMessage.UseVisualStyleBackColor = true; @@ -51,9 +52,10 @@ private void InitializeComponent() this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOk.Location = new System.Drawing.Point(313, 82); + this.buttonOk.Location = new System.Drawing.Point(209, 53); + this.buttonOk.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.buttonOk.Name = "buttonOk"; - this.buttonOk.Size = new System.Drawing.Size(104, 36); + this.buttonOk.Size = new System.Drawing.Size(74, 23); this.buttonOk.TabIndex = 1; this.buttonOk.Text = "Ok"; this.buttonOk.UseVisualStyleBackColor = true; @@ -61,23 +63,27 @@ private void InitializeComponent() // // labelErrorText // + this.labelErrorText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.labelErrorText.AutoEllipsis = true; - this.labelErrorText.Location = new System.Drawing.Point(13, 13); + this.labelErrorText.Location = new System.Drawing.Point(9, 8); + this.labelErrorText.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labelErrorText.Name = "labelErrorText"; - this.labelErrorText.Size = new System.Drawing.Size(404, 66); + this.labelErrorText.Size = new System.Drawing.Size(273, 43); this.labelErrorText.TabIndex = 2; this.labelErrorText.Text = "Only one instance allowed, uncheck \\\"View Settings => Allow only 1 Instances\\\" to" + " start multiple instances!"; // // AllowOnlyOneInstanceErrorDialog // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(432, 130); + this.ClientSize = new System.Drawing.Size(293, 84); this.Controls.Add(this.labelErrorText); this.Controls.Add(this.buttonOk); this.Controls.Add(this.checkBoxIgnoreMessage); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.Name = "AllowOnlyOneInstanceErrorDialog"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; diff --git a/src/LogExpert/Program.cs b/src/LogExpert/Program.cs index 45feac8c..8977e24f 100644 --- a/src/LogExpert/Program.cs +++ b/src/LogExpert/Program.cs @@ -157,12 +157,12 @@ private static void Sub_Main(string[] orgArgs) MessageBox.Show($"Cannot open connection to first instance ({errMsg})", "LogExpert"); } - if (settings.preferences.allowOnlyOneInstance && settings.preferences.ShowErrorMessageAllowOnlyOneInstances == false) + if (settings.preferences.allowOnlyOneInstance && settings.preferences.ShowErrorMessageAllowOnlyOneInstances) { AllowOnlyOneInstanceErrorDialog a = new AllowOnlyOneInstanceErrorDialog(); if (a.ShowDialog() == DialogResult.OK) { - settings.preferences.ShowErrorMessageAllowOnlyOneInstances = a.DoNotShowThisMessageAgain; + settings.preferences.ShowErrorMessageAllowOnlyOneInstances = !a.DoNotShowThisMessageAgain; ConfigManager.Save(SettingsFlags.All); }