diff --git a/MouseJiggler/MainForm.Designer.cs b/MouseJiggler/MainForm.Designer.cs index 0c87ef3..a7063a7 100644 --- a/MouseJiggler/MainForm.Designer.cs +++ b/MouseJiggler/MainForm.Designer.cs @@ -201,6 +201,7 @@ private void InitializeComponent() this.Name = "MainForm"; this.Text = "Mouse Jiggler"; this.Load += new System.EventHandler(this.MainForm_Load); + this.Shown += new System.EventHandler(this.MainForm_Shown); this.flpLayout.ResumeLayout(false); this.flpLayout.PerformLayout(); this.panelBase.ResumeLayout(false); diff --git a/MouseJiggler/MainForm.cs b/MouseJiggler/MainForm.cs index 6f32b0a..0200b7f 100644 --- a/MouseJiggler/MainForm.cs +++ b/MouseJiggler/MainForm.cs @@ -2,7 +2,7 @@ // MouseJiggler - MainForm.cs // -// Created by: Alistair J R Young (avatar) at 2021/01/20 7:23 PM. +// Created by: Alistair J R Young (avatar) at 2021/01/24 1:57 AM. #endregion @@ -47,9 +47,6 @@ private void MainForm_Load (object sender, EventArgs e) { if (this.JiggleOnStartup) this.cbJiggling.Checked = true; - - if (this.MinimizeOnStartup) - this.MinimizeToTray (); } private void UpdateNotificationAreaText () @@ -196,5 +193,19 @@ public int JigglePeriod } #endregion Settings properties + + #region Minimize on start + + private bool firstShown = true; + + private void MainForm_Shown (object sender, EventArgs e) + { + if (this.firstShown && this.MinimizeOnStartup) + this.MinimizeToTray (); + + this.firstShown = false; + } + + #endregion } } diff --git a/MouseJiggler/MouseJiggler.csproj b/MouseJiggler/MouseJiggler.csproj index b98b921..e52577e 100644 --- a/MouseJiggler/MouseJiggler.csproj +++ b/MouseJiggler/MouseJiggler.csproj @@ -10,8 +10,7 @@ 2.0.0 true false - win-x86 - true + win-x64 Alistair J. R. Young Arkane Systems A utility to continuously jiggle the mouse pointer to prevent screen saver activation. diff --git a/MouseJiggler/Program.cs b/MouseJiggler/Program.cs index 4253c85..4a6a0c0 100644 --- a/MouseJiggler/Program.cs +++ b/MouseJiggler/Program.cs @@ -2,7 +2,7 @@ // MouseJiggler - Program.cs // -// Created by: Alistair J R Young (avatar) at 2021/01/20 7:23 PM. +// Created by: Alistair J R Young (avatar) at 2021/01/22 4:12 PM. #endregion @@ -45,9 +45,15 @@ public static int Main (string[] args) if (instance.WaitOne (millisecondsTimeout: 0)) // Parse arguments and do the appropriate thing. + { return Program.GetCommandLineParser ().Invoke (args: args); + } else + { + Console.WriteLine (value: "Mouse Jiggler is already running. Aborting."); + return 1; + } } finally {