Skip to content

Commit 3cc7661

Browse files
authored
Merge pull request #44 from Sandip124/fix/startupFontLoadingError
Fix/startup font loading error
2 parents faad584 + 2c848a7 commit 3cc7661

9 files changed

Lines changed: 40 additions & 30 deletions

File tree

BatteryNotifier.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
@@ -87,7 +87,7 @@
8787
<NugetTools>$(PkgNuGet_CommandLine)\tools</NugetTools>
8888
<SquirrelTools>$(Pkgsquirrel_windows)\tools</SquirrelTools>
8989

90-
<Version>2.0.0</Version>
90+
<Version>2.0.2</Version>
9191

9292
<NuspecFile>$(SolutionDir)ReleaseSpec.nuspec</NuspecFile>
9393
</PropertyGroup>
4.86 MB
Binary file not shown.
23.8 KB
Binary file not shown.
4.88 MB
Binary file not shown.

Deployment/Releases/RELEASES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ C74E7B149399495BA580E3C0787D003A08872910 BatteryNotifier-1.9.1-full.nupkg 169455
2828
1845132F05F25B06B552D2965A841CEDE1B5310A BatteryNotifier-1.9.2-delta.nupkg 22438
2929
23D408879F4EF3E3B8A6B474A69EF2E859D52A19 BatteryNotifier-1.9.2-full.nupkg 1693271
3030
3B60CB309E669EF0C7E4B63E72259A9230A0604D BatteryNotifier-2.0.0-delta.nupkg 3354312
31-
7FD12D0D1F5802E6D82E047CA0542EE78AA87C57 BatteryNotifier-2.0.0-full.nupkg 5111857
31+
7FD12D0D1F5802E6D82E047CA0542EE78AA87C57 BatteryNotifier-2.0.0-full.nupkg 5111857
32+
4806AB34AB9C2A73AEB937564D2B6DB5FC679287 BatteryNotifier-2.0.2-delta.nupkg 24341
33+
5A139C32C0C59B5F876E1582A18C9B4B888F3A35 BatteryNotifier-2.0.2-full.nupkg 5112906

Deployment/Releases/Setup.exe

512 Bytes
Binary file not shown.

Deployment/Releases/Setup.msi

0 Bytes
Binary file not shown.

Forms/Dashboard.Designer.cs

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Forms/Dashboard.cs

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ protected override CreateParams CreateParams
3636
public Dashboard()
3737
{
3838
InitializeComponent();
39-
ApplyTheme();
40-
ApplyFontStyle();
41-
this.RenderFormPosition(BatteryNotifierIcon);
42-
RenderTitleBarCursor();
4339
_debouncer = new Debouncer.Debouncer();
4440
}
4541

@@ -88,18 +84,30 @@ private void CloseIcon_MouseLeave(object? sender, EventArgs e)
8884
private void Dashboard_Load(object? sender, EventArgs e)
8985
{
9086
SuspendLayout();
91-
LoadSettings();
92-
HandleLaunchAtStartup();
93-
RefreshBatteryStatus();
94-
LoadNotificationSetting();
95-
BatteryStatusTimer.Enabled = true;
96-
ShowNotificationTimer.Enabled = true;
97-
98-
ConfigureTimer();
99-
AttachEventListeners();
100-
101-
InitializeContextMenu();
102-
ResumeLayout();
87+
try
88+
{
89+
this.RenderFormPosition(BatteryNotifierIcon);
90+
ApplyTheme();
91+
RenderTitleBarCursor();
92+
ApplyFontStyle();
93+
LoadSettings();
94+
HandleLaunchAtStartup();
95+
RefreshBatteryStatus();
96+
LoadNotificationSetting();
97+
BatteryStatusTimer.Enabled = true;
98+
ShowNotificationTimer.Enabled = true;
99+
ConfigureTimer();
100+
AttachEventListeners();
101+
InitializeContextMenu();
102+
}
103+
catch (Exception ex)
104+
{
105+
Notify(ex.Message);
106+
}
107+
finally
108+
{
109+
ResumeLayout();
110+
}
103111
}
104112

105113

@@ -122,9 +130,9 @@ private void LoadSettings()
122130
LowBatterySound.Text = appSetting.Default.lowBatteryNotificationMusic;
123131
}
124132

125-
private bool IsDarkTheme() => appSetting.Default.darkThemeApplied || appSetting.Default.SystemThemeApplied && !UtilityHelper.IsLightTheme();
126-
127-
private bool IsLightTheme() => !appSetting.Default.darkThemeApplied && appSetting.Default.SystemThemeApplied && UtilityHelper.IsLightTheme();
133+
private static bool IsDarkTheme() => appSetting.Default.darkThemeApplied || appSetting.Default.SystemThemeApplied && !UtilityHelper.IsLightTheme();
134+
135+
private static bool IsLightTheme() => !appSetting.Default.darkThemeApplied && appSetting.Default.SystemThemeApplied && UtilityHelper.IsLightTheme();
128136

129137
private void HandleLaunchAtStartup()
130138
{
@@ -287,7 +295,7 @@ private void FullBatteryTrackbar_Scroll(object? sender, EventArgs e)
287295
FullBatteryNotificationPercentageLabel.Text = RenderBatteryPercentageValue(fullBatteryTrackbar.Value);
288296
}
289297

290-
private string RenderBatteryPercentageValue(int value)
298+
private static string RenderBatteryPercentageValue(int value)
291299
{
292300
return $"({value}%)";
293301
}

0 commit comments

Comments
 (0)