Skip to content

Commit

Permalink
Version 3.11.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaskohl committed Apr 5, 2021
1 parent d4c864a commit 126d541
Show file tree
Hide file tree
Showing 42 changed files with 5,498 additions and 3,349 deletions.
7 changes: 4 additions & 3 deletions CapsLockIndicatorV3.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 5.1
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31105.61
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CapsLockIndicatorV3", "CapsLockIndicatorV3\CapsLockIndicatorV3.csproj", "{D73D960D-7FF8-4F22-A19F-C555AAB7DD52}"
EndProject
Global
Expand Down
16 changes: 16 additions & 0 deletions CapsLockIndicatorV3/CapsLockIndicatorV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<Compile Include="ColourButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DarkModeForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DarkModeProvider.cs" />
<Compile Include="DownloadDialog.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -191,23 +195,35 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="strings.cs.resx" />
<EmbeddedResource Include="strings.de.resx" />
<EmbeddedResource Include="strings.es.resx" />
<EmbeddedResource Include="strings.fr.resx" />
<EmbeddedResource Include="strings.it.resx" />
<EmbeddedResource Include="strings.ko.resx" />
<EmbeddedResource Include="strings.nl.resx" />
<EmbeddedResource Include="strings.pt-BR.resx" />
<EmbeddedResource Include="strings.pt-PT.resx" />
<EmbeddedResource Include="strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="strings.ru.resx" />
<EmbeddedResource Include="strings.tr-TR.resx" />
<EmbeddedResource Include="strings.zh-CN.resx" />
<EmbeddedResource Include="UpdateDialog.resx">
<DependentUpon>UpdateDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="CLIv3_Icon.ico" />
<None Include="Resources\settings.ico" />
<None Include="Resources\logo.Image.png" />
<None Include="Resources\MainWindow.Icon.ico" />
<None Include="Resources\generalIcon.Icon.ico" />
<None Include="Resources\settings_w.ico" />
<None Include="Resources\CLIv3_Icon_Dark.ico" />
<None Include="Resources\generalIcon_dark.Icon.ico" />
<None Include="Resources\logo_dark.Image.png" />
<None Include="Resources\defaultSettings.txt" />
<None Include="Resources\CLIv3_Scroll_On.ico" />
Expand Down
14 changes: 9 additions & 5 deletions CapsLockIndicatorV3/CapsLockIndicatorV3.csproj.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>
30 changes: 30 additions & 0 deletions CapsLockIndicatorV3/DarkModeForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CapsLockIndicatorV3
{
public class DarkModeForm : Form
{
public event EventHandler DarkModeChanged;

internal void OnDarkModeChanged()
{
DarkModeChanged?.Invoke(this, EventArgs.Empty);
}

protected void ControlScheduleSetDarkMode(Control control, bool isDark)
{
if (control.IsHandleCreated)
Native.ControlSetDarkMode(control, isDark);
else
control.HandleCreated += (sender, e) =>
{
Native.ControlSetDarkMode(control, isDark);
};
}
}
}
40 changes: 40 additions & 0 deletions CapsLockIndicatorV3/DarkModeProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CapsLockIndicatorV3
{
public static class DarkModeProvider
{
public static bool IsDark => Environment.OSVersion.Version.Major >= 10 && SettingsManager.Get<bool>("darkMode");

private static List<DarkModeForm> registeredForms = new List<DarkModeForm>();

public static void RegisterForm(DarkModeForm form)
{
registeredForms.Add(form);
form.FormClosing += Form_FormClosing;
form.OnDarkModeChanged();
}

public static void SetDarkModeEnabled(bool enabled)
{
SettingsManager.Set("darkMode", enabled);
UpdateForms();
}

private static void UpdateForms()
{
foreach (var f in registeredForms)
f.OnDarkModeChanged();
}

private static void Form_FormClosing(object sender, FormClosingEventArgs e)
{
registeredForms.Remove(sender as DarkModeForm);
}
}
}
Loading

0 comments on commit 126d541

Please sign in to comment.