From 549f14f33fc0def3c16676e983c4c4874d2cf4ce Mon Sep 17 00:00:00 2001 From: Charlie Jiang Date: Fri, 24 Dec 2021 17:09:30 +0800 Subject: [PATCH] (hopefully) fix mysterious disappearing window --- DesktopLyrics.cs | 2 +- FrmLyrics.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DesktopLyrics.cs b/DesktopLyrics.cs index e07c4ab..1bd72e5 100644 --- a/DesktopLyrics.cs +++ b/DesktopLyrics.cs @@ -114,7 +114,7 @@ public void ReceiveNotification(string sourceFileUrl, NotificationType type) switch (type) { case NotificationType.PluginStartup: - while (!Debugger.IsAttached) System.Threading.Thread.Sleep(1); + // while (!Debugger.IsAttached) System.Threading.Thread.Sleep(1); try { try diff --git a/FrmLyrics.cs b/FrmLyrics.cs index 29a5a44..3a3e6f8 100644 --- a/FrmLyrics.cs +++ b/FrmLyrics.cs @@ -41,6 +41,11 @@ private void FrmLyrics_Load(object sender, EventArgs e) _settings.PosX = Left; _settings.PosY = Top; }; + FormClosing += (o, args) => + { + if (args.CloseReason == CloseReason.UserClosing) + args.Cancel = true; + }; } public void UpdateFromSettings(SettingsObj settings)