├── .github ├── stale.yml └── workflows │ └── stale.yml ├── .gitignore ├── .travis.yml ├── CapsLockIndicatorV3.sln ├── CapsLockIndicatorV3 ├── AdvancedSettings.Designer.cs ├── AdvancedSettings.cs ├── AdvancedSettings.resx ├── AssertionFailedException.cs ├── BetterCheckBox.cs ├── BetterTabControl.cs ├── BetterToolTip.cs ├── CLIv3_Icon.ico ├── CapsLockIndicatorV3.csproj ├── CapsLockIndicatorV3.csproj.user ├── ColourButton.cs ├── DPIHelper.cs ├── DarkModeChangingForm.Designer.cs ├── DarkModeChangingForm.cs ├── DarkModeChangingForm.resx ├── DarkModeForm.cs ├── DarkModeListView.cs ├── DarkModeProvider.cs ├── DllInfo.cs ├── DownloadDialog.Designer.cs ├── DownloadDialog.cs ├── DownloadDialog.resx ├── DropDownLocale.cs ├── ExtensionMethods.cs ├── FirstRunDialog.Designer.cs ├── FirstRunDialog.cs ├── FirstRunDialog.resx ├── HelpWindow.Designer.cs ├── HelpWindow.cs ├── HelpWindow.resx ├── IconExtractor.cs ├── IconGalleryObjectForScripting.cs ├── IconPackBrowser.Designer.cs ├── IconPackBrowser.cs ├── IconPackBrowser.resx ├── IndSettingsWindow.Designer.cs ├── IndSettingsWindow.cs ├── IndSettingsWindow.resx ├── IndicatorDisplayPosition.cs ├── IndicatorOverlay.Designer.cs ├── IndicatorOverlay.cs ├── IndicatorOverlay.resx ├── IndicatorTrigger.cs ├── KeyHelper.cs ├── LanguageDownloadProgressForm.Designer.cs ├── LanguageDownloadProgressForm.cs ├── LanguageDownloadProgressForm.resx ├── LanguageProgressRow.Designer.cs ├── LanguageProgressRow.cs ├── LanguageProgressRow.resx ├── LnComboBox.cs ├── LnkLabel.cs ├── MColorPicker.cs ├── MFontPicker.cs ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Native.cs ├── NumberInputDialog.Designer.cs ├── NumberInputDialog.cs ├── NumberInputDialog.resx ├── PaddingInputDialog.Designer.cs ├── PaddingInputDialog.cs ├── PaddingInputDialog.resx ├── Program.cs ├── ProgressDialog.Designer.cs ├── ProgressDialog.cs ├── ProgressDialog.resx ├── ProgressInfo.cs ├── Properties │ └── AssemblyInfo.cs ├── QueryBuilder.cs ├── Resources │ ├── CLIv3_Caps_Off.ico │ ├── CLIv3_Caps_On.ico │ ├── CLIv3_Icon_Dark.ico │ ├── CLIv3_Num_Off.ico │ ├── CLIv3_Num_On.ico │ ├── CLIv3_Scroll_Off.ico │ ├── CLIv3_Scroll_On.ico │ ├── MainWindow.Icon.ico │ ├── TabIcons.bmp │ ├── defaultSettings.txt │ ├── generalIcon.Icon.ico │ ├── generalIcon_dark.Icon.ico │ ├── logo.Image.png │ ├── logo_dark.Image.png │ ├── settings.ico │ ├── settingsDescriptions.txt │ └── settings_w.ico ├── RichTextLabel.cs ├── Settings.cs ├── SettingsManager.cs ├── StringFormatter.cs ├── SysIcons.cs ├── TextInputDialog.Designer.cs ├── TextInputDialog.cs ├── TextInputDialog.resx ├── URLs.cs ├── UpdateDialog.Designer.cs ├── UpdateDialog.cs ├── UpdateDialog.resx ├── VersionCheck.cs ├── Versions.cs ├── ViewOnlyRichTextBox.cs ├── app.config ├── app.manifest ├── bin │ └── Release │ │ └── pack-lang-files.ps1 ├── resources.Designer.cs ├── resources.resx ├── strings.Designer.cs ├── strings.ar.resx ├── strings.cs.Designer.cs ├── strings.cs.resx ├── strings.de.Designer.cs ├── strings.de.resx ├── strings.es.Designer.cs ├── strings.es.resx ├── strings.fr.Designer.cs ├── strings.fr.resx ├── strings.it.Designer.cs ├── strings.it.resx ├── strings.ja.resx ├── strings.ko.Designer.cs ├── strings.ko.resx ├── strings.nl.Designer.cs ├── strings.nl.resx ├── strings.pl.resx ├── strings.pt-BR.Designer.cs ├── strings.pt-BR.resx ├── strings.pt-PT.Designer.cs ├── strings.pt-PT.resx ├── strings.resx ├── strings.ru.Designer.cs ├── strings.ru.resx ├── strings.tr-TR.Designer.cs ├── strings.tr-TR.resx ├── strings.zh-CN.Designer.cs ├── strings.zh-CN.resx ├── strings.zh-Hant-TW.resx ├── strings.zh-TW.Designer.cs └── strings.zh-TW.resx ├── LICENSE ├── README.md └── azure-pipelines.yml /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | # Label to use when marking an issue as stale 9 | staleLabel: stale 10 | exemptLabels: 11 | - 'in-backlog' 12 | - 'no-stale' 13 | - 'pinned' 14 | # Comment to post when marking an issue as stale. Set to `false` to disable 15 | markComment: > 16 | This issue has been automatically marked as stale because it has not had 17 | recent activity. It will be closed if no further activity occurs. Thank you 18 | for your contributions. 19 | # Comment to post when closing a stale issue. Set to `false` to disable 20 | closeComment: > 21 | This issue has been automatically closed because there has not been any 22 | new activity since it has been marked as stale. 23 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | name: Mark stale issues and pull requests 7 | 8 | on: 9 | schedule: 10 | - cron: '0 0,12 * * *' 11 | workflow_dispatch: 12 | 13 | jobs: 14 | stale: 15 | 16 | runs-on: ubuntu-latest 17 | permissions: 18 | issues: write 19 | pull-requests: write 20 | 21 | steps: 22 | - uses: actions/stale@v5 23 | with: 24 | repo-token: ${{ secrets.GITHUB_TOKEN }} 25 | stale-issue-message: > 26 | This issue has been automatically marked as stale because it has not had 27 | recent activity. It will be closed if no further activity occurs. Thank you 28 | for your contributions. 29 | stale-pr-message: > 30 | This issue has been automatically closed because there has not been any 31 | new activity since it has been marked as stale. 32 | stale-issue-label: 'stale' 33 | stale-pr-label: 'stale' 34 | exempt-issue-labels: in-backlog,no-stale 35 | days-before-stale: 30 36 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: CapsLockIndicatorV3.sln 3 | script: 4 | - msbuild /p:Configuration=Release CapsLockIndicatorV3.sln 5 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31105.61 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CapsLockIndicatorV3", "CapsLockIndicatorV3\CapsLockIndicatorV3.csproj", "{D73D960D-7FF8-4F22-A19F-C555AAB7DD52}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D73D960D-7FF8-4F22-A19F-C555AAB7DD52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D73D960D-7FF8-4F22-A19F-C555AAB7DD52}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D73D960D-7FF8-4F22-A19F-C555AAB7DD52}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D73D960D-7FF8-4F22-A19F-C555AAB7DD52}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/AdvancedSettings.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/AssertionFailedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace CapsLockIndicatorV3 5 | { 6 | [Serializable] 7 | internal class AssertionFailedException : Exception 8 | { 9 | public AssertionFailedException() 10 | { 11 | } 12 | 13 | public AssertionFailedException(string message) : base(message) 14 | { 15 | } 16 | 17 | public AssertionFailedException(string message, Exception innerException) : base(message, innerException) 18 | { 19 | } 20 | 21 | protected AssertionFailedException(SerializationInfo info, StreamingContext context) : base(info, context) 22 | { 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/BetterToolTip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace CapsLockIndicatorV3 11 | { 12 | public class BetterToolTip : ToolTip 13 | { 14 | private static readonly Color Background = Color.FromArgb(43, 43, 43); 15 | private static readonly Color Border = Color.FromArgb(118, 118, 118); 16 | private static readonly Color Text = Color.White; 17 | 18 | private bool _darkMode; 19 | 20 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)] 21 | public bool DarkMode 22 | { 23 | get => _darkMode; 24 | set 25 | { 26 | _darkMode = value; 27 | OwnerDraw = value; 28 | } 29 | } 30 | 31 | public BetterToolTip() : base() 32 | { 33 | Popup += BetterToolTip_Popup; 34 | Draw += BetterToolTip_Draw; 35 | } 36 | 37 | public BetterToolTip(IContainer cont) : base(cont) 38 | { 39 | Popup += BetterToolTip_Popup; 40 | Draw += BetterToolTip_Draw; 41 | } 42 | 43 | private void BetterToolTip_Popup(object sender, PopupEventArgs e) 44 | { 45 | 46 | } 47 | 48 | private void BetterToolTip_Draw(object sender, DrawToolTipEventArgs e) 49 | { 50 | e.Graphics.Clear(Background); 51 | using (var p = new Pen(Border)) 52 | e.Graphics.DrawRectangle(p, new Rectangle( 53 | e.Bounds.X, 54 | e.Bounds.Y, 55 | e.Bounds.Width - 1, 56 | e.Bounds.Height - 1 57 | )); 58 | var ts = TextRenderer.MeasureText(e.Graphics, e.ToolTipText, e.Font); 59 | var tpos = new Point(2, e.Bounds.Height / 2 - ts.Height / 2); 60 | TextRenderer.DrawText(e.Graphics, e.ToolTipText, e.Font, tpos, Text); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/CLIv3_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/CLIv3_Icon.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/CapsLockIndicatorV3.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectFiles 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ColourButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Drawing; 4 | 5 | namespace CapsLockIndicatorV3 6 | { 7 | class ColourButton : Button 8 | { 9 | public Color Colour { get; set; } 10 | 11 | const int COLOUR_MARGIN = 4; 12 | 13 | protected override void OnPaint(PaintEventArgs pevent) 14 | { 15 | /*Bitmap b = new Bitmap(16, 16); 16 | Graphics g = Graphics.FromImage(b); 17 | g.Clear(Colour); 18 | g.DrawRectangle(Pens.Black, 0, 0, 15, 15); 19 | Image = b;*/ 20 | 21 | 22 | base.OnPaint(pevent); 23 | /*Rectangle rect = new Rectangle( 24 | COLOUR_MARGIN, 25 | COLOUR_MARGIN, 26 | Width - (COLOUR_MARGIN * 2) - 1, 27 | Height - (COLOUR_MARGIN * 2) - 1 28 | ); 29 | pevent.Graphics.FillRectangle(new SolidBrush(Colour), rect); 30 | pevent.Graphics.DrawRectangle(Pens.Black, rect);*/ 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DPIHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | internal static class DPIHelper 12 | { 13 | [DllImport("gdi32.dll")] 14 | static extern int GetDeviceCaps(IntPtr hdc, int nIndex); 15 | 16 | private enum DeviceCap 17 | { 18 | VERTRES = 10, 19 | LOGPIXELSY = 90, 20 | DESKTOPVERTRES = 117 21 | } 22 | 23 | internal static decimal GetScalingFactorPercent(IntPtr handle) 24 | { 25 | var g = Graphics.FromHwnd(handle); 26 | try 27 | { 28 | var desktop = g.GetHdc(); 29 | var LogicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.VERTRES); 30 | var PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES); 31 | var logpixelsy = GetDeviceCaps(desktop, (int)DeviceCap.LOGPIXELSY); 32 | var screenScalingFactor = PhysicalScreenHeight / (decimal)LogicalScreenHeight; 33 | var dpiScalingFactor = logpixelsy / 96.0M; 34 | 35 | return dpiScalingFactor; 36 | } 37 | finally 38 | { 39 | g?.ReleaseHdc(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeChangingForm.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace CapsLockIndicatorV3 3 | { 4 | partial class DarkModeChangingForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.SuspendLayout(); 34 | // 35 | // label1 36 | // 37 | this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 38 | this.label1.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.label1.Location = new System.Drawing.Point(0, 0); 40 | this.label1.Name = "label1"; 41 | this.label1.Size = new System.Drawing.Size(394, 144); 42 | this.label1.TabIndex = 0; 43 | this.label1.Text = "Adjusting color scheme... Please wait..."; 44 | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 45 | // 46 | // DarkModeChangingForm 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.ClientSize = new System.Drawing.Size(394, 144); 51 | this.ControlBox = false; 52 | this.Controls.Add(this.label1); 53 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 54 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 55 | this.MaximizeBox = false; 56 | this.MinimizeBox = false; 57 | this.Name = "DarkModeChangingForm"; 58 | this.ShowIcon = false; 59 | this.ShowInTaskbar = false; 60 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 61 | this.TopMost = true; 62 | this.UseWaitCursor = true; 63 | this.ResumeLayout(false); 64 | 65 | } 66 | 67 | #endregion 68 | 69 | private System.Windows.Forms.Label label1; 70 | } 71 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeChangingForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace CapsLockIndicatorV3 12 | { 13 | public partial class DarkModeChangingForm : Form 14 | { 15 | public DarkModeChangingForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | public static DarkModeChangingForm Show(IWin32Window owner, bool dark) 21 | { 22 | var f = new DarkModeChangingForm(); 23 | 24 | f.BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 25 | f.ForeColor = dark ? Color.White : SystemColors.WindowText; 26 | 27 | f.label1.Text = strings.adjustingColorScheme; 28 | 29 | f.Show(owner); 30 | 31 | return f; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeChangingForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public class DarkModeForm : Form 11 | { 12 | public event EventHandler DarkModeChanged; 13 | 14 | internal void OnDarkModeChanged() 15 | { 16 | DarkModeChanged?.Invoke(this, EventArgs.Empty); 17 | } 18 | 19 | protected void ControlScheduleSetDarkMode(Control control, bool isDark) 20 | { 21 | if (control.IsHandleCreated) 22 | Native.ControlSetDarkMode(control, isDark); 23 | else 24 | control.HandleCreated += (sender, e) => 25 | { 26 | Native.ControlSetDarkMode(control, isDark); 27 | }; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeListView.cs: -------------------------------------------------------------------------------- 1 | using CapsLockIndicatorV3; 2 | using System.Diagnostics; 3 | using System.Drawing; 4 | using System.Reflection; 5 | 6 | namespace System.Windows.Forms 7 | { 8 | public class DarkModeListView : ListView 9 | { 10 | private IntPtr headerPtr; 11 | private bool _headerPtr = false; 12 | public IntPtr HeaderHandle 13 | { 14 | get 15 | { 16 | if (!_headerPtr) 17 | headerPtr = Native.SendMessage(Handle, Native.LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero); 18 | _headerPtr = true; 19 | return headerPtr; 20 | } 21 | } 22 | 23 | private Color headerBackColor; 24 | private Color headerTextColor; 25 | 26 | public DarkModeListView() : base() 27 | { 28 | DoubleBuffered = true; 29 | 30 | OwnerDraw = true; 31 | } 32 | 33 | protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e) 34 | { 35 | var t = e.GetType(); 36 | t.GetField("backColor", BindingFlags.NonPublic).SetValue(e, headerBackColor); 37 | t.GetField("foreColor", BindingFlags.NonPublic).SetValue(e, headerTextColor); 38 | //e.DrawDefault = true; 39 | base.OnDrawColumnHeader(e); 40 | } 41 | 42 | protected override void OnDrawItem(DrawListViewItemEventArgs e) 43 | { 44 | e.DrawDefault = true; 45 | base.OnDrawItem(e); 46 | } 47 | 48 | public void SetDark(bool dark) 49 | { 50 | Native.AllowDarkModeForWindow(Handle, dark); 51 | Native.AllowDarkModeForWindow(HeaderHandle, dark); 52 | 53 | var theme = Native.OpenThemeData(IntPtr.Zero, "ItemsView"); 54 | if (theme != IntPtr.Zero) 55 | { 56 | Native.COLORREF color; 57 | if (Native.GetThemeColor(theme, 0, 0, Native.TMT_TEXTCOLOR, out color) >= 0) 58 | ForeColor = color.ToColor(); 59 | if (Native.GetThemeColor(theme, 0, 0, Native.TMT_FILLCOLOR, out color) >= 0) 60 | BackColor = color.ToColor(); 61 | 62 | Native.CloseThemeData(theme); 63 | } else 64 | { 65 | Debug.Assert(false, "Theme is nullptr"); 66 | } 67 | 68 | theme = Native.OpenThemeData(HeaderHandle, "Header"); 69 | if (theme != IntPtr.Zero) 70 | { 71 | Native.COLORREF color; 72 | if (Native.GetThemeColor(theme, Native.HP_HEADERITEM, 0, Native.TMT_TEXTCOLOR, out color) >= 0) 73 | headerTextColor = color.ToColor(); 74 | 75 | if (Native.GetThemeColor(theme, Native.HP_HEADERITEM, 0, Native.TMT_FILLCOLOR, out color) >= 0) 76 | headerBackColor = color.ToColor(); 77 | 78 | Native.CloseThemeData(theme); 79 | } 80 | 81 | Invalidate(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DarkModeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public static class DarkModeProvider 11 | { 12 | public static bool IsDark => SystemSupportsDarkMode && SettingsManager.Get("darkMode"); 13 | public static bool SystemSupportsDarkMode => Environment.OSVersion.Version.Major >= 10; 14 | 15 | private static List registeredForms = new List(); 16 | 17 | public static void RegisterForm(DarkModeForm form) 18 | { 19 | registeredForms.Add(form); 20 | form.FormClosing += Form_FormClosing; 21 | form.OnDarkModeChanged(); 22 | } 23 | 24 | public static void SetDarkModeEnabled(bool enabled) 25 | { 26 | SettingsManager.Set("darkMode", enabled); 27 | UpdateForms(); 28 | } 29 | 30 | private static void UpdateForms() 31 | { 32 | foreach (var f in registeredForms) 33 | f.OnDarkModeChanged(); 34 | } 35 | 36 | private static void Form_FormClosing(object sender, FormClosingEventArgs e) 37 | { 38 | registeredForms.Remove(sender as DarkModeForm); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DllInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CapsLockIndicatorV3 4 | { 5 | public struct DllInfo 6 | { 7 | public string Filepath; 8 | public string SHA1; 9 | public Version Version; 10 | 11 | public override string ToString() 12 | { 13 | return "DllInfo{" 14 | + "Filepath=" + Filepath + ";" 15 | + "SHA1=" + SHA1 + ";" 16 | + "Version=" + Version.ToString() + "}"; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DownloadDialog.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using System; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Net; 9 | using System.Reflection; 10 | using System.Threading; 11 | using System.Windows.Forms; 12 | 13 | namespace CapsLockIndicatorV3 14 | { 15 | public partial class DownloadDialog : DarkModeForm 16 | { 17 | public const string BAK_NAME = "~CapsLockIndicator.previousVersion.bak"; 18 | 19 | Stopwatch sw = new Stopwatch(); 20 | #if !DEBUG 21 | WebClient Client; 22 | string newPath; 23 | #endif 24 | 25 | public string DownloadURL; 26 | 27 | protected override void WndProc(ref Message message) 28 | { 29 | if (message.Msg == 0x0084) // WM_NCHITTEST 30 | message.Result = (IntPtr)1; 31 | else base.WndProc(ref message); 32 | } 33 | 34 | public DownloadDialog() 35 | { 36 | InitializeComponent(); 37 | 38 | HandleCreated += (sender, e) => 39 | { 40 | DarkModeChanged += DownloadDialog_DarkModeChanged; 41 | DarkModeProvider.RegisterForm(this); 42 | }; 43 | } 44 | 45 | private void DownloadDialog_DarkModeChanged(object sender, EventArgs e) 46 | { 47 | var dark = DarkModeProvider.IsDark; 48 | 49 | Native.UseImmersiveDarkModeColors(Handle, dark); 50 | 51 | statusLabel.ForeColor = 52 | infoLabel.ForeColor = 53 | ForeColor = 54 | dark ? Color.White : SystemColors.WindowText; 55 | 56 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 57 | 58 | ControlScheduleSetDarkMode(downloadProgress, dark); 59 | ControlScheduleSetDarkMode(restartButton, dark); 60 | ControlScheduleSetDarkMode(closeButton, dark); 61 | ControlScheduleSetDarkMode(cancelButton, dark); 62 | } 63 | 64 | public void Download(string url) 65 | { 66 | #if !DEBUG 67 | Uri uri = new Uri(url); 68 | string filename = Path.GetFileName(uri.LocalPath); 69 | string currentPath = Path.GetDirectoryName(Application.ExecutablePath); 70 | string path = Path.Combine(currentPath, filename); 71 | //string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Jonas_Kohl\" + filename); 72 | 73 | sw.Start(); 74 | 75 | Client = new WebClient(); 76 | Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback); 77 | Client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleteCallback); 78 | Client.DownloadFileAsync(new Uri(url), path); 79 | 80 | newPath = path; 81 | #endif 82 | } 83 | 84 | private void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e) 85 | { 86 | downloadProgress.Value = e.ProgressPercentage; 87 | 88 | infoLabel.Text = string.Format("Downloaded {0}/{1}KB ({2}%) @ {3} KB/s", (e.BytesReceived / 1024d).ToString("0.0"), (e.TotalBytesToReceive / 1024d).ToString("0.0"), e.ProgressPercentage, (e.BytesReceived / 1024d / sw.Elapsed.TotalSeconds).ToString("0.00")); 89 | } 90 | 91 | private void DownloadFileCompleteCallback(object sender, AsyncCompletedEventArgs e) 92 | { 93 | infoLabel.Text = ""; 94 | cancelButton.Hide(); 95 | cancelButton.Enabled = false; 96 | 97 | if (e.Cancelled == true) 98 | { 99 | closeButton.Show(); 100 | closeButton.Enabled = true; 101 | statusLabel.Text = "Download aborted."; 102 | downloadProgress.Value = 0; 103 | } 104 | else 105 | { 106 | restartButton.Show(); 107 | restartButton.Enabled = true; 108 | statusLabel.Text = "Download completed."; 109 | } 110 | } 111 | 112 | private void DownloadDialog_Load(object sender, EventArgs e) 113 | { 114 | Download(DownloadURL); 115 | } 116 | 117 | private void button1_Click(object sender, EventArgs e) 118 | { 119 | #if !DEBUG 120 | Client?.CancelAsync(); 121 | #endif 122 | } 123 | 124 | private void button2_Click(object sender, EventArgs e) 125 | { 126 | Close(); 127 | } 128 | 129 | private void restartButton_Click(object sender, EventArgs e) 130 | { 131 | #if !DEBUG 132 | if (SettingsManager.Get("dontOverwriteApplicationOnUpdate")) 133 | { 134 | bool runAtStarup = Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "CapsLock Indicator", null) != null; 135 | 136 | if (runAtStarup) 137 | { 138 | RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); 139 | rk.SetValue("CapsLock Indicator", newPath); 140 | } 141 | 142 | MainForm mainForm = Application.OpenForms.OfType().First(); 143 | 144 | mainForm.askCancel = false; 145 | Program.ReleaseMutex(); 146 | 147 | Thread.Sleep(100); 148 | 149 | Process.Start(newPath); 150 | Application.Exit(); 151 | } 152 | else 153 | { 154 | var currExe = Assembly.GetExecutingAssembly().Location; 155 | var currDir = Path.GetDirectoryName(currExe); 156 | var bakFile = Path.Combine(currDir, BAK_NAME); 157 | if (File.Exists(bakFile)) 158 | File.Delete(bakFile); 159 | File.Move(currExe, BAK_NAME); 160 | File.Move(newPath, currExe); 161 | 162 | Program.Restart(); 163 | } 164 | #endif 165 | } 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DownloadDialog.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/DropDownLocale.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CapsLockIndicatorV3 4 | { 5 | [Serializable] 6 | struct DropDownLocale 7 | { 8 | public string displayText; 9 | public string localeString; 10 | 11 | public DropDownLocale(string localeString) 12 | { 13 | displayText = localeString; 14 | this.localeString = localeString; 15 | } 16 | 17 | public DropDownLocale(string localeString, string displayText) 18 | { 19 | this.displayText = displayText; 20 | this.localeString = localeString; 21 | } 22 | 23 | public override string ToString() 24 | { 25 | return $"{displayText}"; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public static class ExtensionMethods 11 | { 12 | public static void Deconstruct(this IEnumerable list, out T first, out T second) 13 | { 14 | first = list.Count() > 0 ? list.ElementAt(0) : default(T); 15 | second = list.Count() > 1 ? list.ElementAt(1) : default(T); 16 | } 17 | 18 | public static void Deconstruct(this U list, out T first, out T second, out U rest) where U : IEnumerable 19 | { 20 | first = list.Count() > 0 ? list.ElementAt(0) : default(T); 21 | second = list.Count() > 1 ? list.ElementAt(1) : default(T); 22 | rest = (U)list.Skip(2); 23 | } 24 | 25 | /// Blends the specified colors together. 26 | /// Color to blend onto the background color. 27 | /// Color to blend the other color onto. 28 | /// How much of to keep, 29 | /// “on top of” . 30 | /// The blended colors. 31 | public static Color Blend(this Color color, Color backColor, double amount) 32 | { 33 | byte r = (byte)((color.R * amount) + backColor.R * (1 - amount)); 34 | byte g = (byte)((color.G * amount) + backColor.G * (1 - amount)); 35 | byte b = (byte)((color.B * amount) + backColor.B * (1 - amount)); 36 | return Color.FromArgb(r, g, b); 37 | } 38 | 39 | public static void Deconstruct(this T[] items, out T t0) 40 | { 41 | t0 = items.Length > 0 ? items[0] : default(T); 42 | } 43 | 44 | public static void Deconstruct(this T[] items, out T t0, out T t1) 45 | { 46 | t0 = items.Length > 0 ? items[0] : default(T); 47 | t1 = items.Length > 1 ? items[1] : default(T); 48 | } 49 | 50 | public static void Deconstruct(this T[] items, out T t0, out T t1, out T t2) 51 | { 52 | t0 = items.Length > 0 ? items[0] : default(T); 53 | t1 = items.Length > 1 ? items[1] : default(T); 54 | t2 = items.Length > 2 ? items[2] : default(T); 55 | } 56 | 57 | public static void Deconstruct(this T[] items, out T t0, out T t1, out T t2, out T t3) 58 | { 59 | t0 = items.Length > 0 ? items[0] : default(T); 60 | t1 = items.Length > 1 ? items[1] : default(T); 61 | t2 = items.Length > 2 ? items[2] : default(T); 62 | t3 = items.Length > 3 ? items[3] : default(T); 63 | } 64 | 65 | public static void Deconstruct(this T[] items, out T t0, out T t1, out T t2, out T t3, out T[] rest) 66 | { 67 | t0 = items.Length > 0 ? items[0] : default(T); 68 | t1 = items.Length > 1 ? items[1] : default(T); 69 | t2 = items.Length > 2 ? items[2] : default(T); 70 | t3 = items.Length > 3 ? items[3] : default(T); 71 | rest = items.Skip(4).ToArray(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/FirstRunDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Diagnostics; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Reflection; 9 | using System.Resources; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace CapsLockIndicatorV3 15 | { 16 | public partial class FirstRunDialog : DarkModeForm 17 | { 18 | ResourceManager resources; 19 | 20 | public FirstRunDialog() 21 | { 22 | InitializeComponent(); 23 | 24 | resources = new ResourceManager("CapsLockIndicatorV3.resources", Assembly.GetExecutingAssembly()); 25 | 26 | HandleCreated += FirstRunDialog_HandleCreated; 27 | 28 | FormClosing += FirstRunDialog_FormClosing; 29 | 30 | Shown += FirstRunDialog_Shown; 31 | 32 | ControlScheduleSetDarkMode(darkButton, true); 33 | 34 | headerLabel.Text = strings.firstRunHeading; 35 | messageLabel.Text = strings.firstRunMessage; 36 | allowUpdatesCheckBox.Text = strings.firstRunAllowUpdateCheck; 37 | lnkLabel1.Text = strings.firstRunPrivacyInfoLinkLabel; 38 | lnkLabel2.Text = strings.firstRunContribute; 39 | okButton.Text = strings.firstRunStart; 40 | exitButton.Text = strings.firstRunExit; 41 | themeLabel.Text = strings.firstRunColorSchemePreference; 42 | lightButton.Text = strings.firstRunColorSchemeLight; 43 | darkButton.Text = strings.firstRunColorSchemeDark; 44 | 45 | if (!DarkModeProvider.SystemSupportsDarkMode) 46 | { 47 | darkButton.Enabled = false; 48 | darkButton.Text += "\r\n" + strings.firstRunColorSchemeWin10Only; 49 | } 50 | } 51 | 52 | private void FirstRunDialog_Shown(object sender, EventArgs e) 53 | { 54 | Width = Width + 1; 55 | Height = Height + 1; 56 | } 57 | 58 | private void FirstRunDialog_FormClosing(object sender, FormClosingEventArgs e) 59 | { 60 | if (e.CloseReason == CloseReason.UserClosing) 61 | Program.keepFirstRunDialogOpen = false; 62 | } 63 | 64 | private void FirstRunDialog_HandleCreated(object sender, EventArgs e) 65 | { 66 | DarkModeProvider.RegisterForm(this); 67 | DarkModeChanged += FirstRunDialog_DarkModeChanged; 68 | } 69 | 70 | private void FirstRunDialog_DarkModeChanged(object sender, EventArgs e) 71 | { 72 | //RecreateHandle(); 73 | 74 | var dark = DarkModeProvider.IsDark; 75 | 76 | Native.UseImmersiveDarkModeColors(Handle, dark); 77 | 78 | Opacity -= 0.0001; 79 | Opacity += 0.0001; 80 | 81 | headerLabel.ForeColor = dark ? Color.White : Color.FromArgb(255, 0, 51, 153); 82 | 83 | Icon = (Icon)resources.GetObject("CLIv3_Icon" + (dark ? "_Dark" : "")); 84 | 85 | lnkLabel1.LinkColor = 86 | lnkLabel2.LinkColor = 87 | dark ? Color.White : SystemColors.HotTrack; 88 | 89 | messageLabel.ForeColor = 90 | allowUpdatesCheckBox.ForeColor = 91 | dark ? Color.White : SystemColors.WindowText; 92 | 93 | allowUpdatesCheckBox.DarkMode = dark; 94 | allowUpdatesCheckBox.FlatStyle = dark ? FlatStyle.Standard : FlatStyle.System; 95 | 96 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 97 | ForeColor = dark ? Color.White : SystemColors.WindowText; 98 | 99 | ControlScheduleSetDarkMode(okButton, dark); 100 | ControlScheduleSetDarkMode(exitButton, dark); 101 | } 102 | 103 | private void allowUpdatesCheckBox_CheckedChanged(object sender, EventArgs e) 104 | { 105 | SettingsManager.Set("checkForUpdates", allowUpdatesCheckBox.Checked); 106 | SettingsManager.Save(); 107 | } 108 | 109 | private void lnkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 110 | { 111 | Process.Start(URLs.KBUpdateCheck); 112 | } 113 | 114 | private void okButton_Click(object sender, EventArgs e) 115 | { 116 | Program.keepFirstRunDialogOpen = false; 117 | SettingsManager.Set("checkForUpdates", allowUpdatesCheckBox.Checked); 118 | SettingsManager.Save(); 119 | } 120 | 121 | private void lnkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 122 | { 123 | Process.Start(URLs.GithubRepo); 124 | } 125 | 126 | private void lightButton_Click(object sender, EventArgs e) 127 | { 128 | DarkModeProvider.SetDarkModeEnabled(false); 129 | } 130 | 131 | private void darkButton_Click(object sender, EventArgs e) 132 | { 133 | DarkModeProvider.SetDarkModeEnabled(true); 134 | } 135 | 136 | private void exitButton_Click(object sender, EventArgs e) 137 | { 138 | Program.keepFirstRunDialogOpen = false; 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/HelpWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CapsLockIndicatorV3 2 | { 3 | partial class HelpWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.messageTextBox = new System.Windows.Forms.RichTextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // messageTextBox 35 | // 36 | this.messageTextBox.BackColor = System.Drawing.SystemColors.Control; 37 | this.messageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; 38 | this.messageTextBox.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.messageTextBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 40 | this.messageTextBox.Location = new System.Drawing.Point(0, 0); 41 | this.messageTextBox.Name = "messageTextBox"; 42 | this.messageTextBox.ReadOnly = true; 43 | this.messageTextBox.Size = new System.Drawing.Size(553, 290); 44 | this.messageTextBox.TabIndex = 0; 45 | this.messageTextBox.Text = ""; 46 | this.messageTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.messageTextBox_LinkClicked); 47 | this.messageTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HelpWindow_KeyDown); 48 | // 49 | // HelpWindow 50 | // 51 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 52 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 53 | this.ClientSize = new System.Drawing.Size(553, 290); 54 | this.Controls.Add(this.messageTextBox); 55 | this.KeyPreview = true; 56 | this.MaximizeBox = false; 57 | this.MinimizeBox = false; 58 | this.Name = "HelpWindow"; 59 | this.ShowIcon = false; 60 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 61 | this.Text = "Help"; 62 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HelpWindow_KeyDown); 63 | this.ResumeLayout(false); 64 | 65 | } 66 | 67 | #endregion 68 | 69 | private System.Windows.Forms.RichTextBox messageTextBox; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/HelpWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Diagnostics; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace CapsLockIndicatorV3 13 | { 14 | public partial class HelpWindow : Form 15 | { 16 | public HelpWindow() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | public HelpWindow(string Message) 22 | { 23 | InitializeComponent(); 24 | messageTextBox.Text = Message; 25 | } 26 | 27 | private void messageTextBox_LinkClicked(object sender, LinkClickedEventArgs e) 28 | { 29 | Process.Start(e.LinkText); 30 | } 31 | 32 | private void HelpWindow_KeyDown(object sender, KeyEventArgs e) 33 | { 34 | if (e.KeyCode == Keys.Escape) 35 | { 36 | e.Handled = true; 37 | e.SuppressKeyPress = true; 38 | Close(); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/HelpWindow.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IconExtractor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | public class IconExtractor 12 | { 13 | [DllImport("User32.dll")] 14 | private extern static int PrivateExtractIcons(string libraryName, int iconIndex, int iconWidth, int iconHeight, out IntPtr iconHandles, out IntPtr iconID, int numberIcons, IntPtr flags); 15 | 16 | public static Icon GetIcon(string libraryName, int iconIndex, int size) 17 | { 18 | PrivateExtractIcons(libraryName, iconIndex, size, size, out IntPtr iconHandle, out IntPtr iconID, 1, IntPtr.Zero); 19 | if (iconHandle != IntPtr.Zero) 20 | return Icon.FromHandle(iconHandle); 21 | return null; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IconGalleryObjectForScripting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | [ComVisible(true)] 12 | public class IconGalleryObjectForScripting 13 | { 14 | internal event EventHandler OnDownloadRequested; 15 | internal event EventHandler OnCloseWindowRequested; 16 | 17 | public void downloadPack(string id) 18 | { 19 | OnDownloadRequested?.Invoke(this, id); 20 | } 21 | 22 | public void openExternalLink(string url) 23 | { 24 | if (!url.StartsWith("http://") && !url.StartsWith("https://")) // unsafe url 25 | return; 26 | 27 | Process.Start(url); 28 | } 29 | 30 | public void closeWindow() 31 | { 32 | OnCloseWindowRequested?.Invoke(this, EventArgs.Empty); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IconPackBrowser.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace CapsLockIndicatorV3 3 | { 4 | partial class IconPackBrowser 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.webBrowser1 = new System.Windows.Forms.WebBrowser(); 33 | this.SuspendLayout(); 34 | // 35 | // webBrowser1 36 | // 37 | this.webBrowser1.AllowWebBrowserDrop = false; 38 | this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.webBrowser1.IsWebBrowserContextMenuEnabled = false; 40 | this.webBrowser1.Location = new System.Drawing.Point(0, 0); 41 | this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); 42 | this.webBrowser1.Name = "webBrowser1"; 43 | this.webBrowser1.ScriptErrorsSuppressed = true; 44 | this.webBrowser1.Size = new System.Drawing.Size(440, 352); 45 | this.webBrowser1.TabIndex = 0; 46 | this.webBrowser1.WebBrowserShortcutsEnabled = false; 47 | // 48 | // IconPackBrowser 49 | // 50 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 51 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 52 | this.ClientSize = new System.Drawing.Size(440, 352); 53 | this.Controls.Add(this.webBrowser1); 54 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 55 | this.MaximizeBox = false; 56 | this.MinimizeBox = false; 57 | this.Name = "IconPackBrowser"; 58 | this.ShowIcon = false; 59 | this.ShowInTaskbar = false; 60 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 61 | this.Text = "Download icon packs"; 62 | this.ResumeLayout(false); 63 | 64 | } 65 | 66 | #endregion 67 | 68 | private System.Windows.Forms.WebBrowser webBrowser1; 69 | } 70 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IconPackBrowser.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IndicatorDisplayPosition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CapsLockIndicatorV3 8 | { 9 | public enum IndicatorDisplayPosition 10 | { 11 | TopLeft, 12 | TopCenter, 13 | TopRight, 14 | MiddleLeft, 15 | MiddleCenter, 16 | MiddleRight, 17 | BottomLeft, 18 | BottomCenter, 19 | BottomRight 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IndicatorOverlay.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created 09.07.2017 20:22 3 | * 4 | * Copyright (c) Jonas Kohl 5 | */ 6 | namespace CapsLockIndicatorV3 7 | { 8 | partial class IndicatorOverlay 9 | { 10 | /// 11 | /// Designer variable used to keep track of non-visual components. 12 | /// 13 | private System.ComponentModel.IContainer components = null; 14 | private System.Windows.Forms.Timer windowCloseTimer; 15 | private System.Windows.Forms.Label contentLabel; 16 | 17 | /// 18 | /// Disposes resources used by the form. 19 | /// 20 | /// true if managed resources should be disposed; otherwise, false. 21 | protected override void Dispose(bool disposing) 22 | { 23 | if (disposing) { 24 | if (components != null) { 25 | components.Dispose(); 26 | } 27 | } 28 | base.Dispose(disposing); 29 | } 30 | 31 | /// 32 | /// This method is required for Windows Forms designer support. 33 | /// Do not change the method contents inside the source code editor. The Forms designer might 34 | /// not be able to load this method if it was changed manually. 35 | /// 36 | private void InitializeComponent() 37 | { 38 | this.components = new System.ComponentModel.Container(); 39 | this.windowCloseTimer = new System.Windows.Forms.Timer(this.components); 40 | this.contentLabel = new System.Windows.Forms.Label(); 41 | this.fadeTimer = new System.Windows.Forms.Timer(this.components); 42 | this.positionUpdateTimer = new System.Windows.Forms.Timer(this.components); 43 | this.SuspendLayout(); 44 | // 45 | // windowCloseTimer 46 | // 47 | this.windowCloseTimer.Enabled = true; 48 | this.windowCloseTimer.Tick += new System.EventHandler(this.WindowCloseTimerTick); 49 | // 50 | // contentLabel 51 | // 52 | this.contentLabel.Location = new System.Drawing.Point(0, 0); 53 | this.contentLabel.Name = "contentLabel"; 54 | this.contentLabel.Size = new System.Drawing.Size(0, 0); 55 | this.contentLabel.TabIndex = 0; 56 | this.contentLabel.Text = "{{{contentLabel}}"; 57 | this.contentLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 58 | this.contentLabel.Visible = false; 59 | // 60 | // fadeTimer 61 | // 62 | this.fadeTimer.Enabled = true; 63 | this.fadeTimer.Interval = 25; 64 | this.fadeTimer.Tick += new System.EventHandler(this.fadeTimer_Tick); 65 | // 66 | // positionUpdateTimer 67 | // 68 | this.positionUpdateTimer.Enabled = true; 69 | this.positionUpdateTimer.Tick += new System.EventHandler(this.positionUpdateTimer_Tick); 70 | // 71 | // IndicatorOverlay 72 | // 73 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 75 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(66)))), ((int)(((byte)(66))))); 76 | this.ClientSize = new System.Drawing.Size(176, 42); 77 | this.ControlBox = false; 78 | this.Controls.Add(this.contentLabel); 79 | this.Font = new System.Drawing.Font("Segoe UI", 12F); 80 | this.ForeColor = System.Drawing.Color.White; 81 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 82 | this.MaximizeBox = false; 83 | this.MinimizeBox = false; 84 | this.Name = "IndicatorOverlay"; 85 | this.Padding = new System.Windows.Forms.Padding(16, 8, 16, 8); 86 | this.ShowIcon = false; 87 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; 88 | this.Text = "IndicatorOverlay"; 89 | this.ResumeLayout(false); 90 | 91 | } 92 | 93 | private System.Windows.Forms.Timer fadeTimer; 94 | private System.Windows.Forms.Timer positionUpdateTimer; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/IndicatorTrigger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CapsLockIndicatorV3 8 | { 9 | public struct IndicatorTrigger 10 | { 11 | public IndicatorKey Key; 12 | public bool NewState; 13 | public string DisplayText; 14 | 15 | public static bool ShowInfinite(IndicatorTrigger trigger) 16 | { 17 | if (trigger.Key == IndicatorKey.None) 18 | return false; 19 | 20 | var keyName = "persistentOverlay" + trigger.Key.ToString() + (trigger.NewState ? "On" : "Off"); 21 | return SettingsManager.Get(keyName); 22 | } 23 | } 24 | 25 | public enum IndicatorKey 26 | { 27 | None, 28 | Caps, 29 | Num, 30 | Scroll 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/KeyHelper.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created 09.07.2017 18:25 3 | * 4 | * Copyright (c) Jonas Kohl 5 | */ 6 | using System; 7 | using System.Windows.Forms; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | /// 12 | /// A helper class for accessing the state of Caps/Num/Scroll lock 13 | /// 14 | public static class KeyHelper 15 | { 16 | /// 17 | /// This property indicates if num lock is active. 18 | /// 19 | public static bool isNumlockActive 20 | { 21 | get 22 | { 23 | return Control.IsKeyLocked(Keys.NumLock); 24 | } 25 | } 26 | 27 | /// 28 | /// This property indicates if caps lock is active. 29 | /// 30 | public static bool isCapslockActive 31 | { 32 | get 33 | { 34 | return Control.IsKeyLocked(Keys.CapsLock); 35 | } 36 | } 37 | 38 | /// 39 | /// This property indicates if scroll lock is active. 40 | /// 41 | public static bool isScrolllockActive 42 | { 43 | get 44 | { 45 | return Control.IsKeyLocked(Keys.Scroll); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LanguageDownloadProgressForm.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace CapsLockIndicatorV3 3 | { 4 | partial class LanguageDownloadProgressForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 33 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 34 | this.panel1 = new System.Windows.Forms.Panel(); 35 | this.button1 = new System.Windows.Forms.Button(); 36 | this.tableLayoutPanel1.SuspendLayout(); 37 | this.SuspendLayout(); 38 | // 39 | // tableLayoutPanel1 40 | // 41 | this.tableLayoutPanel1.ColumnCount = 2; 42 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 43 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 44 | this.tableLayoutPanel1.Controls.Add(this.progressBar1, 0, 0); 45 | this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 1); 46 | this.tableLayoutPanel1.Controls.Add(this.button1, 1, 2); 47 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 48 | this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 9); 49 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 50 | this.tableLayoutPanel1.RowCount = 3; 51 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F)); 52 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 53 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F)); 54 | this.tableLayoutPanel1.Size = new System.Drawing.Size(563, 258); 55 | this.tableLayoutPanel1.TabIndex = 0; 56 | // 57 | // progressBar1 58 | // 59 | this.tableLayoutPanel1.SetColumnSpan(this.progressBar1, 2); 60 | this.progressBar1.Dock = System.Windows.Forms.DockStyle.Fill; 61 | this.progressBar1.Location = new System.Drawing.Point(3, 3); 62 | this.progressBar1.Name = "progressBar1"; 63 | this.progressBar1.Size = new System.Drawing.Size(557, 16); 64 | this.progressBar1.TabIndex = 0; 65 | // 66 | // panel1 67 | // 68 | this.panel1.AutoScroll = true; 69 | this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 70 | this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2); 71 | this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; 72 | this.panel1.Location = new System.Drawing.Point(9, 31); 73 | this.panel1.Margin = new System.Windows.Forms.Padding(9); 74 | this.panel1.Name = "panel1"; 75 | this.panel1.Size = new System.Drawing.Size(545, 189); 76 | this.panel1.TabIndex = 1; 77 | // 78 | // button1 79 | // 80 | this.button1.Anchor = System.Windows.Forms.AnchorStyles.Right; 81 | this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; 82 | this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System; 83 | this.button1.Location = new System.Drawing.Point(470, 232); 84 | this.button1.Name = "button1"; 85 | this.button1.Size = new System.Drawing.Size(90, 23); 86 | this.button1.TabIndex = 2; 87 | this.button1.Text = "close"; 88 | this.button1.UseVisualStyleBackColor = true; 89 | this.button1.Click += new System.EventHandler(this.button1_Click); 90 | // 91 | // LanguageDownloadProgressForm 92 | // 93 | this.AcceptButton = this.button1; 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 96 | this.CancelButton = this.button1; 97 | this.ClientSize = new System.Drawing.Size(581, 276); 98 | this.Controls.Add(this.tableLayoutPanel1); 99 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 100 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 101 | this.MaximizeBox = false; 102 | this.MinimizeBox = false; 103 | this.Name = "LanguageDownloadProgressForm"; 104 | this.Padding = new System.Windows.Forms.Padding(9); 105 | this.ShowIcon = false; 106 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 107 | this.Text = "value"; 108 | this.tableLayoutPanel1.ResumeLayout(false); 109 | this.ResumeLayout(false); 110 | 111 | } 112 | 113 | #endregion 114 | 115 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 116 | private System.Windows.Forms.ProgressBar progressBar1; 117 | private System.Windows.Forms.Panel panel1; 118 | private System.Windows.Forms.Button button1; 119 | } 120 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LanguageDownloadProgressForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LanguageProgressRow.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace CapsLockIndicatorV3 3 | { 4 | partial class LanguageProgressRow 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Component Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.components = new System.ComponentModel.Container(); 33 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 36 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 37 | this.betterToolTip1 = new CapsLockIndicatorV3.BetterToolTip(this.components); 38 | this.tableLayoutPanel1.SuspendLayout(); 39 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // tableLayoutPanel1 43 | // 44 | this.tableLayoutPanel1.ColumnCount = 3; 45 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 46 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F)); 47 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 165F)); 48 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); 49 | this.tableLayoutPanel1.Controls.Add(this.progressBar1, 2, 0); 50 | this.tableLayoutPanel1.Controls.Add(this.pictureBox1, 1, 0); 51 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 52 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 53 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 54 | this.tableLayoutPanel1.RowCount = 1; 55 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 56 | this.tableLayoutPanel1.Size = new System.Drawing.Size(841, 22); 57 | this.tableLayoutPanel1.TabIndex = 0; 58 | // 59 | // label1 60 | // 61 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; 62 | this.label1.AutoSize = true; 63 | this.label1.Location = new System.Drawing.Point(3, 4); 64 | this.label1.Name = "label1"; 65 | this.label1.Size = new System.Drawing.Size(0, 13); 66 | this.label1.TabIndex = 0; 67 | // 68 | // progressBar1 69 | // 70 | this.progressBar1.Dock = System.Windows.Forms.DockStyle.Fill; 71 | this.progressBar1.Location = new System.Drawing.Point(679, 3); 72 | this.progressBar1.MarqueeAnimationSpeed = 25; 73 | this.progressBar1.Name = "progressBar1"; 74 | this.progressBar1.Size = new System.Drawing.Size(159, 16); 75 | this.progressBar1.TabIndex = 1; 76 | // 77 | // pictureBox1 78 | // 79 | this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.Right; 80 | this.pictureBox1.Location = new System.Drawing.Point(660, 3); 81 | this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); 82 | this.pictureBox1.Name = "pictureBox1"; 83 | this.pictureBox1.Size = new System.Drawing.Size(16, 16); 84 | this.pictureBox1.TabIndex = 2; 85 | this.pictureBox1.TabStop = false; 86 | // 87 | // LanguageProgressRow 88 | // 89 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 90 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 91 | this.Controls.Add(this.tableLayoutPanel1); 92 | this.Name = "LanguageProgressRow"; 93 | this.Size = new System.Drawing.Size(841, 22); 94 | this.tableLayoutPanel1.ResumeLayout(false); 95 | this.tableLayoutPanel1.PerformLayout(); 96 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 97 | this.ResumeLayout(false); 98 | 99 | } 100 | 101 | #endregion 102 | 103 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 104 | private System.Windows.Forms.Label label1; 105 | private System.Windows.Forms.ProgressBar progressBar1; 106 | private System.Windows.Forms.PictureBox pictureBox1; 107 | private BetterToolTip betterToolTip1; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LanguageProgressRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace CapsLockIndicatorV3 12 | { 13 | public partial class LanguageProgressRow : UserControl 14 | { 15 | public new string Text 16 | { 17 | get => label1.Text; 18 | set => label1.Text = value; 19 | } 20 | 21 | public int Minimum 22 | { 23 | get => progressBar1.Minimum; 24 | set => progressBar1.Minimum = value; 25 | } 26 | 27 | public int Maximum 28 | { 29 | get => progressBar1.Maximum; 30 | set => progressBar1.Maximum = value; 31 | } 32 | 33 | public int Value 34 | { 35 | get => progressBar1.Value; 36 | set => progressBar1.Value = value; 37 | } 38 | 39 | public ProgressBarStyle Style 40 | { 41 | get => progressBar1.Style; 42 | set => progressBar1.Style = value; 43 | } 44 | 45 | public ProgressBar ProgressBar => progressBar1; 46 | public BetterToolTip ToolTip => betterToolTip1; 47 | 48 | public LanguageProgressRow() 49 | { 50 | InitializeComponent(); 51 | } 52 | 53 | public void SetError(bool error, string errorMessage = null) 54 | { 55 | Native.SetProgressBarState(progressBar1, error ? ProgressBarState.Error : ProgressBarState.Normal); 56 | pictureBox1.Image = error ? ( 57 | SysIcons.GetSystemIcon(SysIcons.SHSTOCKICONID.SIID_ERROR, SysIcons.IconSize.Small).ToBitmap() 58 | ) : null; 59 | betterToolTip1.SetToolTip(pictureBox1, 60 | ( 61 | (error ? strings.failedToDownloadTranslationToolTip : "") 62 | + (errorMessage == null ? "" : ("\n" + errorMessage)) 63 | ).Trim() 64 | ); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LanguageProgressRow.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LnComboBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace CapsLockIndicatorV3 11 | { 12 | public class LnComboBox : ComboBox 13 | { 14 | private readonly Color Dark_ItemBg_Normal = Color.FromArgb(56, 56, 56); 15 | private readonly Color Dark_ItemBg_Selected = SystemColors.Highlight; 16 | private readonly Color Dark_ItemFg_Normal = Color.White; 17 | private readonly Color Dark_ItemFg_Selected = SystemColors.HighlightText; 18 | private readonly Color Dark_Background_Normal = Color.FromArgb(51, 51, 51); 19 | private readonly Color Dark_Border_Normal = Color.FromArgb(155, 155, 155); 20 | private readonly Color Dark_Background_Hot = Color.FromArgb(69, 69, 69); 21 | private readonly Color Dark_Border_Hot = Color.FromArgb(155, 155, 155); 22 | private readonly Color Dark_Background_Pressed = Color.FromArgb(102, 102, 102); 23 | private readonly Color Dark_Border_Pressed = Color.FromArgb(155, 155, 155); 24 | 25 | private int prevIndex = -1; 26 | 27 | private bool _darkMode; 28 | 29 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)] 30 | public bool DarkMode 31 | { 32 | get => _darkMode; 33 | set 34 | { 35 | _darkMode = value; 36 | Invalidate(); 37 | } 38 | } 39 | 40 | public LnComboBox() 41 | { 42 | DrawMode = DrawMode.OwnerDrawFixed; 43 | DoubleBuffered = true; 44 | } 45 | 46 | protected override void OnSelectedIndexChanged(EventArgs e) 47 | { 48 | if (SelectedIndex >= 0 && SelectedIndex < Items.Count) 49 | { 50 | var item = Items[SelectedIndex]; 51 | var args = new ListControlConvertEventArgs(item, item.GetType(), item); 52 | OnFormat(args); 53 | 54 | if (args.Value.ToString() == "--LINE--") 55 | { 56 | SelectedIndex = prevIndex; 57 | } 58 | else 59 | { 60 | base.OnSelectedIndexChanged(e); 61 | prevIndex = SelectedIndex; 62 | } 63 | } 64 | } 65 | 66 | protected override void OnDrawItem(DrawItemEventArgs e) 67 | { 68 | e.DrawBackground(); 69 | if (e.State == DrawItemState.Focus) 70 | e.DrawFocusRectangle(); 71 | 72 | if (e.Index >= 0 && e.Index < Items.Count) 73 | { 74 | var item = Items[e.Index]; 75 | var args = new ListControlConvertEventArgs(item, item.GetType(), item); 76 | OnFormat(args); 77 | 78 | if (args.Value.ToString() == "--LINE--") 79 | { 80 | using (var brush = new SolidBrush(_darkMode ? Dark_ItemBg_Normal : BackColor)) 81 | e.Graphics.FillRectangle(brush, e.Bounds); 82 | e.Graphics.DrawLine(SystemPens.GrayText, e.Bounds.X, e.Bounds.Top + e.Bounds.Height / 2, e.Bounds.Right, e.Bounds.Top + e.Bounds.Height / 2); 83 | } 84 | else 85 | { 86 | var bg = _darkMode ? ( 87 | e.State.HasFlag(DrawItemState.Selected) ? 88 | Dark_ItemBg_Selected : 89 | Dark_ItemBg_Normal 90 | ) : ( 91 | e.State.HasFlag(DrawItemState.Selected) ? 92 | SystemColors.Highlight : 93 | BackColor 94 | ); 95 | var fg = _darkMode ? ( 96 | e.State.HasFlag(DrawItemState.Selected) ? 97 | Dark_ItemFg_Selected : 98 | Dark_ItemFg_Normal 99 | ) : ( 100 | e.State.HasFlag(DrawItemState.Selected) ? 101 | SystemColors.HighlightText : 102 | ForeColor 103 | ); 104 | 105 | using (var brush = new SolidBrush(bg)) 106 | e.Graphics.FillRectangle(brush, e.Bounds); 107 | 108 | using (var brush = new SolidBrush(fg)) 109 | e.Graphics.DrawString(args.Value.ToString(), e.Font, brush, e.Bounds); 110 | } 111 | } 112 | 113 | base.OnDrawItem(e); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/LnkLabel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | public class LnkLabel : LinkLabel 12 | { 13 | //const int WM_SETCURSOR = 32, 14 | // IDC_HAND = 32649; 15 | 16 | //private int handCursor; 17 | 18 | //[DllImport("user32.dll")] 19 | //public static extern int LoadCursor(int hInstance, int lpCursorName); 20 | 21 | //[DllImport("user32.dll")] 22 | //public static extern int SetCursor(int hCursor); 23 | 24 | //public LnkLabel() : base() 25 | //{ 26 | // handCursor = LoadCursor(0, IDC_HAND); 27 | //} 28 | 29 | //protected override void WndProc(ref Message m) 30 | //{ 31 | // if (m.Msg == WM_SETCURSOR) 32 | // { 33 | // SetCursor(handCursor); 34 | 35 | // m.Result = IntPtr.Zero; // Handled 36 | 37 | // return; 38 | // } 39 | 40 | // base.WndProc(ref m); 41 | //} 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/NumberInputDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CapsLockIndicatorV3 2 | { 3 | partial class NumberInputDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.inputTextBox = new System.Windows.Forms.TextBox(); 32 | this.okButton = new System.Windows.Forms.Button(); 33 | this.cancelButton = new System.Windows.Forms.Button(); 34 | this.SuspendLayout(); 35 | // 36 | // inputTextBox 37 | // 38 | this.inputTextBox.Location = new System.Drawing.Point(0, 0); 39 | this.inputTextBox.Name = "inputTextBox"; 40 | this.inputTextBox.Size = new System.Drawing.Size(99, 23); 41 | this.inputTextBox.TabIndex = 0; 42 | // 43 | // okButton 44 | // 45 | this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System; 46 | this.okButton.Location = new System.Drawing.Point(105, 0); 47 | this.okButton.Name = "okButton"; 48 | this.okButton.Size = new System.Drawing.Size(39, 23); 49 | this.okButton.TabIndex = 1; 50 | this.okButton.Text = "OK"; 51 | this.okButton.UseVisualStyleBackColor = true; 52 | this.okButton.Click += new System.EventHandler(this.button1_Click); 53 | // 54 | // cancelButton 55 | // 56 | this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 57 | this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System; 58 | this.cancelButton.Location = new System.Drawing.Point(-53, 0); 59 | this.cancelButton.Name = "cancelButton"; 60 | this.cancelButton.Size = new System.Drawing.Size(39, 23); 61 | this.cancelButton.TabIndex = 2; 62 | this.cancelButton.TabStop = false; 63 | this.cancelButton.UseVisualStyleBackColor = true; 64 | // 65 | // NumberInputDialog 66 | // 67 | this.AcceptButton = this.okButton; 68 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 70 | this.BackColor = System.Drawing.SystemColors.Window; 71 | this.CancelButton = this.cancelButton; 72 | this.ClientSize = new System.Drawing.Size(143, 23); 73 | this.ControlBox = false; 74 | this.Controls.Add(this.cancelButton); 75 | this.Controls.Add(this.okButton); 76 | this.Controls.Add(this.inputTextBox); 77 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 78 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 79 | this.MaximizeBox = false; 80 | this.MinimizeBox = false; 81 | this.Name = "NumberInputDialog"; 82 | this.ShowIcon = false; 83 | this.ShowInTaskbar = false; 84 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 85 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 86 | this.Load += new System.EventHandler(this.NumberInputDialog_Load); 87 | this.ResumeLayout(false); 88 | this.PerformLayout(); 89 | 90 | } 91 | 92 | #endregion 93 | 94 | private System.Windows.Forms.TextBox inputTextBox; 95 | private System.Windows.Forms.Button okButton; 96 | private System.Windows.Forms.Button cancelButton; 97 | } 98 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/NumberInputDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CapsLockIndicatorV3 11 | { 12 | public partial class NumberInputDialog : DarkModeForm 13 | { 14 | protected override void WndProc(ref Message message) 15 | { 16 | if (message.Msg == 0x0084) // WM_NCHITTEST 17 | message.Result = (IntPtr)1; 18 | else base.WndProc(ref message); 19 | } 20 | 21 | int min; 22 | int max; 23 | 24 | public int Value; 25 | 26 | public NumberInputDialog(int defaultValue, int minValue, int maxValue) 27 | { 28 | InitializeComponent(); 29 | min = minValue; 30 | max = maxValue; 31 | inputTextBox.Text = defaultValue.ToString(); 32 | 33 | HandleCreated += (sender, e) => 34 | { 35 | DarkModeChanged += NumberInputDialog_DarkModeChanged; 36 | DarkModeProvider.RegisterForm(this); 37 | }; 38 | } 39 | 40 | private void NumberInputDialog_DarkModeChanged(object sender, EventArgs e) 41 | { 42 | var dark = DarkModeProvider.IsDark; 43 | 44 | Native.UseImmersiveDarkModeColors(Handle, dark); 45 | 46 | ForeColor = 47 | inputTextBox.ForeColor = dark ? Color.White : SystemColors.WindowText; 48 | 49 | inputTextBox.BackColor = dark ? Color.FromArgb(255, 56, 56, 56) : SystemColors.Window; 50 | inputTextBox.BorderStyle = dark ? BorderStyle.FixedSingle : BorderStyle.Fixed3D; 51 | 52 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 53 | 54 | ControlScheduleSetDarkMode(inputTextBox, dark); 55 | ControlScheduleSetDarkMode(okButton, dark); 56 | } 57 | 58 | private void button1_Click(object sender, EventArgs e) 59 | { 60 | int res; 61 | if (int.TryParse(inputTextBox.Text, out res)) 62 | { 63 | if (res >= min && res <= max) 64 | { 65 | Value = res; 66 | DialogResult = DialogResult.OK; 67 | Close(); 68 | } 69 | else 70 | { 71 | MessageBox.Show(string.Format("Please enter a number with the range [{0}; {1}]!", min, max)); 72 | } 73 | } 74 | else 75 | { 76 | MessageBox.Show("Please enter a number!"); 77 | } 78 | } 79 | 80 | private void NumberInputDialog_Load(object sender, EventArgs e) 81 | { 82 | 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/NumberInputDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/PaddingInputDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CapsLockIndicatorV3 11 | { 12 | public partial class PaddingInputDialog : DarkModeForm 13 | { 14 | private Color controlBackColor; 15 | 16 | protected override void WndProc(ref Message message) 17 | { 18 | if (message.Msg == 0x0084) // WM_NCHITTEST 19 | message.Result = (IntPtr)1; 20 | else base.WndProc(ref message); 21 | } 22 | 23 | public Padding Value => new Padding( 24 | (int)numericUpDownLeft.Value, 25 | (int)numericUpDownTop.Value, 26 | (int)numericUpDownRight.Value, 27 | (int)numericUpDownBottom.Value 28 | ); 29 | 30 | public PaddingInputDialog(Padding defaultValue) 31 | { 32 | InitializeComponent(); 33 | numericUpDownLeft.Maximum = 34 | numericUpDownTop.Maximum = 35 | numericUpDownRight.Maximum = 36 | numericUpDownBottom.Maximum = int.MaxValue; 37 | 38 | numericUpDownLeft.Value = defaultValue.Left; 39 | numericUpDownTop.Value = defaultValue.Top; 40 | numericUpDownRight.Value = defaultValue.Right; 41 | numericUpDownBottom.Value = defaultValue.Bottom; 42 | 43 | HandleCreated += (sender, e) => 44 | { 45 | DarkModeChanged += TextInputDialog_DarkModeChanged; 46 | DarkModeProvider.RegisterForm(this); 47 | }; 48 | } 49 | 50 | private void TextInputDialog_DarkModeChanged(object sender, EventArgs e) 51 | { 52 | var dark = DarkModeProvider.IsDark; 53 | 54 | Native.UseImmersiveDarkModeColors(Handle, dark); 55 | 56 | ForeColor = 57 | numericUpDownLeft.ForeColor = 58 | numericUpDownTop.ForeColor = 59 | numericUpDownRight.ForeColor = 60 | numericUpDownBottom.ForeColor = 61 | dark ? Color.White : SystemColors.WindowText; 62 | 63 | 64 | numericUpDownLeft.BackColor = 65 | numericUpDownTop.BackColor = 66 | numericUpDownRight.BackColor = 67 | numericUpDownBottom.BackColor = 68 | controlBackColor = 69 | dark ? Color.FromArgb(255, 56, 56, 56) : SystemColors.Window; 70 | 71 | numericUpDownLeft.BorderStyle = 72 | numericUpDownTop.BorderStyle = 73 | numericUpDownRight.BorderStyle = 74 | numericUpDownBottom.BorderStyle = 75 | dark ? BorderStyle.FixedSingle : BorderStyle.Fixed3D; 76 | 77 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 78 | 79 | ControlScheduleSetDarkMode(numericUpDownLeft, dark); 80 | ControlScheduleSetDarkMode(numericUpDownTop, dark); 81 | ControlScheduleSetDarkMode(numericUpDownRight, dark); 82 | ControlScheduleSetDarkMode(numericUpDownBottom, dark); 83 | ControlScheduleSetDarkMode(okButton, dark); 84 | } 85 | 86 | private void button1_Click(object sender, EventArgs e) 87 | { 88 | DialogResult = DialogResult.OK; 89 | Close(); 90 | } 91 | 92 | private void centerControl_Paint(object sender, PaintEventArgs e) 93 | { 94 | //ControlPaint.DrawBorder3D(e.Graphics, new Rectangle(Point.Empty, centerControl.Size)); 95 | //ButtonRenderer.DrawButton(e.Graphics, new Rectangle(Point.Empty, centerControl.Size), ) 96 | //ControlPaint.DrawButton(e.Graphics, new Rectangle(Point.Empty, centerControl.Size), ButtonState.Normal); 97 | ControlPaint.DrawBorder(e.Graphics, new Rectangle(Point.Empty, centerControl.Size), controlBackColor, ButtonBorderStyle.Outset); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/PaddingInputDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ProgressDialog.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace CapsLockIndicatorV3 3 | { 4 | partial class ProgressDialog 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 33 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.tableLayoutPanel1.SuspendLayout(); 36 | this.SuspendLayout(); 37 | // 38 | // tableLayoutPanel1 39 | // 40 | this.tableLayoutPanel1.ColumnCount = 1; 41 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 42 | this.tableLayoutPanel1.Controls.Add(this.progressBar1, 0, 0); 43 | this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1); 44 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 45 | this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 9); 46 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 47 | this.tableLayoutPanel1.RowCount = 2; 48 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 49 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); 50 | this.tableLayoutPanel1.Size = new System.Drawing.Size(376, 73); 51 | this.tableLayoutPanel1.TabIndex = 0; 52 | // 53 | // progressBar1 54 | // 55 | this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 56 | this.progressBar1.Location = new System.Drawing.Point(3, 10); 57 | this.progressBar1.MarqueeAnimationSpeed = 25; 58 | this.progressBar1.Name = "progressBar1"; 59 | this.progressBar1.Size = new System.Drawing.Size(370, 23); 60 | this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 61 | this.progressBar1.TabIndex = 0; 62 | // 63 | // label1 64 | // 65 | this.label1.AutoSize = true; 66 | this.label1.Location = new System.Drawing.Point(3, 43); 67 | this.label1.Name = "label1"; 68 | this.label1.Size = new System.Drawing.Size(0, 15); 69 | this.label1.TabIndex = 1; 70 | // 71 | // ProgressDialog 72 | // 73 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 75 | this.BackColor = System.Drawing.SystemColors.Window; 76 | this.ClientSize = new System.Drawing.Size(394, 91); 77 | this.ControlBox = false; 78 | this.Controls.Add(this.tableLayoutPanel1); 79 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 80 | this.ForeColor = System.Drawing.SystemColors.WindowText; 81 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 82 | this.MaximizeBox = false; 83 | this.MinimizeBox = false; 84 | this.Name = "ProgressDialog"; 85 | this.Padding = new System.Windows.Forms.Padding(9); 86 | this.ShowIcon = false; 87 | this.ShowInTaskbar = false; 88 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 89 | this.Text = " "; 90 | this.tableLayoutPanel1.ResumeLayout(false); 91 | this.tableLayoutPanel1.PerformLayout(); 92 | this.ResumeLayout(false); 93 | 94 | } 95 | 96 | #endregion 97 | 98 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 99 | private System.Windows.Forms.ProgressBar progressBar1; 100 | private System.Windows.Forms.Label label1; 101 | } 102 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ProgressDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Runtime.InteropServices; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace CapsLockIndicatorV3 13 | { 14 | public partial class ProgressDialog : DarkModeForm 15 | { 16 | public ProgressDialog() 17 | { 18 | InitializeComponent(); 19 | 20 | DarkModeChanged += ProgressDialog_DarkModeChanged; 21 | DarkModeProvider.RegisterForm(this); 22 | } 23 | 24 | private void ProgressDialog_DarkModeChanged(object sender, EventArgs e) 25 | { 26 | var dark = DarkModeProvider.IsDark; 27 | 28 | Native.UseImmersiveDarkModeColors(Handle, dark); 29 | 30 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 31 | ForeColor = dark ? Color.White : SystemColors.WindowText; 32 | 33 | label1.ForeColor = dark ? Color.White : SystemColors.WindowText; 34 | 35 | ControlScheduleSetDarkMode(progressBar1, dark); 36 | ControlScheduleSetDarkMode(label1, dark); 37 | } 38 | 39 | [Obsolete("", true)] 40 | public static async void DoWorkAsync(Form parent, Action> work) 41 | { 42 | await Task.Run(() => _doWorkAsync(parent, work)); 43 | } 44 | 45 | public static async Task DoWork(Form parent, Action> work) 46 | { 47 | var dialog = new ProgressDialog(); 48 | Native.SetNativeEnabled(parent, false); 49 | dialog.Show(parent); 50 | var prog = new Progress(p => dialog.ReportProgress(p)); 51 | await Task.Run(() => work(prog)); 52 | Native.SetNativeEnabled(parent, true); 53 | dialog.Close(); 54 | } 55 | 56 | public void ReportProgress(ProgressInfo p) 57 | { 58 | progressBar1.Maximum = p.Total < 0 ? 0 : p.Total; 59 | progressBar1.Value = p.Current < 0 ? 0 : p.Current; 60 | if (p.Current < 0 && p.Total < 0) 61 | { 62 | label1.Text = p.Message; 63 | progressBar1.Style = ProgressBarStyle.Marquee; 64 | } 65 | else 66 | { 67 | label1.Text = $"{p.Message} - {p.Current} / {p.Total} ({Math.Round(p.Current / (double)p.Total * 100d, 2)}%)"; 68 | progressBar1.Style = ProgressBarStyle.Continuous; 69 | } 70 | Application.DoEvents(); 71 | } 72 | 73 | [Obsolete("", true)] 74 | private static void _doWorkAsync(Form parent, Action> work) 75 | { 76 | var dialog = new ProgressDialog(); 77 | dialog.Invoke(new MethodInvoker(() => 78 | { 79 | Native.SetNativeEnabled(parent, false); 80 | dialog.Show(parent); 81 | })); 82 | var prog = new Progress(p => 83 | { 84 | dialog.Invoke(new MethodInvoker(() => 85 | { 86 | dialog.progressBar1.Maximum = p.Total; 87 | dialog.progressBar1.Value = p.Current; 88 | dialog.label1.Text = $"{p.Message} - {p.Current} / {p.Total} ({Math.Round(p.Current / (double)p.Total, 2)}%)"; 89 | Application.DoEvents(); 90 | })); 91 | }); 92 | work(prog); 93 | dialog.Invoke(new MethodInvoker(() => 94 | { 95 | Native.SetNativeEnabled(parent, true); 96 | dialog.Close(); 97 | })); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ProgressDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ProgressInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CapsLockIndicatorV3 8 | { 9 | public struct ProgressInfo 10 | { 11 | public int Current; 12 | public int Total; 13 | public string Message; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | using System; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | #endregion 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle ("CapsLock Indicator")] 11 | [assembly: AssemblyDescription("A small utility that indicates the state of the num lock, caps lock and scroll lock key.")] 12 | [assembly: AssemblyConfiguration ("")] 13 | [assembly: AssemblyCompany ("Jonas Kohl")] 14 | [assembly: AssemblyProduct ("CapsLock Indicator")] 15 | [assembly: AssemblyCopyright("© 2017-2022 Jonas Kohl / All rights reserved")] 16 | [assembly: AssemblyTrademark ("")] 17 | [assembly: AssemblyCulture ("")] 18 | // This sets the default COM visibility of types in the assembly to invisible. 19 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 20 | [assembly: ComVisible (false)] 21 | // The assembly version has following format : 22 | // 23 | // Major.Minor.Build.Revision 24 | // 25 | // You can specify all the values or you can use the default the Revision and 26 | // Build Numbers by using the '*' as shown below: 27 | [assembly: AssemblyVersion("3.16.1.2")] 28 | [assembly: AssemblyFileVersion("3.16.1.2")] 29 | [assembly: Guid ("6f54c357-0542-4d7d-9225-338bc3cd7834")] 30 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/QueryBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Web; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public class QueryBuilder 11 | { 12 | private List<(string, string)> fields; 13 | 14 | public QueryBuilder() 15 | { 16 | fields = new List<(string, string)>(); 17 | } 18 | 19 | public void Append(string name, string value) 20 | { 21 | fields.Add((name, value)); 22 | } 23 | 24 | public string ToString(bool includeQuestionMark = false) 25 | { 26 | var sb = new StringBuilder(); 27 | var lst = new List(); 28 | foreach (var (name, value) in fields) 29 | { 30 | sb.Clear(); 31 | sb.Append(HttpUtility.UrlEncode(name)); 32 | sb.Append("="); 33 | sb.Append(HttpUtility.UrlEncode(value)); 34 | lst.Add(sb.ToString()); 35 | } 36 | return (includeQuestionMark ? "?" : "") + string.Join("&", lst); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Caps_Off.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Caps_Off.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Caps_On.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Caps_On.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Icon_Dark.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Icon_Dark.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Num_Off.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Num_Off.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Num_On.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Num_On.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Scroll_Off.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Scroll_Off.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/CLIv3_Scroll_On.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/CLIv3_Scroll_On.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/MainWindow.Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/MainWindow.Icon.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/TabIcons.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/TabIcons.bmp -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/defaultSettings.txt: -------------------------------------------------------------------------------- 1 | b:numIco=True 2 | b:capsIco=True 3 | b:scrollIco=True 4 | b:numInd=True 5 | b:capsInd=True 6 | b:scrollInd=True 7 | b:noIco=False 8 | b:noInd=False 9 | b:darkMode=False 10 | b:hideOnStartup=False 11 | b:checkForUpdates=True 12 | b:upgradeRequired=True 13 | b:alwaysShowWhenActive=False 14 | b:firstRun=True 15 | b:searchForUpdatesAfterResume=True 16 | b:showNotificationOnAllScreens=False 17 | b:supressEOLMessage=False 18 | b:dontOverwriteApplicationOnUpdate=False 19 | b:persistentOverlayCapsOff=False 20 | b:persistentOverlayCapsOn=False 21 | b:persistentOverlayNumOff=False 22 | b:persistentOverlayNumOn=False 23 | b:persistentOverlayScrollOff=False 24 | b:persistentOverlayScrollOn=False 25 | b:numIcoOnlyWhenActive=False 26 | b:capsIcoOnlyWhenActive=False 27 | b:scrollIcoOnlyWhenActive=False 28 | c:indBgColourActive=255;66;66;66 29 | c:indFgColourActive=255;255;255;255 30 | c:indBdColourActive=255;77;180;52 31 | c:indBgColourInactive=255;66;66;66 32 | c:indFgColourInactive=255;255;255;255 33 | c:indBdColourInactive=255;180;52;77 34 | f:indFont=Segoe UI; 12pt 35 | i:indDisplayTime=500 36 | i:indOpacity=100 37 | i:bdSize=4 38 | p:indPadding=24;12;24;12 39 | s:versionNo=3.16.0.0 40 | s:overlayPosition=BottomRight 41 | s:customMessageCapsOn= 42 | s:customMessageCapsOff= 43 | s:customMessageNumOn= 44 | s:customMessageNumOff= 45 | s:customMessageScrollOn= 46 | s:customMessageScrollOff= 47 | s:selectedLanguage= 48 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/generalIcon.Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/generalIcon.Icon.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/generalIcon_dark.Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/generalIcon_dark.Icon.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/logo.Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/logo.Image.png -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/logo_dark.Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/logo_dark.Image.png -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/settings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/settings.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/settingsDescriptions.txt: -------------------------------------------------------------------------------- 1 | numIco Show icon for num lock 2 | capsIco Show icon for caps lock 3 | scrollIco Show icon for scroll lock 4 | numInd Show notification for num lock 5 | capsInd Show notification for caps lock 6 | scrollInd Show notification for scroll lock 7 | noIco Don't show icons 8 | noInd Don't show notifications 9 | darkMode Enable dark color scheme (Has no effect on anything below Windows 10) 10 | hideOnStartup Hide CapsLock Indicator on startup 11 | checkForUpdates Automatically check for updates 12 | upgradeRequired Internal. :b:{Do not change!} 13 | alwaysShowWhenActive Don't hide overlay as long as key is active 14 | firstRun If true, shows the :i:{First run} dialog on next start 15 | searchForUpdatesAfterResume Whether CapsLock Indicator should search for updates after a system resume (i.e. after hibernation) 16 | showNotificationOnAllScreens :b:{Experimental:} Show notification on all screens instead of the screen containg the cursor 17 | supressEOLMessage Internal. :b:{Do not change!} 18 | dontOverwriteApplicationOnUpdate If true, restores the previous behaviour where on each update a new executable would be downloaded. If false, replaces the old executable. 19 | indBgColourActive Background color of overlay when key is active 20 | indFgColourActive Text color of overlay when key is active 21 | indBdColourActive Border color of overlay when key is active 22 | indBgColourInactive Background color of overlay when key is inactive 23 | indFgColourInactive Text color of overlay when key is inactive 24 | indBdColourInactive Border color of overlay when key is inactive 25 | indFont Overlay font 26 | indDisplayTime Overlay display time 27 | indOpacity Overlay opacity 28 | indPadding The padding of the overlay (the space between the window and the text) 29 | bdSize Overlay border width 30 | versionNo Internal. :b:{Do not change!} 31 | overlayPosition Position of the overlay 32 | customMessageCapsOn Custom message to display when caps lock was activated 33 | customMessageCapsOff Custom message to display when caps lock was deactivated 34 | customMessageNumOn Custom message to display when num lock was activated 35 | customMessageNumOff Custom message to display when num lock was deactivated 36 | customMessageScrollOn Custom message to display when scroll lock was activated 37 | customMessageScrollOff Custom message to display when scroll lock was deactivated 38 | selectedLanguage Selected language 39 | persistentOverlayCapsOff If true, shows the overlay as long as caps lock is off 40 | persistentOverlayCapsOn If true, shows the overlay as long as caps lock is on 41 | persistentOverlayNumOff If true, shows the overlay as long as num lock is off 42 | persistentOverlayNumOn If true, shows the overlay as long as num lock is on 43 | persistentOverlayScrollOff If true, shows the overlay as long as scroll lock is off 44 | persistentOverlayScrollOn If true, shows the overlay as long as scroll lock is on 45 | numIcoOnlyWhenActive If true, shows the num lock icon only when num lock is active 46 | capsIcoOnlyWhenActive If true, shows the caps lock icon only when caps lock is active 47 | scrollIcoOnlyWhenActive If true, shows the scroll lock icon only when scroll lock is active -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Resources/settings_w.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/Resources/settings_w.ico -------------------------------------------------------------------------------- /CapsLockIndicatorV3/RichTextLabel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public class RichTextLabel : RichTextBox 11 | { 12 | public RichTextLabel() 13 | { 14 | ReadOnly = true; 15 | BorderStyle = BorderStyle.None; 16 | TabStop = false; 17 | Cursor = Cursors.Default; 18 | SetStyle(ControlStyles.Selectable, false); 19 | SetStyle(ControlStyles.UserMouse, true); 20 | SetStyle(ControlStyles.SupportsTransparentBackColor, true); 21 | 22 | MouseEnter += delegate (object sender, EventArgs e) 23 | { 24 | Cursor = Cursors.Default; 25 | }; 26 | } 27 | 28 | public static string ParseFormattedString(string str) 29 | { 30 | var parts = new List(); 31 | 32 | var buffer = new StringBuilder(); 33 | var insideFormatExpression = false; 34 | var currentFormat = Format.Regular; 35 | int i = 0; 36 | while (i < str.Length) 37 | { 38 | if (!insideFormatExpression && str.Length - i >= 5 && (str.Substring(i, 4) == ":i:{" || str.Substring(i, 4) == ":b:{")) 39 | { 40 | parts.Add(new TextRun() { Format = currentFormat, Text = buffer.ToString() }); 41 | buffer.Clear(); 42 | insideFormatExpression = true; 43 | currentFormat = str[i + 1] == 'b' ? Format.Bold : Format.Italic; 44 | i += 4; 45 | goto add; 46 | } 47 | if (insideFormatExpression && str[i] == '}') 48 | { 49 | parts.Add(new TextRun() { Format = currentFormat, Text = buffer.ToString() }); 50 | buffer.Clear(); 51 | insideFormatExpression = false; 52 | currentFormat = Format.Regular; 53 | goto inc; 54 | } 55 | 56 | add: 57 | buffer.Append(str[i]); 58 | 59 | inc: 60 | ++i; 61 | } 62 | parts.Add(new TextRun() { Format = currentFormat, Text = buffer.ToString() }); 63 | 64 | var rtf = new StringBuilder(); 65 | rtf.Append(@"{\rtf1\ansi "); 66 | foreach (var part in parts) 67 | { 68 | if (part.Format == Format.Bold) 69 | { 70 | rtf.Append(@"\b "); 71 | } 72 | else if (part.Format == Format.Italic) 73 | { 74 | rtf.Append(@"\i "); 75 | } 76 | 77 | rtf.Append(EscapeRtf(part.Text)); 78 | 79 | if (part.Format == Format.Bold) 80 | { 81 | rtf.Append(@"\b0 "); 82 | } 83 | else if (part.Format == Format.Italic) 84 | { 85 | rtf.Append(@"\i0 "); 86 | } 87 | } 88 | rtf.Append("}"); 89 | return rtf.ToString(); 90 | } 91 | 92 | private static string EscapeRtf(string input) 93 | { 94 | var backslashed = new StringBuilder(input); 95 | backslashed.Replace(@"\", @"\\"); 96 | backslashed.Replace(@"{", @"\{"); 97 | backslashed.Replace(@"}", @"\}"); 98 | 99 | var sb = new StringBuilder(); 100 | foreach (var character in backslashed.ToString()) 101 | { 102 | if (character <= 0x7f) 103 | sb.Append(character); 104 | else 105 | sb.Append("\\u" + Convert.ToUInt32(character) + "?"); 106 | } 107 | return sb.ToString(); 108 | } 109 | 110 | protected override void WndProc(ref Message m) 111 | { 112 | if (m.Msg == 0x204) return; // WM_RBUTTONDOWN 113 | if (m.Msg == 0x205) return; // WM_RBUTTONUP 114 | base.WndProc(ref m); 115 | } 116 | 117 | 118 | enum Format { Regular, Bold, Italic } 119 | struct TextRun 120 | { 121 | public string Text; 122 | public Format Format; 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Settings.cs: -------------------------------------------------------------------------------- 1 | namespace CapsLockIndicatorV3.Properties { 2 | 3 | 4 | // This class allows you to handle specific events on the settings class: 5 | // The SettingChanging event is raised before a setting's value is changed. 6 | // The PropertyChanged event is raised after a setting's value is changed. 7 | // The SettingsLoaded event is raised after the setting values are loaded. 8 | // The SettingsSaving event is raised before the setting values are saved. 9 | internal sealed partial class Settings { 10 | 11 | public Settings() { 12 | // // To add event handlers for saving and changing settings, uncomment the lines below: 13 | // 14 | // this.SettingChanging += this.SettingChangingEventHandler; 15 | // 16 | // this.SettingsSaving += this.SettingsSavingEventHandler; 17 | // 18 | } 19 | 20 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { 21 | // Add code to handle the SettingChangingEvent event here. 22 | } 23 | 24 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { 25 | // Add code to handle the SettingsSaving event here. 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/StringFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CapsLockIndicatorV3 8 | { 9 | public class StringFormatter 10 | { 11 | public string String { get; set; } 12 | 13 | public Dictionary Parameters { get; set; } 14 | 15 | public StringFormatter(string @string) 16 | { 17 | String = @string; 18 | Parameters = new Dictionary(); 19 | } 20 | 21 | public void Add(string key, object val) 22 | { 23 | Parameters.Add(key, val); 24 | } 25 | 26 | public override string ToString() 27 | { 28 | return Parameters.Aggregate(String, (current, parameter) => current.Replace("{" + parameter.Key + "}", parameter.Value.ToString())); 29 | } 30 | 31 | public static implicit operator string(StringFormatter formatter) 32 | { 33 | return formatter.ToString(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/SysIcons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CapsLockIndicatorV3 10 | { 11 | public static class SysIcons 12 | { 13 | const int MAX_PATH = 0x100; 14 | 15 | public static int LAST_ERROR { get; private set; } 16 | public static int LAST_WIN32_ERROR { get; private set; } 17 | 18 | [DllImport("Shell32.dll", SetLastError = true)] 19 | static extern int SHGetStockIconInfo(SHSTOCKICONID siid, SHGSI uFlags, ref SHSTOCKICONINFO psii); 20 | 21 | public enum SHSTOCKICONID : uint 22 | { 23 | SIID_WARNING = 78, 24 | SIID_ERROR = 80, 25 | SIID_SHIELD = 131 26 | } 27 | 28 | [Flags] 29 | private enum SHGSI : uint 30 | { 31 | SHGSI_ICON = 0x000000100, 32 | SHGSI_LARGEICON = 0x000000000, 33 | SHGSI_SMALLICON = 0x000000001 34 | } 35 | 36 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 37 | private struct SHSTOCKICONINFO 38 | { 39 | public uint cbSize; 40 | public IntPtr hIcon; 41 | public long iSysIconIndex; 42 | public long iIcon; 43 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)] 44 | public string szPath; 45 | } 46 | 47 | public static Icon GetSystemIcon(SHSTOCKICONID icon, IconSize size = IconSize.Unspecified) 48 | { 49 | var hIco = GetSystemIconRaw(icon, size); 50 | if (hIco == IntPtr.Zero) 51 | return null; 52 | return Icon.FromHandle(hIco); 53 | } 54 | public static IntPtr GetSystemIconRaw(SHSTOCKICONID icon, IconSize size = IconSize.Unspecified) 55 | { 56 | var info = new SHSTOCKICONINFO(); 57 | info.cbSize = (uint)unchecked(Marshal.SizeOf(info)); 58 | var flags = SHGSI.SHGSI_ICON; 59 | if (size == IconSize.Small) 60 | flags |= SHGSI.SHGSI_SMALLICON; 61 | else if (size == IconSize.Large) 62 | flags |= SHGSI.SHGSI_LARGEICON; 63 | 64 | var r = SHGetStockIconInfo(icon, flags, ref info); 65 | LAST_ERROR = r; 66 | if (r != 0) 67 | { 68 | LAST_WIN32_ERROR = Marshal.GetLastWin32Error(); 69 | return IntPtr.Zero; 70 | } 71 | 72 | return info.hIcon; 73 | } 74 | 75 | public enum IconSize 76 | { 77 | Unspecified, 78 | Small, 79 | Large 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/TextInputDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CapsLockIndicatorV3 2 | { 3 | partial class TextInputDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.inputTextBox = new System.Windows.Forms.TextBox(); 32 | this.okButton = new System.Windows.Forms.Button(); 33 | this.cancelButton = new System.Windows.Forms.Button(); 34 | this.SuspendLayout(); 35 | // 36 | // inputTextBox 37 | // 38 | this.inputTextBox.Location = new System.Drawing.Point(0, 0); 39 | this.inputTextBox.Name = "inputTextBox"; 40 | this.inputTextBox.Size = new System.Drawing.Size(99, 23); 41 | this.inputTextBox.TabIndex = 0; 42 | // 43 | // okButton 44 | // 45 | this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System; 46 | this.okButton.Location = new System.Drawing.Point(105, 0); 47 | this.okButton.Name = "okButton"; 48 | this.okButton.Size = new System.Drawing.Size(39, 23); 49 | this.okButton.TabIndex = 1; 50 | this.okButton.Text = "OK"; 51 | this.okButton.UseVisualStyleBackColor = true; 52 | this.okButton.Click += new System.EventHandler(this.button1_Click); 53 | // 54 | // cancelButton 55 | // 56 | this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 57 | this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System; 58 | this.cancelButton.Location = new System.Drawing.Point(-53, 0); 59 | this.cancelButton.Name = "cancelButton"; 60 | this.cancelButton.Size = new System.Drawing.Size(39, 23); 61 | this.cancelButton.TabIndex = 2; 62 | this.cancelButton.TabStop = false; 63 | this.cancelButton.UseVisualStyleBackColor = true; 64 | // 65 | // TextInputDialog 66 | // 67 | this.AcceptButton = this.okButton; 68 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 70 | this.BackColor = System.Drawing.SystemColors.Window; 71 | this.CancelButton = this.cancelButton; 72 | this.ClientSize = new System.Drawing.Size(143, 23); 73 | this.ControlBox = false; 74 | this.Controls.Add(this.cancelButton); 75 | this.Controls.Add(this.okButton); 76 | this.Controls.Add(this.inputTextBox); 77 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 78 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 79 | this.MaximizeBox = false; 80 | this.MinimizeBox = false; 81 | this.Name = "TextInputDialog"; 82 | this.ShowIcon = false; 83 | this.ShowInTaskbar = false; 84 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 85 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 86 | this.Load += new System.EventHandler(this.TextInputDialog_Load); 87 | this.ResumeLayout(false); 88 | this.PerformLayout(); 89 | 90 | } 91 | 92 | #endregion 93 | 94 | private System.Windows.Forms.TextBox inputTextBox; 95 | private System.Windows.Forms.Button okButton; 96 | private System.Windows.Forms.Button cancelButton; 97 | } 98 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/TextInputDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace CapsLockIndicatorV3 11 | { 12 | public partial class TextInputDialog : DarkModeForm 13 | { 14 | protected override void WndProc(ref Message message) 15 | { 16 | if (message.Msg == 0x0084) // WM_NCHITTEST 17 | message.Result = (IntPtr)1; 18 | else base.WndProc(ref message); 19 | } 20 | 21 | public string Value => inputTextBox.Text; 22 | 23 | public TextInputDialog(string defaultValue) 24 | { 25 | InitializeComponent(); 26 | inputTextBox.Text = defaultValue; 27 | 28 | HandleCreated += (sender, e) => 29 | { 30 | DarkModeChanged += TextInputDialog_DarkModeChanged; 31 | DarkModeProvider.RegisterForm(this); 32 | }; 33 | } 34 | 35 | private void TextInputDialog_DarkModeChanged(object sender, EventArgs e) 36 | { 37 | var dark = DarkModeProvider.IsDark; 38 | 39 | Native.UseImmersiveDarkModeColors(Handle, dark); 40 | 41 | ForeColor = 42 | inputTextBox.ForeColor = dark ? Color.White : SystemColors.WindowText; 43 | 44 | inputTextBox.BackColor = dark ? Color.FromArgb(255, 56, 56, 56) : SystemColors.Window; 45 | inputTextBox.BorderStyle = dark ? BorderStyle.FixedSingle : BorderStyle.Fixed3D; 46 | 47 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 48 | 49 | ControlScheduleSetDarkMode(inputTextBox, dark); 50 | ControlScheduleSetDarkMode(okButton, dark); 51 | } 52 | 53 | private void button1_Click(object sender, EventArgs e) 54 | { 55 | DialogResult = DialogResult.OK; 56 | Close(); 57 | } 58 | 59 | private void TextInputDialog_Load(object sender, EventArgs e) 60 | { 61 | 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/TextInputDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/URLs.cs: -------------------------------------------------------------------------------- 1 | namespace CapsLockIndicatorV3 2 | { 3 | static class URLs 4 | { 5 | public const string MainWebsite = "https://jonaskohl.de/"; 6 | public const string ProjectWebsite = "https://cli.jonaskohl.de/"; 7 | public const string GithubRepo = "https://github.com/jonaskohl/CapsLockIndicator"; 8 | 9 | public const string ServiceEndpointBase = ProjectWebsite; 10 | 11 | public const string DownloadTranslations = ProjectWebsite + "!/translations#download-translations"; 12 | 13 | public const string LangServiceUrl = ServiceEndpointBase + "!/langservice"; 14 | public const string KBUpdateCheck = ServiceEndpointBase + "kb/?a=updatecheck"; 15 | public const string IconGalleryMeta = ServiceEndpointBase + "icongallery/getmeta.php"; 16 | public const string IconGalleryDownload = ServiceEndpointBase + "icongallery/"; 17 | public const string IconGallery = ServiceEndpointBase + "icongallery/embedded.php"; 18 | public const string ClientSupported = ServiceEndpointBase + "eolcheck"; 19 | public const string VersionCheck = ServiceEndpointBase + "!/version?details&xml&newClient3=true"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/UpdateDialog.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace CapsLockIndicatorV3 13 | { 14 | public partial class UpdateDialog : DarkModeForm 15 | { 16 | private Version newVersion; 17 | private Version minOsVersion; 18 | 19 | public UpdateDialog() 20 | { 21 | InitializeComponent(); 22 | 23 | Text = strings.updateAvailable; 24 | updateNowButton.Text = strings.updateNow; 25 | dismissButton.Text = strings.dismissButton; 26 | downloadManuallyButton.Text = strings.downloadManuallyButton; 27 | 28 | HandleCreated += (sender, e) => 29 | { 30 | DarkModeChanged += UpdateDialog_DarkModeChanged; 31 | DarkModeProvider.RegisterForm(this); 32 | }; 33 | } 34 | 35 | private void UpdateDialog_DarkModeChanged(object sender, EventArgs e) 36 | { 37 | var dark = DarkModeProvider.IsDark; 38 | 39 | Native.UseImmersiveDarkModeColors(Handle, dark); 40 | 41 | lnkLabel1.ForeColor = 42 | lnkLabel1.LinkColor = 43 | dark ? Color.White : SystemColors.HotTrack; 44 | 45 | BackColor = dark ? Color.FromArgb(255, 32, 32, 32) : SystemColors.Window; 46 | ForeColor = dark ? Color.White : SystemColors.WindowText; 47 | infoLabel.ForeColor = dark ? Color.FromArgb(255, 196, 204, 238) : Color.FromArgb(255, 52, 77, 180); 48 | changelogRtf.BackColor = dark ? Color.FromArgb(255, 56, 56, 56) : SystemColors.Window; 49 | 50 | ControlScheduleSetDarkMode(changelogRtf, dark); 51 | ControlScheduleSetDarkMode(dismissButton, dark); 52 | ControlScheduleSetDarkMode(updateNowButton, dark); 53 | ControlScheduleSetDarkMode(downloadManuallyButton, dark); 54 | } 55 | 56 | public void SetNewVersion(Version v, Version minOsVersion = null) 57 | { 58 | newVersion = v; 59 | this.minOsVersion = minOsVersion; 60 | 61 | if (minOsVersion != null && Environment.OSVersion.Version < minOsVersion) 62 | { 63 | lnkLabel1.Show(); 64 | downloadManuallyButton.Enabled = false; 65 | updateNowButton.Enabled = false; 66 | downloadManuallyButton.Hide(); 67 | updateNowButton.Hide(); 68 | dismissButton.Location = new Point( 69 | downloadManuallyButton.Location.X + downloadManuallyButton.Width - dismissButton.Width, 70 | downloadManuallyButton.Location.Y 71 | ); 72 | } 73 | } 74 | 75 | private void downloadManuallyButton_Click(object sender, EventArgs e) 76 | { 77 | DialogResult = DialogResult.Ignore; 78 | Close(); 79 | } 80 | 81 | private void lnkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 82 | { 83 | MessageBox.Show("Version " + newVersion + " of CapsLock Indicator requires at least Windows " + minOsVersion + "! You are running " + FriendlyName(), "", MessageBoxButtons.OK, MessageBoxIcon.Warning); 84 | } 85 | 86 | public string HKLM_GetString(string path, string key) 87 | { 88 | try 89 | { 90 | RegistryKey rk = Registry.LocalMachine.OpenSubKey(path); 91 | if (rk == null) return ""; 92 | return (string)rk.GetValue(key); 93 | } 94 | catch { return ""; } 95 | } 96 | 97 | public string FriendlyName() 98 | { 99 | string ProductName = HKLM_GetString(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName"); 100 | string CSDVersion = HKLM_GetString(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion"); 101 | if (ProductName != "") 102 | { 103 | return ProductName + (CSDVersion != "" ? " " + CSDVersion : ""); 104 | } 105 | return "an unknown OS"; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/UpdateDialog.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/VersionCheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Net; 4 | using System.Reflection; 5 | using System.Windows.Forms; 6 | 7 | namespace CapsLockIndicatorV3 8 | { 9 | /// 10 | /// This class checks if a new version is available. 11 | /// 12 | public static class VersionCheck 13 | { 14 | public static string newVersion = null; 15 | 16 | private static string version; 17 | 18 | public static string UserAgent => 19 | "Mozilla/4.0 (compatible; MSIE 7.0; " + Environment.OSVersion.ToString() + "; " + (Environment.Is64BitOperatingSystem? "Win64; x64" : "Win32; x86") + ") Trident 7.0 (KHTML, like Gecko) CapsLockIndicator/" + version; 20 | 21 | static VersionCheck() 22 | { 23 | Assembly assembly = Assembly.GetExecutingAssembly(); 24 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); 25 | version = fvi.FileVersion; 26 | } 27 | 28 | public static async void IsLatestVersion(Action callback, bool isManualCheck) 29 | { 30 | WebClient client = new WebClient(); 31 | client.Headers.Add(HttpRequestHeader.UserAgent, UserAgent); 32 | ServicePointManager.Expect100Continue = true; 33 | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 34 | try 35 | { 36 | string data = await client.DownloadStringTaskAsync(URLs.VersionCheck + (DarkModeProvider.IsDark ? "&dark=true" : "")); 37 | callback(data); 38 | } 39 | catch (Exception e) 40 | { 41 | if (isManualCheck) 42 | MessageBox.Show("An error occured while searching for updates:\r\n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 43 | } 44 | client.Dispose(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/Versions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CapsLockIndicatorV3 4 | { 5 | public class Versions 6 | { 7 | public static readonly Version SettingsToTabs = new Version(3, 13, 0, 0); 8 | 9 | public static bool IsWindows11 => Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000; 10 | } 11 | } -------------------------------------------------------------------------------- /CapsLockIndicatorV3/ViewOnlyRichTextBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace CapsLockIndicatorV3 9 | { 10 | public class ViewOnlyRichTextBox : RichTextBox 11 | { 12 | // constants for the message sending 13 | const int WM_SETFOCUS = 0x0007; 14 | const int WM_KILLFOCUS = 0x0008; 15 | const int WM_SETCURSOR = 0x0020; 16 | 17 | protected override void WndProc(ref Message m) 18 | { 19 | if (m.Msg == WM_SETFOCUS) m.Msg = WM_KILLFOCUS; 20 | if (m.Msg == WM_SETCURSOR) return; 21 | 22 | base.WndProc(ref m); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | True 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | True 24 | 25 | 26 | True 27 | 28 | 29 | True 30 | 31 | 32 | False 33 | 34 | 35 | False 36 | 37 | 38 | False 39 | 40 | 41 | 500 42 | 43 | 44 | 66, 66, 66 45 | 46 | 47 | White 48 | 49 | 50 | 77, 180, 52 51 | 52 | 53 | 3.11.1.1 54 | 55 | 56 | False 57 | 58 | 59 | Segoe UI, 12pt 60 | 61 | 62 | 66, 66, 66 63 | 64 | 65 | White 66 | 67 | 68 | 180, 52, 77 69 | 70 | 71 | True 72 | 73 | 74 | -1 75 | 76 | 77 | BottomRight 78 | 79 | 80 | 100 81 | 82 | 83 | True 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 53 | 54 | true 55 | 56 | 57 | 58 | 59 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/bin/Release/pack-lang-files.ps1: -------------------------------------------------------------------------------- 1 | Get-ChildItem -Recurse -Directory | ForEach-Object { 2 | Compress-Archive -Path "$($_.FullName)\*.dll" -DestinationPath ".\$($_.Name).zip" 3 | } 4 | -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.cs.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.cs.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.de.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.de.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.es.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.es.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.fr.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.fr.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.it.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.it.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.ko.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.ko.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.nl.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.nl.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.pt-BR.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.pt-BR.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.pt-PT.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.pt-PT.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.ru.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.ru.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.tr-TR.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.tr-TR.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.zh-CN.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.zh-CN.Designer.cs -------------------------------------------------------------------------------- /CapsLockIndicatorV3/strings.zh-TW.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonaskohl/CapsLockIndicator/66eda270a207ff6acdde14862a965ae898cae05b/CapsLockIndicatorV3/strings.zh-TW.Designer.cs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | CapsLock Indicator 3 |

