diff --git a/BatteryNotifier.csproj b/BatteryNotifier.csproj
index 4796cf2..0dc4063 100644
--- a/BatteryNotifier.csproj
+++ b/BatteryNotifier.csproj
@@ -87,7 +87,7 @@
$(PkgNuGet_CommandLine)\tools
$(Pkgsquirrel_windows)\tools
- 2.0.3
+ 2.0.4
$(SolutionDir)ReleaseSpec.nuspec
diff --git a/Deployment/GeneratedNugets/BatteryNotifier.2.0.4.nupkg b/Deployment/GeneratedNugets/BatteryNotifier.2.0.4.nupkg
new file mode 100644
index 0000000..785e330
Binary files /dev/null and b/Deployment/GeneratedNugets/BatteryNotifier.2.0.4.nupkg differ
diff --git a/Deployment/Releases/BatteryNotifier-2.0.4-delta.nupkg b/Deployment/Releases/BatteryNotifier-2.0.4-delta.nupkg
new file mode 100644
index 0000000..b74a435
Binary files /dev/null and b/Deployment/Releases/BatteryNotifier-2.0.4-delta.nupkg differ
diff --git a/Deployment/Releases/BatteryNotifier-2.0.4-full.nupkg b/Deployment/Releases/BatteryNotifier-2.0.4-full.nupkg
new file mode 100644
index 0000000..6f8c957
Binary files /dev/null and b/Deployment/Releases/BatteryNotifier-2.0.4-full.nupkg differ
diff --git a/Deployment/Releases/RELEASES b/Deployment/Releases/RELEASES
index d0b0295..87041ba 100644
--- a/Deployment/Releases/RELEASES
+++ b/Deployment/Releases/RELEASES
@@ -32,4 +32,6 @@ C74E7B149399495BA580E3C0787D003A08872910 BatteryNotifier-1.9.1-full.nupkg 169455
4806AB34AB9C2A73AEB937564D2B6DB5FC679287 BatteryNotifier-2.0.2-delta.nupkg 24341
5A139C32C0C59B5F876E1582A18C9B4B888F3A35 BatteryNotifier-2.0.2-full.nupkg 5112906
A3E0F13A323576C0092DDC02253BF231E74989E5 BatteryNotifier-2.0.3-delta.nupkg 24843
-29C57A2CFA3CAE4FE5220E0CD4EFE998D56EBFF6 BatteryNotifier-2.0.3-full.nupkg 5112125
\ No newline at end of file
+29C57A2CFA3CAE4FE5220E0CD4EFE998D56EBFF6 BatteryNotifier-2.0.3-full.nupkg 5112125
+075D7698594B7479E20993FE7A731F093FF918DC BatteryNotifier-2.0.4-delta.nupkg 26237
+C953C570D0CB63BC9B82A8D72EBB89925657BD85 BatteryNotifier-2.0.4-full.nupkg 5112438
\ No newline at end of file
diff --git a/Deployment/Releases/Setup.exe b/Deployment/Releases/Setup.exe
index a86a970..dcee611 100644
Binary files a/Deployment/Releases/Setup.exe and b/Deployment/Releases/Setup.exe differ
diff --git a/Deployment/Releases/Setup.msi b/Deployment/Releases/Setup.msi
index 608b22c..a1ffaf9 100644
Binary files a/Deployment/Releases/Setup.msi and b/Deployment/Releases/Setup.msi differ
diff --git a/Forms/Dashboard.Designer.cs b/Forms/Dashboard.Designer.cs
index 44f2e34..4268315 100644
--- a/Forms/Dashboard.Designer.cs
+++ b/Forms/Dashboard.Designer.cs
@@ -289,28 +289,31 @@ private void InitializeComponent()
this.AppFooter.Location = new System.Drawing.Point(0, 468);
this.AppFooter.Margin = new System.Windows.Forms.Padding(0);
this.AppFooter.Name = "AppFooter";
+ this.AppFooter.Padding = new System.Windows.Forms.Padding(8, 0, 8, 0);
this.AppFooter.Size = new System.Drawing.Size(408, 40);
this.AppFooter.TabIndex = 8;
//
// VersionLabel
//
- this.VersionLabel.AutoSize = true;
this.VersionLabel.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.VersionLabel.Dock = System.Windows.Forms.DockStyle.Right;
this.VersionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.VersionLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
- this.VersionLabel.Location = new System.Drawing.Point(334, 14);
+ this.VersionLabel.Location = new System.Drawing.Point(337, 0);
this.VersionLabel.Name = "VersionLabel";
this.VersionLabel.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
- this.VersionLabel.Size = new System.Drawing.Size(63, 16);
+ this.VersionLabel.Size = new System.Drawing.Size(63, 40);
this.VersionLabel.TabIndex = 23;
this.VersionLabel.Text = "v 1.0.0.0";
+ this.VersionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NotificationText
//
+ this.NotificationText.Dock = System.Windows.Forms.DockStyle.Left;
this.NotificationText.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.NotificationText.Location = new System.Drawing.Point(9, 14);
+ this.NotificationText.Location = new System.Drawing.Point(8, 0);
this.NotificationText.Name = "NotificationText";
- this.NotificationText.Size = new System.Drawing.Size(272, 16);
+ this.NotificationText.Size = new System.Drawing.Size(312, 40);
this.NotificationText.TabIndex = 17;
this.NotificationText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
@@ -1266,7 +1269,6 @@ private void InitializeComponent()
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Location = new System.Drawing.Point(90, 90);
this.MaximizeBox = false;
- this.MinimizeBox = true;
this.Name = "Dashboard";
this.Padding = new System.Windows.Forms.Padding(1);
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
@@ -1278,7 +1280,6 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.AppContainer.ResumeLayout(false);
this.AppFooter.ResumeLayout(false);
- this.AppFooter.PerformLayout();
this.AppHeader.ResumeLayout(false);
this.AppHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
diff --git a/Forms/Dashboard.cs b/Forms/Dashboard.cs
index e336c90..7b99431 100644
--- a/Forms/Dashboard.cs
+++ b/Forms/Dashboard.cs
@@ -63,10 +63,8 @@ public void SetVersion(string? ver)
public void Notify(string status, int timeout = DefaultNotificationTimeout)
{
NotificationText.Text = status;
- _debouncer.Debounce(() =>
- {
- NotificationText.Text = string.Empty;
- }, timeout);
+ System.Threading.Thread.Sleep(timeout);
+ NotificationText.Text = string.Empty;
}
private void CloseIcon_Click(object? sender, EventArgs e)
diff --git a/Program.cs b/Program.cs
index a710e9f..64d0e86 100644
--- a/Program.cs
+++ b/Program.cs
@@ -14,8 +14,6 @@ internal static class Program
private static Form? MainForm;
- private static bool IsUpdateInProgress = false;
-
private static string? version = UtilityHelper.AssemblyVersion;
///
@@ -24,42 +22,47 @@ internal static class Program
[STAThread]
static void Main()
{
- var appId = Setting.appSetting.Default.AppId;
- if (string.IsNullOrEmpty(appId))
+ try
{
- appId = Setting.appSetting.Default.AppId = Guid.NewGuid().ToString();
- Setting.appSetting.Default.Save();
- }
-
- AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledExpection);
- AppDomain.CurrentDomain.ProcessExit += OnExit;
+ var appId = Setting.appSetting.Default.AppId;
+ if (string.IsNullOrEmpty(appId))
+ {
+ appId = Setting.appSetting.Default.AppId = Guid.NewGuid().ToString();
+ Setting.appSetting.Default.Save();
+ }
- using Mutex mutex = new(false, "Global\\" + appId);
- if (!mutex.WaitOne(0, false))
- {
- return;
- }
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledExpection);
+
+ using Mutex mutex = new(false, "Global\\" + appId);
+ if (!mutex.WaitOne(0, false))
+ {
+ return;
+ }
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
- MainForm = new Dashboard();
- var dashboard = MainForm as Dashboard;
+ MainForm = new Dashboard();
+ var dashboard = MainForm as Dashboard;
#if RELEASE
- if (InternetConnectivityHelper.CheckForInternetConnection())
+ if (InternetConnectivityHelper.CheckForInternetConnection())
+ {
+ dashboard?.Notify("🤿 Checking for update ...");
+ Task.Run( () =>InitUpdateManager()).Wait();
+ Task UpdateTask = new(CheckForUpdates);
+ UpdateTask.Start();
+ version = UpdateManager?.CurrentlyInstalledVersion().ToString();
+ }
+#endif
+ dashboard?.SetVersion(version);
+
+ Application.Run(dashboard);
+ }
+ catch (Exception e)
{
- Task.Run(() => InitUpdateManager()).Wait();
- Task UpdateTask = new(CheckForUpdates);
- UpdateTask.Start();
- version = UpdateManager!.CurrentlyInstalledVersion().ToString();
- dashboard?.Notify("🤿 Checking for update ...");
- IsUpdateInProgress = true;
+ (MainForm as Dashboard)?.Notify(e.Message);
}
-#endif
- dashboard?.SetVersion(version);
-
- Application.Run(dashboard);
}
@@ -79,9 +82,7 @@ static async void CheckForUpdates()
{
try
{
- var updateInfo = await UpdateManager!.CheckForUpdate();
-
- if (!IsUpdateInProgress) return;
+ var updateInfo = await UpdateManager?.CheckForUpdate()!;
if (updateInfo.ReleasesToApply.Count > 0)
{
@@ -89,31 +90,23 @@ static async void CheckForUpdates()
if (releaseEntry != null)
{
- IsUpdateInProgress = false;
- (MainForm as Dashboard)?.Notify($"✅ Battery Notifier {releaseEntry.Version} downloaded. Restart to apply." );
+ (MainForm as Dashboard)?.Notify($"✅ Battery Notifier {releaseEntry.Version} downloaded. Restart to apply.");
}
}
else
{
-
- IsUpdateInProgress = false;
(MainForm as Dashboard)?.Notify("✌ No Update Available");
}
}
catch (Exception)
{
- MessageBox.Show("💀 Could not update app!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ (MainForm as Dashboard)?.Notify("💀 Could not update app!");
}
}
- private static void OnExit(object? sender, EventArgs e)
- {
- UpdateManager?.Dispose();
- }
-
static void OnUnhandledExpection(object? sender, UnhandledExceptionEventArgs args)
{
- MessageBox.Show(args.ExceptionObject.ToString(),"Battery Notifier error!");
+ (MainForm as Dashboard)?.Notify("Unhandled exception occured.");
}
}