diff --git a/src/LogExpert.Core/Interface/ILogTabWindow.cs b/src/LogExpert.Core/Interface/ILogTabWindow.cs
index 7b71d10f..b3d2d2cb 100644
--- a/src/LogExpert.Core/Interface/ILogTabWindow.cs
+++ b/src/LogExpert.Core/Interface/ILogTabWindow.cs
@@ -35,7 +35,12 @@ public interface ILogTabWindow
void LoadFiles (string[] fileNames);
///
- /// Sets the window to the foreground and gives it focus.
+ /// Show an error message, if this is the only allowed instance, and the error message should be displayed
+ ///
+ void ShowOnlyOneInstanceError ();
+
+ ///
+ /// Set the current Logwindow to be first in line
///
void SetForeground ();
diff --git a/src/LogExpert.UI/Dialogs/AboutBox.cs b/src/LogExpert.UI/Dialogs/AboutBox.cs
index d262d3ff..9d6ad49f 100644
--- a/src/LogExpert.UI/Dialogs/AboutBox.cs
+++ b/src/LogExpert.UI/Dialogs/AboutBox.cs
@@ -36,6 +36,7 @@ public AboutBox ()
var link = "https://github.com/LogExperts/LogExpert";
_ = linkLabelURL.Links.Add(new LinkLabel.Link(0, link.Length, link));
+
LoadUsedComponents();
ResumeLayout();
diff --git a/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs b/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs
index 6a07b9df..3057e1a2 100644
--- a/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs
+++ b/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.Designer.cs
@@ -1,4 +1,4 @@
-namespace LogExpert.Dialogs;
+namespace LogExpert.Dialogs;
partial class AllowOnlyOneInstanceErrorDialog
{
@@ -26,67 +26,63 @@ protected override void Dispose(bool disposing)
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
- private void InitializeComponent()
+ 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 = new CheckBox();
+ buttonOk = new Button();
+ labelErrorText = new Label();
+ 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(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(177, 17);
- this.checkBoxIgnoreMessage.TabIndex = 0;
- this.checkBoxIgnoreMessage.Text = "Show this message only once\\?";
- this.checkBoxIgnoreMessage.UseVisualStyleBackColor = true;
+ checkBoxIgnoreMessage.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ checkBoxIgnoreMessage.AutoSize = true;
+ checkBoxIgnoreMessage.Location = new Point(9, 72);
+ checkBoxIgnoreMessage.Margin = new Padding(2);
+ checkBoxIgnoreMessage.Name = "checkBoxIgnoreMessage";
+ checkBoxIgnoreMessage.Size = new Size(186, 19);
+ checkBoxIgnoreMessage.TabIndex = 0;
+ checkBoxIgnoreMessage.Text = "Show this message only once?";
+ 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(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(74, 23);
- this.buttonOk.TabIndex = 1;
- this.buttonOk.Text = "Ok";
- this.buttonOk.UseVisualStyleBackColor = true;
- this.buttonOk.Click += new System.EventHandler(this.OnButtonOkClick);
+ buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ buttonOk.DialogResult = DialogResult.OK;
+ buttonOk.Location = new Point(209, 71);
+ buttonOk.Margin = new Padding(2);
+ buttonOk.Name = "buttonOk";
+ buttonOk.Size = new Size(104, 23);
+ buttonOk.TabIndex = 1;
+ buttonOk.Text = "Ok";
+ buttonOk.UseVisualStyleBackColor = true;
+ buttonOk.Click += OnButtonOkClick;
//
// 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(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(273, 43);
- this.labelErrorText.TabIndex = 2;
- this.labelErrorText.Text = "Only one instance allowed, uncheck \\\"View Settings => Allow only 1 Instances\\\" to" +
-" start multiple instances!";
+ labelErrorText.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ labelErrorText.AutoEllipsis = true;
+ labelErrorText.Location = new Point(9, 8);
+ labelErrorText.Margin = new Padding(2, 0, 2, 0);
+ labelErrorText.Name = "labelErrorText";
+ labelErrorText.Size = new Size(303, 43);
+ labelErrorText.TabIndex = 2;
+ labelErrorText.Text = "Only one instance allowed, uncheck \"View Settings => Allow only 1 Instances\" to start multiple instances!";
//
// AllowOnlyOneInstanceErrorDialog
//
- 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;
- this.Text = "AllowOnlyOneInstanceErrorDialog";
- this.ResumeLayout(false);
- this.PerformLayout();
+ ClientSize = new Size(323, 102);
+ Controls.Add(labelErrorText);
+ Controls.Add(buttonOk);
+ Controls.Add(checkBoxIgnoreMessage);
+ FormBorderStyle = FormBorderStyle.FixedToolWindow;
+ Margin = new Padding(2);
+ MaximizeBox = false;
+ Name = "AllowOnlyOneInstanceErrorDialog";
+ SizeGripStyle = SizeGripStyle.Hide;
+ Text = "Allow only one instance error dialog";
+ ResumeLayout(false);
+ PerformLayout();
}
diff --git a/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.resx b/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.resx
new file mode 100644
index 00000000..8b2ff64a
--- /dev/null
+++ b/src/LogExpert.UI/Dialogs/AllowOnlyOneInstanceErrorDialog.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs
index bbf9db26..a70dc31e 100644
--- a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs
+++ b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs
@@ -192,8 +192,6 @@ public LogTabWindow (string[] fileNames, int instanceNumber, bool showInstanceNu
private delegate void FileRespawnedDelegate (LogWindow.LogWindow logWin);
- public delegate void HighlightSettingsChangedEventHandler (object sender, EventArgs e);
-
private delegate void LoadMultiFilesDelegate (string[] fileName, EncodingOptions encodingOptions);
private delegate void SetColumnizerFx (ILogLineColumnizer columnizer);
@@ -204,7 +202,7 @@ public LogTabWindow (string[] fileNames, int instanceNumber, bool showInstanceNu
#region Events
- public event HighlightSettingsChangedEventHandler HighlightSettingsChanged;
+ public event EventHandler HighlightSettingsChanged;
#endregion
@@ -598,6 +596,19 @@ public void LoadFiles (string[] fileNames)
_ = Invoke(new AddFileTabsDelegate(AddFileTabs), [fileNames]);
}
+ public void ShowOnlyOneInstanceError ()
+ {
+ if (lockInstanceToolStripMenuItem.Checked && ConfigManager.Instance.Settings.Preferences.ShowErrorMessageAllowOnlyOneInstances)
+ {
+ using AllowOnlyOneInstanceErrorDialog a = new();
+ if (a.ShowDialog() == DialogResult.OK)
+ {
+ ConfigManager.Instance.Settings.Preferences.ShowErrorMessageAllowOnlyOneInstances = !a.DoNotShowThisMessageAgain;
+ ConfigManager.Instance.Save(SettingsFlags.All);
+ }
+ }
+ }
+
[SupportedOSPlatform("windows")]
public void OpenSearchDialog ()
{
@@ -1683,11 +1694,15 @@ private void SetTabIcon (LogWindow.LogWindow logWindow, Icon icon)
private Icon GetIcon (int diff, LogWindowData data)
{
- var icon =
- _ledIcons[
- GetLevelFromDiff(diff), data.Dirty ? 1 : 0, Preferences.ShowTailState ? data.TailState : 3,
- data.SyncMode
- ];
+ var icon = _ledIcons[GetLevelFromDiff(diff),
+ data.Dirty
+ ? 1
+ : 0,
+ Preferences.ShowTailState
+ ? data.TailState
+ : 3,
+ data.SyncMode
+ ];
return icon;
}
@@ -3157,7 +3172,6 @@ private void OnLockInstanceToolStripMenuItemClick (object sender, EventArgs e)
[SupportedOSPlatform("windows")]
private void OnOptionToolStripMenuItemDropDownOpening (object sender, EventArgs e)
{
- lockInstanceToolStripMenuItem.Enabled = !ConfigManager.Settings.Preferences.AllowOnlyOneInstance;
lockInstanceToolStripMenuItem.Checked = AbstractLogTabWindow.StaticData.CurrentLockedMainWindow == this;
}
diff --git a/src/LogExpert.UI/Dialogs/SettingsDialog.cs b/src/LogExpert.UI/Dialogs/SettingsDialog.cs
index 578be2a0..56243ceb 100644
--- a/src/LogExpert.UI/Dialogs/SettingsDialog.cs
+++ b/src/LogExpert.UI/Dialogs/SettingsDialog.cs
@@ -185,8 +185,10 @@ private void FillDialog ()
case SessionSaveLocation.DocumentsDir:
{
radioButtonsessionSaveDocuments.Checked = true;
- break;
+
}
+
+ break;
case SessionSaveLocation.ApplicationStartupDir:
{
radioButtonSessionApplicationStartupDir.Checked = true;
@@ -1207,4 +1209,4 @@ private Dictionary GetToolTipMap ()
}
#endregion
-}
\ No newline at end of file
+}
diff --git a/src/LogExpert/Classes/LogExpertProxy.cs b/src/LogExpert/Classes/LogExpertProxy.cs
index 763e51d9..40c12c4e 100644
--- a/src/LogExpert/Classes/LogExpertProxy.cs
+++ b/src/LogExpert/Classes/LogExpertProxy.cs
@@ -99,6 +99,7 @@ public void NewWindowOrLockedWindow (string[] fileNames)
{
_ = logWin.Invoke(new MethodInvoker(logWin.SetForeground));
logWin.LoadFiles(fileNames);
+ logWin.ShowOnlyOneInstanceError();
return;
}
}
diff --git a/src/LogExpert/Program.cs b/src/LogExpert/Program.cs
index 7db33f95..671c6a8d 100644
--- a/src/LogExpert/Program.cs
+++ b/src/LogExpert/Program.cs
@@ -14,7 +14,6 @@
using LogExpert.Config;
using LogExpert.Core.Classes.IPC;
using LogExpert.Core.Config;
-using LogExpert.Dialogs;
using LogExpert.UI.Dialogs;
using LogExpert.UI.Extensions.LogWindow;