4 | 5 |

6 | Visit project page 7 | License 8 | Version 9 | Build Status 10 |

11 | 12 |

13 | CapsLock Indicator is a small utility that indicates the state of the Num lock, Caps lock and Scroll lock key. 14 |

15 | 16 |


17 | 18 |

19 | 20 | Download now 21 | 22 |

23 | 24 |


25 | 26 |

27 | Screenshot 28 | Screenshot 29 |

30 | 31 |


32 | 33 | # Edit & compile source code 34 | You need Microsoft Visual Studio 2019 and the Microsoft .NET 4.7.1 SDK to edit and compile the source code. 35 | 36 | # Contributing 37 | If you have a feature suggestion or a bug to file **and you are able to implement this in the code**, feel free to [open a pull request](https://github.com/jonaskohl/CapsLockIndicator/pulls). If you only want to report a bug or suggest a feature, [open a new issue](https://github.com/jonaskohl/CapsLockIndicator/issues/new). 38 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # .NET Desktop 2 | # Build and run tests for .NET Desktop or Windows classic desktop solutions. 3 | # Add steps that publish symbols, save build artifacts, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'windows-latest' 11 | 12 | variables: 13 | solution: '**/*.sln' 14 | buildPlatform: 'Any CPU' 15 | buildConfiguration: 'Release' 16 | 17 | steps: 18 | - task: NuGetToolInstaller@1 19 | 20 | - task: NuGetCommand@2 21 | inputs: 22 | restoreSolution: '$(solution)' 23 | 24 | - task: VSBuild@1 25 | inputs: 26 | solution: '$(solution)' 27 | platform: '$(buildPlatform)' 28 | configuration: '$(buildConfiguration)' 29 | 30 | - task: VSTest@2 31 | inputs: 32 | platform: '$(buildPlatform)' 33 | configuration: '$(buildConfiguration)' 34 | --------------------------------------------------------------------------------