From e05f518ca7e54f9e791e100c9ea3c5c067aa194b Mon Sep 17 00:00:00 2001 From: radj307 Date: Thu, 24 Feb 2022 16:15:19 -0500 Subject: [PATCH] major update Rename objects to follow naming convention Add a "Bring To Front" option in the system tray context menu Add a toggle for "Always on Top" to the system tray context menu Improve the layout of controls Improve the visual style of combo boxes Fix autocomplete for hotkey & target comboboxes Apply code formatting preferences Improve tab stop indexes Consolidate always on top settings into a property Add a bring to front event handler Disable toast setting members when the toast is disabled. --- AudioAPI/AudioSessionList.cs | 11 +- AudioAPI/System.cs | 4 +- AudioAPI/VolumeHelper.cs | 4 +- HotkeyLib/Hotkey.cs | 2 +- ProcessEventLog/Internal/MessageBase.cs | 4 +- .../Extensions/FloatingPointExtensions.cs | 2 +- ToastForm/ToastForm.cs | 6 +- ToastForm/ToastForm.resx | 4 +- UIComposites/ColorSchemes/IColorBinding.cs | 2 +- UIComposites/GlobalSuppressions.cs | 8 + UIComposites/HotkeyEditor.Designer.cs | 12 +- UIComposites/HotkeyEditor.resx | 3 - .../NumberUpDownWithLabel.Designer.cs | 2 +- UIComposites/SettingsPane.Designer.cs | 41 ++--- UIComposites/TargetSelector.Designer.cs | 21 ++- UIComposites/ToastSettings.Designer.cs | 5 +- UIComposites/ToastSettings.cs | 7 +- VolumeControl/Program.cs | 1 - VolumeControl/VolumeControlForm.Designer.cs | 161 +++++++++++------- VolumeControl/VolumeControlForm.cs | 22 ++- VolumeControlCLI/Program.cs | 8 +- 21 files changed, 191 insertions(+), 139 deletions(-) create mode 100644 UIComposites/GlobalSuppressions.cs diff --git a/AudioAPI/AudioSessionList.cs b/AudioAPI/AudioSessionList.cs index 2fbe16c58..7ca190c2a 100644 --- a/AudioAPI/AudioSessionList.cs +++ b/AudioAPI/AudioSessionList.cs @@ -1,14 +1,9 @@ -using AudioAPI.WindowsAPI.Audio.MMDeviceAPI.Enum; +using AudioAPI.WindowsAPI.Audio; using AudioAPI.WindowsAPI.Audio.MMDeviceAPI; -using AudioAPI.WindowsAPI.Audio; -using System; -using System.Collections.Generic; +using AudioAPI.WindowsAPI.Audio.MMDeviceAPI.Enum; +using System.Collections; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Runtime.InteropServices; -using System.Collections; namespace AudioAPI { diff --git a/AudioAPI/System.cs b/AudioAPI/System.cs index 721c13b6b..54f8f99fc 100644 --- a/AudioAPI/System.cs +++ b/AudioAPI/System.cs @@ -7,7 +7,7 @@ public class System public static bool VersionGreaterThan(int major, int minor) { int os_major = Environment.OSVersion.Version.Major, os_minor = Environment.OSVersion.Version.Minor; - return os_major > major || ( os_major == major && os_minor >= minor ); + return os_major > major || (os_major == major && os_minor >= minor); } public static object? GetManagementObject(string property) { @@ -15,7 +15,7 @@ public static bool VersionGreaterThan(int major, int minor) try { IEnumerable objects = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType(); - obj = ( from it in objects select it.GetPropertyValue(property) ).FirstOrDefault(); + obj = (from it in objects select it.GetPropertyValue(property)).FirstOrDefault(); } catch (Exception) { } return obj; diff --git a/AudioAPI/VolumeHelper.cs b/AudioAPI/VolumeHelper.cs index 6d71dc45b..20332aa7c 100644 --- a/AudioAPI/VolumeHelper.cs +++ b/AudioAPI/VolumeHelper.cs @@ -105,7 +105,7 @@ public static void SetVolume(string proc_name, decimal level) throw new COMException("Volume object creation failed"); Guid guid = Guid.Empty; - volume.SetMasterVolume((float)( level / 100.0m ), ref guid); + volume.SetMasterVolume((float)(level / 100.0m), ref guid); Marshal.ReleaseComObject(volume); } @@ -203,7 +203,7 @@ public static void SetVolume(int proc_id, decimal level) throw new COMException("Volume object creation failed"); Guid guid = Guid.Empty; - volume.SetMasterVolume((float)( level / 100.0m ), ref guid); + volume.SetMasterVolume((float)(level / 100.0m), ref guid); Marshal.ReleaseComObject(volume); } diff --git a/HotkeyLib/Hotkey.cs b/HotkeyLib/Hotkey.cs index ed7365971..8909fb845 100644 --- a/HotkeyLib/Hotkey.cs +++ b/HotkeyLib/Hotkey.cs @@ -160,7 +160,7 @@ public void Reset(Hotkey o) Win = o.Win; KeyCode = o.KeyCode; - Reregister(); + Reregister(); } public Hotkey Clone() => new(keyCode, shift, control, alt, windows); diff --git a/ProcessEventLog/Internal/MessageBase.cs b/ProcessEventLog/Internal/MessageBase.cs index dd21335c2..b8c140d5e 100644 --- a/ProcessEventLog/Internal/MessageBase.cs +++ b/ProcessEventLog/Internal/MessageBase.cs @@ -8,8 +8,8 @@ protected MessageBase(Filter.MessageType type, string msg) _msg = msg; } - private Filter.MessageType _type; - private string _msg; + private readonly Filter.MessageType _type; + private readonly string _msg; public Filter.MessageType Type { get => _type; } public string Message { get => _msg; } diff --git a/ToastForm/Extensions/FloatingPointExtensions.cs b/ToastForm/Extensions/FloatingPointExtensions.cs index 5533be342..3dabb8a7d 100644 --- a/ToastForm/Extensions/FloatingPointExtensions.cs +++ b/ToastForm/Extensions/FloatingPointExtensions.cs @@ -8,7 +8,7 @@ public static bool EqualsWithin(this float f, float compare, float epsilon = flo } public static bool EqualsWithin(this float f, double compare, double epsilon = double.Epsilon) { - return (((double)f) - compare <= epsilon); + return (f - compare <= epsilon); } public static bool EqualsWithin(this double d, double compare, double epsilon = double.Epsilon) { diff --git a/ToastForm/ToastForm.cs b/ToastForm/ToastForm.cs index 349f9c435..0de3901d0 100644 --- a/ToastForm/ToastForm.cs +++ b/ToastForm/ToastForm.cs @@ -1,5 +1,5 @@ -using UIComposites; -using ToastForm.Extensions; +using ToastForm.Extensions; +using UIComposites; namespace VolumeControl { @@ -262,7 +262,7 @@ private void ListDisplay_ItemCheck(object? sender, ItemCheckEventArgs e) private void ListDisplay_ItemActivate(object? sender, EventArgs e) { DisableListEventTriggers(); //< Don't trigger event recursively (causes stack overflow) - + foreach (ListViewItem item in ListDisplay.Items) { if (item == null) diff --git a/ToastForm/ToastForm.resx b/ToastForm/ToastForm.resx index 334c0278f..22a38ec61 100644 --- a/ToastForm/ToastForm.resx +++ b/ToastForm/ToastForm.resx @@ -65,7 +65,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAKgEAAAJNU0Z0AUkBTAIBAQIB - AAFQAQABUAEAARABAAEQAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwABQAMAARADAAEBAQABBAYAAQIY + AAFYAQABWAEAARABAAEQAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwABQAMAARADAAEBAQABBAYAAQIY AAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8B AAL/AgAD//8A/wADAAFCAU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAE/wQAAv8B gAEBBAAC/wG/Af0EAAL/Ab8B/QQAAv8BgAEBBAAE/wQAAv8BgAEBBAAC/wG/Af0EAAL/Ab8B/QQAAv8B @@ -83,7 +83,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAFgIAAAJNU0Z0AUkBTAIBAQUB - AAFQAQABUAEAARABAAEQAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwABQAMAASADAAEBAQABBAYAAQQY + AAFYAQABWAEAARABAAEQAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwABQAMAASADAAEBAQABBAYAAQQY AAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8B AAL/AgAD/0IABpkaAAaZegAGmRoABpl6AAaZGgAGmaoABqoCAAa7EgAGqgIABrt6AAa7GgAGu+EAAUIB TQE+BwABPgMAASgDAAFAAwABIAMAAQEBAAEBBgABARYAA/8BAAL/BgABgAEBBgABgAEBBgABgAEBBgAB diff --git a/UIComposites/ColorSchemes/IColorBinding.cs b/UIComposites/ColorSchemes/IColorBinding.cs index 9b1274c8f..d3d293220 100644 --- a/UIComposites/ColorSchemes/IColorBinding.cs +++ b/UIComposites/ColorSchemes/IColorBinding.cs @@ -2,5 +2,5 @@ namespace UIComposites.ColorSchemes { - public interface IControlTheme : IReadOnlyControlTheme {} + public interface IControlTheme : IReadOnlyControlTheme { } } diff --git a/UIComposites/GlobalSuppressions.cs b/UIComposites/GlobalSuppressions.cs new file mode 100644 index 000000000..d6dd5dd85 --- /dev/null +++ b/UIComposites/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "", Scope = "member", Target = "~M:UIComposites.ToastSettings.cb_EnableNotification_CheckedChanged(System.Object,System.EventArgs)")] diff --git a/UIComposites/HotkeyEditor.Designer.cs b/UIComposites/HotkeyEditor.Designer.cs index 31d0f05eb..4c6f6f127 100644 --- a/UIComposites/HotkeyEditor.Designer.cs +++ b/UIComposites/HotkeyEditor.Designer.cs @@ -70,12 +70,12 @@ private void InitializeComponent() // // Combobox_KeySelector // - this.Combobox_KeySelector.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; + this.Combobox_KeySelector.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.Combobox_KeySelector.BackColor = System.Drawing.SystemColors.ControlLightLight; this.Combobox_KeySelector.Cursor = System.Windows.Forms.Cursors.Default; this.Combobox_KeySelector.DataSource = this.keyListBindingSource; this.Combobox_KeySelector.Dock = System.Windows.Forms.DockStyle.Fill; - this.Combobox_KeySelector.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.Combobox_KeySelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.Combobox_KeySelector.FormattingEnabled = true; this.Combobox_KeySelector.Location = new System.Drawing.Point(0, 0); this.Combobox_KeySelector.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -93,7 +93,7 @@ private void InitializeComponent() this.Checkbox_ModifierKey_Ctrl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Checkbox_ModifierKey_Ctrl.Name = "Checkbox_ModifierKey_Ctrl"; this.Checkbox_ModifierKey_Ctrl.Size = new System.Drawing.Size(42, 19); - this.Checkbox_ModifierKey_Ctrl.TabIndex = 4; + this.Checkbox_ModifierKey_Ctrl.TabIndex = 3; this.Checkbox_ModifierKey_Ctrl.Text = "Ctrl"; this.Checkbox_ModifierKey_Ctrl.UseMnemonic = false; this.Checkbox_ModifierKey_Ctrl.UseVisualStyleBackColor = false; @@ -107,7 +107,7 @@ private void InitializeComponent() this.Checkbox_ModifierKey_Alt.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Checkbox_ModifierKey_Alt.Name = "Checkbox_ModifierKey_Alt"; this.Checkbox_ModifierKey_Alt.Size = new System.Drawing.Size(38, 19); - this.Checkbox_ModifierKey_Alt.TabIndex = 5; + this.Checkbox_ModifierKey_Alt.TabIndex = 4; this.Checkbox_ModifierKey_Alt.Text = "Alt"; this.Checkbox_ModifierKey_Alt.UseMnemonic = false; this.Checkbox_ModifierKey_Alt.UseVisualStyleBackColor = false; @@ -121,7 +121,7 @@ private void InitializeComponent() this.Checkbox_ModifierKey_Shift.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Checkbox_ModifierKey_Shift.Name = "Checkbox_ModifierKey_Shift"; this.Checkbox_ModifierKey_Shift.Size = new System.Drawing.Size(47, 19); - this.Checkbox_ModifierKey_Shift.TabIndex = 3; + this.Checkbox_ModifierKey_Shift.TabIndex = 2; this.Checkbox_ModifierKey_Shift.Text = "Shift"; this.Checkbox_ModifierKey_Shift.UseMnemonic = false; this.Checkbox_ModifierKey_Shift.UseVisualStyleBackColor = false; @@ -135,7 +135,7 @@ private void InitializeComponent() this.Checkbox_ModifierKey_Win.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Checkbox_ModifierKey_Win.Name = "Checkbox_ModifierKey_Win"; this.Checkbox_ModifierKey_Win.Size = new System.Drawing.Size(44, 19); - this.Checkbox_ModifierKey_Win.TabIndex = 6; + this.Checkbox_ModifierKey_Win.TabIndex = 5; this.Checkbox_ModifierKey_Win.Text = "Win"; this.Checkbox_ModifierKey_Win.UseMnemonic = false; this.Checkbox_ModifierKey_Win.UseVisualStyleBackColor = false; diff --git a/UIComposites/HotkeyEditor.resx b/UIComposites/HotkeyEditor.resx index 75fe8abde..1d907c13c 100644 --- a/UIComposites/HotkeyEditor.resx +++ b/UIComposites/HotkeyEditor.resx @@ -69,9 +69,6 @@ 17, 17 - - 17, 17 - True diff --git a/UIComposites/NumberUpDownWithLabel.Designer.cs b/UIComposites/NumberUpDownWithLabel.Designer.cs index 641b945a5..159597864 100644 --- a/UIComposites/NumberUpDownWithLabel.Designer.cs +++ b/UIComposites/NumberUpDownWithLabel.Designer.cs @@ -57,7 +57,7 @@ private void InitializeComponent() this.numUpDown.Location = new System.Drawing.Point(82, 1); this.numUpDown.Name = "numUpDown"; this.numUpDown.Size = new System.Drawing.Size(50, 23); - this.numUpDown.TabIndex = 1; + this.numUpDown.TabIndex = 0; this.numUpDown.Value = new decimal(new int[] { 5, 0, diff --git a/UIComposites/SettingsPane.Designer.cs b/UIComposites/SettingsPane.Designer.cs index 00a91597a..0dc4aebac 100644 --- a/UIComposites/SettingsPane.Designer.cs +++ b/UIComposites/SettingsPane.Designer.cs @@ -54,7 +54,8 @@ private void InitializeComponent() this.SettingsGroupBox.ForeColor = System.Drawing.SystemColors.ControlText; this.SettingsGroupBox.Location = new System.Drawing.Point(2, 2); this.SettingsGroupBox.Name = "SettingsGroupBox"; - this.SettingsGroupBox.Size = new System.Drawing.Size(142, 151); + this.SettingsGroupBox.Padding = new System.Windows.Forms.Padding(0); + this.SettingsGroupBox.Size = new System.Drawing.Size(136, 146); this.SettingsGroupBox.TabIndex = 0; this.SettingsGroupBox.TabStop = false; this.SettingsGroupBox.Text = "Settings"; @@ -64,12 +65,12 @@ private void InitializeComponent() this.cb_DarkMode.AutoSize = true; this.cb_DarkMode.BackColor = System.Drawing.Color.Transparent; this.cb_DarkMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cb_DarkMode.Location = new System.Drawing.Point(8, 100); + this.cb_DarkMode.Location = new System.Drawing.Point(5, 97); this.cb_DarkMode.Name = "cb_DarkMode"; this.cb_DarkMode.Size = new System.Drawing.Size(119, 19); - this.cb_DarkMode.TabIndex = 5; + this.cb_DarkMode.TabIndex = 4; this.cb_DarkMode.Text = "Enable Dark Mode"; - this.cb_DarkMode.UseVisualStyleBackColor = false; + this.cb_DarkMode.UseVisualStyleBackColor = true; // // num_VolumeStep // @@ -82,7 +83,7 @@ private void InitializeComponent() 0, 0}); this.num_VolumeStep.LabelText = "Volume Step"; - this.num_VolumeStep.Location = new System.Drawing.Point(5, 120); + this.num_VolumeStep.Location = new System.Drawing.Point(2, 117); this.num_VolumeStep.MaxValue = new decimal(new int[] { 100, 0, @@ -96,7 +97,7 @@ private void InitializeComponent() this.num_VolumeStep.Name = "num_VolumeStep"; this.num_VolumeStep.NumberUpDownWidth = 50; this.num_VolumeStep.Size = new System.Drawing.Size(132, 25); - this.num_VolumeStep.TabIndex = 4; + this.num_VolumeStep.TabIndex = 5; this.num_VolumeStep.Value = new decimal(new int[] { 5, 0, @@ -108,49 +109,49 @@ private void InitializeComponent() this.cb_RunAtStartup.AutoSize = true; this.cb_RunAtStartup.BackColor = System.Drawing.Color.Transparent; this.cb_RunAtStartup.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cb_RunAtStartup.Location = new System.Drawing.Point(8, 20); + this.cb_RunAtStartup.Location = new System.Drawing.Point(5, 17); this.cb_RunAtStartup.Name = "cb_RunAtStartup"; this.cb_RunAtStartup.Size = new System.Drawing.Size(98, 19); - this.cb_RunAtStartup.TabIndex = 3; + this.cb_RunAtStartup.TabIndex = 0; this.cb_RunAtStartup.Text = "Run at Startup"; - this.cb_RunAtStartup.UseVisualStyleBackColor = false; + this.cb_RunAtStartup.UseVisualStyleBackColor = true; // // cb_MinimizeOnStartup // this.cb_MinimizeOnStartup.AutoSize = true; this.cb_MinimizeOnStartup.BackColor = System.Drawing.Color.Transparent; this.cb_MinimizeOnStartup.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cb_MinimizeOnStartup.Location = new System.Drawing.Point(8, 40); + this.cb_MinimizeOnStartup.Location = new System.Drawing.Point(5, 37); this.cb_MinimizeOnStartup.Name = "cb_MinimizeOnStartup"; this.cb_MinimizeOnStartup.Size = new System.Drawing.Size(130, 19); - this.cb_MinimizeOnStartup.TabIndex = 2; + this.cb_MinimizeOnStartup.TabIndex = 1; this.cb_MinimizeOnStartup.Text = "Minimize on Startup"; - this.cb_MinimizeOnStartup.UseVisualStyleBackColor = false; + this.cb_MinimizeOnStartup.UseVisualStyleBackColor = true; // // cb_ShowInTaskbar // this.cb_ShowInTaskbar.AutoSize = true; this.cb_ShowInTaskbar.BackColor = System.Drawing.Color.Transparent; this.cb_ShowInTaskbar.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cb_ShowInTaskbar.Location = new System.Drawing.Point(8, 60); + this.cb_ShowInTaskbar.Location = new System.Drawing.Point(5, 57); this.cb_ShowInTaskbar.Name = "cb_ShowInTaskbar"; this.cb_ShowInTaskbar.Size = new System.Drawing.Size(107, 19); - this.cb_ShowInTaskbar.TabIndex = 1; + this.cb_ShowInTaskbar.TabIndex = 2; this.cb_ShowInTaskbar.Text = "Show In Taskbar"; - this.cb_ShowInTaskbar.UseVisualStyleBackColor = false; + this.cb_ShowInTaskbar.UseVisualStyleBackColor = true; // // cb_AlwaysOnTop // this.cb_AlwaysOnTop.AutoSize = true; this.cb_AlwaysOnTop.BackColor = System.Drawing.Color.Transparent; this.cb_AlwaysOnTop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cb_AlwaysOnTop.Location = new System.Drawing.Point(8, 80); + this.cb_AlwaysOnTop.Location = new System.Drawing.Point(5, 77); this.cb_AlwaysOnTop.Name = "cb_AlwaysOnTop"; this.cb_AlwaysOnTop.Size = new System.Drawing.Size(99, 19); - this.cb_AlwaysOnTop.TabIndex = 0; + this.cb_AlwaysOnTop.TabIndex = 3; this.cb_AlwaysOnTop.Text = "Always on Top"; this.cb_AlwaysOnTop.UseMnemonic = false; - this.cb_AlwaysOnTop.UseVisualStyleBackColor = false; + this.cb_AlwaysOnTop.UseVisualStyleBackColor = true; // // panel // @@ -160,7 +161,7 @@ private void InitializeComponent() this.panel.Location = new System.Drawing.Point(0, 0); this.panel.Name = "panel"; this.panel.Padding = new System.Windows.Forms.Padding(2); - this.panel.Size = new System.Drawing.Size(146, 155); + this.panel.Size = new System.Drawing.Size(140, 150); this.panel.TabIndex = 1; // // SettingsPane @@ -171,7 +172,7 @@ private void InitializeComponent() this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.Controls.Add(this.panel); this.Name = "SettingsPane"; - this.Size = new System.Drawing.Size(146, 155); + this.Size = new System.Drawing.Size(140, 150); this.SettingsGroupBox.ResumeLayout(false); this.SettingsGroupBox.PerformLayout(); this.panel.ResumeLayout(false); diff --git a/UIComposites/TargetSelector.Designer.cs b/UIComposites/TargetSelector.Designer.cs index 674b61d73..548fd81af 100644 --- a/UIComposites/TargetSelector.Designer.cs +++ b/UIComposites/TargetSelector.Designer.cs @@ -42,11 +42,10 @@ private void InitializeComponent() // // cmb_Target // + this.cmb_Target.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cmb_Target.DataSource = this.cmb_Target_BindingSource; this.cmb_Target.Dock = System.Windows.Forms.DockStyle.Fill; this.cmb_Target.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmb_Target.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cmb_Target.FormattingEnabled = true; this.cmb_Target.Location = new System.Drawing.Point(0, 0); this.cmb_Target.MaxDropDownItems = 12; this.cmb_Target.Name = "cmb_Target"; @@ -57,13 +56,13 @@ private void InitializeComponent() // this.label_Target.AutoSize = true; this.label_Target.ForeColor = System.Drawing.Color.Black; - this.label_Target.Location = new System.Drawing.Point(3, 7); + this.label_Target.Location = new System.Drawing.Point(3, 3); this.label_Target.Name = "label_Target"; this.label_Target.Padding = new System.Windows.Forms.Padding(0, 1, 0, 0); this.label_Target.Size = new System.Drawing.Size(39, 16); this.label_Target.TabIndex = 1; this.label_Target.Text = "Target"; - this.label_Target.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_Target.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label_Target.UseMnemonic = false; // // b_Reload @@ -72,10 +71,10 @@ private void InitializeComponent() this.b_Reload.CausesValidation = false; this.b_Reload.FlatStyle = System.Windows.Forms.FlatStyle.System; this.b_Reload.ForeColor = System.Drawing.Color.Black; - this.b_Reload.Location = new System.Drawing.Point(293, 3); + this.b_Reload.Location = new System.Drawing.Point(293, 1); this.b_Reload.Name = "b_Reload"; - this.b_Reload.Size = new System.Drawing.Size(53, 24); - this.b_Reload.TabIndex = 2; + this.b_Reload.Size = new System.Drawing.Size(53, 23); + this.b_Reload.TabIndex = 1; this.b_Reload.Text = "Reload"; this.b_Reload.UseVisualStyleBackColor = false; // @@ -90,16 +89,16 @@ private void InitializeComponent() this.panel.Location = new System.Drawing.Point(0, 0); this.panel.Name = "panel"; this.panel.Padding = new System.Windows.Forms.Padding(1); - this.panel.Size = new System.Drawing.Size(350, 30); + this.panel.Size = new System.Drawing.Size(350, 25); this.panel.TabIndex = 3; // // cmb_Panel // this.cmb_Panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.cmb_Panel.Controls.Add(this.cmb_Target); - this.cmb_Panel.Location = new System.Drawing.Point(48, 3); + this.cmb_Panel.Location = new System.Drawing.Point(48, 1); this.cmb_Panel.Name = "cmb_Panel"; - this.cmb_Panel.Size = new System.Drawing.Size(240, 24); + this.cmb_Panel.Size = new System.Drawing.Size(240, 23); this.cmb_Panel.TabIndex = 3; // // TargetSelector @@ -110,7 +109,7 @@ private void InitializeComponent() this.Controls.Add(this.panel); this.ForeColor = System.Drawing.Color.Transparent; this.Name = "TargetSelector"; - this.Size = new System.Drawing.Size(350, 30); + this.Size = new System.Drawing.Size(350, 25); ((System.ComponentModel.ISupportInitialize)(this.cmb_Target_BindingSource)).EndInit(); this.panel.ResumeLayout(false); this.panel.PerformLayout(); diff --git a/UIComposites/ToastSettings.Designer.cs b/UIComposites/ToastSettings.Designer.cs index f31df3d6a..19257d167 100644 --- a/UIComposites/ToastSettings.Designer.cs +++ b/UIComposites/ToastSettings.Designer.cs @@ -72,7 +72,7 @@ private void InitializeComponent() this.cb_ToastDarkMode.Location = new System.Drawing.Point(10, 40); this.cb_ToastDarkMode.Name = "cb_ToastDarkMode"; this.cb_ToastDarkMode.Size = new System.Drawing.Size(149, 19); - this.cb_ToastDarkMode.TabIndex = 2; + this.cb_ToastDarkMode.TabIndex = 1; this.cb_ToastDarkMode.Text = "Enable Toast Dark Mode"; this.cb_ToastDarkMode.UseVisualStyleBackColor = true; // @@ -101,7 +101,7 @@ private void InitializeComponent() this.num_Timeout.Name = "num_Timeout"; this.num_Timeout.NumberUpDownWidth = 85; this.num_Timeout.Size = new System.Drawing.Size(170, 25); - this.num_Timeout.TabIndex = 1; + this.num_Timeout.TabIndex = 2; this.num_Timeout.Value = new decimal(new int[] { 500, 0, @@ -118,6 +118,7 @@ private void InitializeComponent() this.cb_EnableNotification.TabIndex = 0; this.cb_EnableNotification.Text = "Enable Toast Notification"; this.cb_EnableNotification.UseVisualStyleBackColor = true; + this.cb_EnableNotification.CheckedChanged += new System.EventHandler(this.cb_EnableNotification_CheckedChanged); // // ToastSettings // diff --git a/UIComposites/ToastSettings.cs b/UIComposites/ToastSettings.cs index fc318c4eb..64a85a015 100644 --- a/UIComposites/ToastSettings.cs +++ b/UIComposites/ToastSettings.cs @@ -29,8 +29,8 @@ public ToastSettings() public event EventHandler TargetListEnabledChanged { - add => cb_EnableNotification.CheckedChanged += value; - remove => cb_EnableNotification.CheckedChanged -= value; + add => cb_EnableNotification.CheckedChanged += value; + remove => cb_EnableNotification.CheckedChanged -= value; } public event EventHandler TargetListTimeoutChanged { @@ -42,5 +42,8 @@ public event EventHandler DarkModeChanged add => cb_ToastDarkMode.CheckedChanged += value; remove => cb_ToastDarkMode.CheckedChanged -= value; } + + private void cb_EnableNotification_CheckedChanged(object sender, EventArgs e) + => cb_ToastDarkMode.Enabled = num_Timeout.Enabled = cb_EnableNotification.Checked; } } diff --git a/VolumeControl/Program.cs b/VolumeControl/Program.cs index 17999f467..87e3538d6 100644 --- a/VolumeControl/Program.cs +++ b/VolumeControl/Program.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using UIComposites; namespace VolumeControl { diff --git a/VolumeControl/VolumeControlForm.Designer.cs b/VolumeControl/VolumeControlForm.Designer.cs index 34a47a380..dd0a8aa13 100644 --- a/VolumeControl/VolumeControlForm.Designer.cs +++ b/VolumeControl/VolumeControlForm.Designer.cs @@ -32,13 +32,16 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VolumeControlForm)); this.SystemTray = new System.Windows.Forms.NotifyIcon(this.components); this.SystemTray_ContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ctmi_Close = new System.Windows.Forms.ToolStripMenuItem(); + this.ctmi_BringToFront = new System.Windows.Forms.ToolStripMenuItem(); + this.ctmi_div1 = new System.Windows.Forms.ToolStripSeparator(); + this.ctmi_AlwaysOnTop = new System.Windows.Forms.ToolStripMenuItem(); this.HKEdit_VolumeUp = new UIComposites.HotkeyEditor(); this.HKEdit_VolumeDown = new UIComposites.HotkeyEditor(); this.HKEdit_VolumeMute = new UIComposites.HotkeyEditor(); this.TabController = new Manina.Windows.Forms.TabControl(); this.tab_general = new Manina.Windows.Forms.Tab(); - this.panel2 = new System.Windows.Forms.Panel(); + this.panel_general = new System.Windows.Forms.Panel(); this.Label_VolumeControl = new System.Windows.Forms.Label(); this.TargetSelector = new UIComposites.TargetSelector(); this.Label_VersionNumber = new System.Windows.Forms.Label(); @@ -52,7 +55,7 @@ private void InitializeComponent() this.HKEdit_Prev = new UIComposites.HotkeyEditor(); this.HKEdit_Next = new UIComposites.HotkeyEditor(); this.tab_target = new Manina.Windows.Forms.Tab(); - this.panel1 = new System.Windows.Forms.Panel(); + this.panel_target = new System.Windows.Forms.Panel(); this.HKEdit_NextTarget = new UIComposites.HotkeyEditor(); this.HKEdit_ShowTarget = new UIComposites.HotkeyEditor(); this.HKEdit_PrevTarget = new UIComposites.HotkeyEditor(); @@ -60,13 +63,13 @@ private void InitializeComponent() this.SystemTray_ContextMenu.SuspendLayout(); this.TabController.SuspendLayout(); this.tab_general.SuspendLayout(); - this.panel2.SuspendLayout(); + this.panel_general.SuspendLayout(); this.tab_volume.SuspendLayout(); this.panel_volume.SuspendLayout(); this.tab_media.SuspendLayout(); this.panel_media.SuspendLayout(); this.tab_target.SuspendLayout(); - this.panel1.SuspendLayout(); + this.panel_target.SuspendLayout(); this.SuspendLayout(); // // SystemTray @@ -81,22 +84,50 @@ private void InitializeComponent() // // SystemTray_ContextMenu // - this.SystemTray_ContextMenu.BackColor = System.Drawing.SystemColors.Menu; + this.SystemTray_ContextMenu.BackColor = System.Drawing.Color.Transparent; this.SystemTray_ContextMenu.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.SystemTray_ContextMenu.DropShadowEnabled = false; this.SystemTray_ContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.closeToolStripMenuItem}); + this.ctmi_Close, + this.ctmi_BringToFront, + this.ctmi_div1, + this.ctmi_AlwaysOnTop}); this.SystemTray_ContextMenu.Name = "system_tray_menu"; - this.SystemTray_ContextMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.SystemTray_ContextMenu.Size = new System.Drawing.Size(104, 26); + this.SystemTray_ContextMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.SystemTray_ContextMenu.ShowCheckMargin = true; + this.SystemTray_ContextMenu.ShowImageMargin = false; + this.SystemTray_ContextMenu.Size = new System.Drawing.Size(151, 76); // - // closeToolStripMenuItem + // ctmi_Close // - this.closeToolStripMenuItem.Image = global::VolumeControl.Properties.Resources.png_x; - this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; - this.closeToolStripMenuItem.Size = new System.Drawing.Size(103, 22); - this.closeToolStripMenuItem.Text = "Close"; - this.closeToolStripMenuItem.Click += new System.EventHandler(this.SystemTray_ContextMenu_Close); + this.ctmi_Close.AutoToolTip = true; + this.ctmi_Close.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.ctmi_Close.Image = global::VolumeControl.Properties.Resources.png_x; + this.ctmi_Close.Name = "ctmi_Close"; + this.ctmi_Close.Size = new System.Drawing.Size(150, 22); + this.ctmi_Close.Text = "Close"; + this.ctmi_Close.ToolTipText = "Close the application."; + this.ctmi_Close.Click += new System.EventHandler(this.SystemTray_ContextMenu_Close); + // + // ctmi_BringToFront + // + this.ctmi_BringToFront.Name = "ctmi_BringToFront"; + this.ctmi_BringToFront.Size = new System.Drawing.Size(150, 22); + this.ctmi_BringToFront.Text = "Bring to Front"; + this.ctmi_BringToFront.Click += new System.EventHandler(this.BringToFront); + // + // ctmi_div1 + // + this.ctmi_div1.Name = "ctmi_div1"; + this.ctmi_div1.Size = new System.Drawing.Size(147, 6); + // + // ctmi_AlwaysOnTop + // + this.ctmi_AlwaysOnTop.CheckOnClick = true; + this.ctmi_AlwaysOnTop.Name = "ctmi_AlwaysOnTop"; + this.ctmi_AlwaysOnTop.Size = new System.Drawing.Size(150, 22); + this.ctmi_AlwaysOnTop.Text = "Always on Top"; + this.ctmi_AlwaysOnTop.CheckedChanged += new System.EventHandler(this.AlwaysOnTop_CheckedChanged); // // HKEdit_VolumeUp // @@ -137,14 +168,14 @@ private void InitializeComponent() // TabController // this.TabController.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.TabController.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TabController.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.TabController.Controls.Add(this.tab_general); this.TabController.Controls.Add(this.tab_volume); this.TabController.Controls.Add(this.tab_media); this.TabController.Controls.Add(this.tab_target); this.TabController.Dock = System.Windows.Forms.DockStyle.Fill; this.TabController.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.TabController.ForeColor = System.Drawing.Color.Black; + this.TabController.ForeColor = System.Drawing.SystemColors.ControlText; this.TabController.Location = new System.Drawing.Point(0, 0); this.TabController.Name = "TabController"; this.TabController.SelectedIndex = 0; @@ -159,33 +190,33 @@ private void InitializeComponent() // tab_general // this.tab_general.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.tab_general.Controls.Add(this.panel2); + this.tab_general.Controls.Add(this.panel_general); this.tab_general.Font = new System.Drawing.Font("Calibri", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.tab_general.Location = new System.Drawing.Point(0, 23); + this.tab_general.Location = new System.Drawing.Point(1, 23); this.tab_general.Name = "tab_general"; this.tab_general.Padding = new System.Windows.Forms.Padding(3); - this.tab_general.Size = new System.Drawing.Size(368, 208); + this.tab_general.Size = new System.Drawing.Size(366, 206); this.tab_general.Text = "General"; // - // panel2 + // panel_general // - this.panel2.Controls.Add(this.Label_VolumeControl); - this.panel2.Controls.Add(this.TargetSelector); - this.panel2.Controls.Add(this.Label_VersionNumber); - this.panel2.Controls.Add(this.Settings); - this.panel2.Controls.Add(this.TgtSettings); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(0, 0); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(368, 208); - this.panel2.TabIndex = 12; + this.panel_general.Controls.Add(this.Label_VolumeControl); + this.panel_general.Controls.Add(this.TargetSelector); + this.panel_general.Controls.Add(this.Label_VersionNumber); + this.panel_general.Controls.Add(this.Settings); + this.panel_general.Controls.Add(this.TgtSettings); + this.panel_general.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel_general.Location = new System.Drawing.Point(0, 0); + this.panel_general.Name = "panel_general"; + this.panel_general.Size = new System.Drawing.Size(366, 206); + this.panel_general.TabIndex = 0; // // Label_VolumeControl // this.Label_VolumeControl.AutoSize = true; this.Label_VolumeControl.Font = new System.Drawing.Font("Lucida Sans Unicode", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.Label_VolumeControl.ForeColor = System.Drawing.SystemColors.ControlText; - this.Label_VolumeControl.Location = new System.Drawing.Point(38, 20); + this.Label_VolumeControl.Location = new System.Drawing.Point(38, 18); this.Label_VolumeControl.Name = "Label_VolumeControl"; this.Label_VolumeControl.Size = new System.Drawing.Size(130, 17); this.Label_VolumeControl.TabIndex = 10; @@ -202,7 +233,7 @@ private void InitializeComponent() this.TargetSelector.Name = "TargetSelector"; this.TargetSelector.SelectedIndex = -1; this.TargetSelector.SelectedItem = null; - this.TargetSelector.Size = new System.Drawing.Size(350, 30); + this.TargetSelector.Size = new System.Drawing.Size(350, 25); this.TargetSelector.TabIndex = 3; this.TargetSelector.ReloadButtonPressed += new System.EventHandler(this.Reload_Clicked); // @@ -212,12 +243,13 @@ private void InitializeComponent() this.Label_VersionNumber.BackColor = System.Drawing.Color.Transparent; this.Label_VersionNumber.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Label_VersionNumber.ForeColor = System.Drawing.SystemColors.ControlText; - this.Label_VersionNumber.Location = new System.Drawing.Point(72, 35); + this.Label_VersionNumber.Location = new System.Drawing.Point(72, 33); this.Label_VersionNumber.Name = "Label_VersionNumber"; this.Label_VersionNumber.Size = new System.Drawing.Size(62, 15); this.Label_VersionNumber.TabIndex = 11; this.Label_VersionNumber.Text = "[ version ]"; this.Label_VersionNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.Label_VersionNumber.UseMnemonic = false; // // Settings // @@ -230,7 +262,7 @@ private void InitializeComponent() this.Settings.Name = "Settings"; this.Settings.RunAtStartup = false; this.Settings.ShowInTaskbar = false; - this.Settings.Size = new System.Drawing.Size(146, 154); + this.Settings.Size = new System.Drawing.Size(140, 150); this.Settings.TabIndex = 2; this.Settings.VolumeStep = new decimal(new int[] { 5, @@ -250,7 +282,7 @@ private void InitializeComponent() this.TgtSettings.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.TgtSettings.EnableDarkMode = false; this.TgtSettings.ForeColor = System.Drawing.Color.Transparent; - this.TgtSettings.Location = new System.Drawing.Point(15, 72); + this.TgtSettings.Location = new System.Drawing.Point(15, 67); this.TgtSettings.Name = "TgtSettings"; this.TgtSettings.Size = new System.Drawing.Size(180, 92); this.TgtSettings.TabIndex = 1; @@ -263,10 +295,10 @@ private void InitializeComponent() // tab_volume // this.tab_volume.Controls.Add(this.panel_volume); - this.tab_volume.Location = new System.Drawing.Point(0, 0); + this.tab_volume.Location = new System.Drawing.Point(1, 23); this.tab_volume.Name = "tab_volume"; this.tab_volume.Padding = new System.Windows.Forms.Padding(3); - this.tab_volume.Size = new System.Drawing.Size(0, 0); + this.tab_volume.Size = new System.Drawing.Size(366, 206); this.tab_volume.Text = "Volume Hotkeys"; // // panel_volume @@ -277,15 +309,15 @@ private void InitializeComponent() this.panel_volume.Dock = System.Windows.Forms.DockStyle.Fill; this.panel_volume.Location = new System.Drawing.Point(0, 0); this.panel_volume.Name = "panel_volume"; - this.panel_volume.Size = new System.Drawing.Size(0, 0); - this.panel_volume.TabIndex = 10; + this.panel_volume.Size = new System.Drawing.Size(366, 206); + this.panel_volume.TabIndex = 0; // // tab_media // this.tab_media.Controls.Add(this.panel_media); - this.tab_media.Location = new System.Drawing.Point(0, 0); + this.tab_media.Location = new System.Drawing.Point(1, 23); this.tab_media.Name = "tab_media"; - this.tab_media.Size = new System.Drawing.Size(0, 0); + this.tab_media.Size = new System.Drawing.Size(366, 206); this.tab_media.Text = "Media Hotkeys"; // // panel_media @@ -296,8 +328,8 @@ private void InitializeComponent() this.panel_media.Dock = System.Windows.Forms.DockStyle.Fill; this.panel_media.Location = new System.Drawing.Point(0, 0); this.panel_media.Name = "panel_media"; - this.panel_media.Size = new System.Drawing.Size(0, 0); - this.panel_media.TabIndex = 3; + this.panel_media.Size = new System.Drawing.Size(366, 206); + this.panel_media.TabIndex = 0; // // HKEdit_TogglePlayback // @@ -334,22 +366,22 @@ private void InitializeComponent() // // tab_target // - this.tab_target.Controls.Add(this.panel1); - this.tab_target.Location = new System.Drawing.Point(0, 0); + this.tab_target.Controls.Add(this.panel_target); + this.tab_target.Location = new System.Drawing.Point(1, 23); this.tab_target.Name = "tab_target"; - this.tab_target.Size = new System.Drawing.Size(0, 0); + this.tab_target.Size = new System.Drawing.Size(366, 206); this.tab_target.Text = "Target Hotkeys"; // - // panel1 + // panel_target // - this.panel1.Controls.Add(this.HKEdit_NextTarget); - this.panel1.Controls.Add(this.HKEdit_ShowTarget); - this.panel1.Controls.Add(this.HKEdit_PrevTarget); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(0, 0); - this.panel1.TabIndex = 3; + this.panel_target.Controls.Add(this.HKEdit_NextTarget); + this.panel_target.Controls.Add(this.HKEdit_ShowTarget); + this.panel_target.Controls.Add(this.HKEdit_PrevTarget); + this.panel_target.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel_target.Location = new System.Drawing.Point(0, 0); + this.panel_target.Name = "panel_target"; + this.panel_target.Size = new System.Drawing.Size(366, 206); + this.panel_target.TabIndex = 0; // // HKEdit_NextTarget // @@ -409,22 +441,20 @@ private void InitializeComponent() this.SystemTray_ContextMenu.ResumeLayout(false); this.TabController.ResumeLayout(false); this.tab_general.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); + this.panel_general.ResumeLayout(false); + this.panel_general.PerformLayout(); this.tab_volume.ResumeLayout(false); this.panel_volume.ResumeLayout(false); this.tab_media.ResumeLayout(false); this.panel_media.ResumeLayout(false); this.tab_target.ResumeLayout(false); - this.panel1.ResumeLayout(false); + this.panel_target.ResumeLayout(false); this.ResumeLayout(false); } #endregion private NotifyIcon SystemTray; - private ContextMenuStrip SystemTray_ContextMenu; - private ToolStripMenuItem closeToolStripMenuItem; private UIComposites.HotkeyEditor HKEdit_VolumeUp; private UIComposites.HotkeyEditor HKEdit_VolumeDown; private UIComposites.HotkeyEditor HKEdit_VolumeMute; @@ -447,7 +477,12 @@ private void InitializeComponent() private UIComposites.TargetSelector TargetSelector; private Panel panel_volume; private Panel panel_media; - private Panel panel1; - private Panel panel2; + private Panel panel_target; + private Panel panel_general; + private ContextMenuStrip SystemTray_ContextMenu; + private ToolStripMenuItem ctmi_Close; + private ToolStripMenuItem ctmi_BringToFront; + private ToolStripSeparator ctmi_div1; + private ToolStripMenuItem ctmi_AlwaysOnTop; } } \ No newline at end of file diff --git a/VolumeControl/VolumeControlForm.cs b/VolumeControl/VolumeControlForm.cs index d76268717..c50d930a7 100644 --- a/VolumeControl/VolumeControlForm.cs +++ b/VolumeControl/VolumeControlForm.cs @@ -132,6 +132,12 @@ private bool TargetListEnabled private bool TargetListVisible => targetListForm.Visible; + public bool AlwaysOnTop + { + get => Properties.Settings.Default.AlwaysOnTop; + set => Properties.Settings.Default.AlwaysOnTop = TopMost = ctmi_AlwaysOnTop.Checked = Settings.AlwaysOnTop = value; + } + #endregion Properties #region HelperMethods @@ -423,6 +429,9 @@ private static void SaveSettings(object? sender, EventArgs e) Properties.Settings.Default.PropertyChanged += SaveSettings; } + public void BringToFront(object? sender, EventArgs e) + => BringToFront(); + #endregion HelperMethods #region ClassFunctions @@ -651,7 +660,7 @@ public VolumeControlForm() Settings.RunAtStartup = Properties.Settings.Default.RunOnStartup; Settings.MinimizeOnStartup = Properties.Settings.Default.MinimizeOnStartup; Settings.ShowInTaskbar = ShowInTaskbar = Properties.Settings.Default.VisibleInTaskbar; - Settings.AlwaysOnTop = TopMost = Properties.Settings.Default.AlwaysOnTop; + AlwaysOnTop = Properties.Settings.Default.AlwaysOnTop; Settings.DarkModeChanged -= Settings_DarkModeChanged; Settings.EnableDarkMode = Properties.Settings.Default.EnableDarkMode; Settings.DarkModeChanged += Settings_DarkModeChanged; @@ -764,11 +773,14 @@ private void VisibleInTaskbar_Changed(object sender, EventArgs e) } RegisterHotkeys(); } - private void ToastEnabled_Changed(object sender, EventArgs e) => Properties.Settings.Default.tgtlist_enabled = targetListForm.TimeoutEnabled = TargetListEnabled; + private void ToastEnabled_Changed(object sender, EventArgs e) + => Properties.Settings.Default.tgtlist_enabled = targetListForm.TimeoutEnabled = TargetListEnabled; - private void ToastTimeout_Changed(object sender, EventArgs e) => Properties.Settings.Default.tgtlist_timeout = targetListForm.Timeout = TgtSettings.TargetListTimeout; + private void ToastTimeout_Changed(object sender, EventArgs e) + => Properties.Settings.Default.tgtlist_timeout = targetListForm.Timeout = TgtSettings.TargetListTimeout; - private void AlwaysOnTop_Changed(object sender, EventArgs e) => Properties.Settings.Default.AlwaysOnTop = TopMost = Settings.AlwaysOnTop; + private void AlwaysOnTop_Changed(object sender, EventArgs e) + => AlwaysOnTop = Settings.AlwaysOnTop; private void TargetRefreshTimer_Tick(object sender, EventArgs e) { @@ -806,6 +818,8 @@ private void Settings_DarkModeChanged(object? sender, EventArgs e) } Properties.Settings.Default.EnableDarkMode = enabled; } + private void AlwaysOnTop_CheckedChanged(object sender, EventArgs e) + => AlwaysOnTop = ctmi_AlwaysOnTop.Checked; #endregion FormComponents } diff --git a/VolumeControlCLI/Program.cs b/VolumeControlCLI/Program.cs index 5c609aa95..8173f959c 100644 --- a/VolumeControlCLI/Program.cs +++ b/VolumeControlCLI/Program.cs @@ -55,7 +55,7 @@ public static int Main(string[] args) } else // not a pre release { - Console.WriteLine($"VolumeControlCLI v{currentVersion.Major}.{currentVersion.Minor}.{currentVersion.Build}{( currentVersion.Revision >= 1 ? $"-{currentVersion.Revision}" : "" )}"); + Console.WriteLine($"VolumeControlCLI v{currentVersion.Major}.{currentVersion.Minor}.{currentVersion.Build}{(currentVersion.Revision >= 1 ? $"-{currentVersion.Revision}" : "")}"); } return 0; } @@ -76,7 +76,7 @@ public static int Main(string[] args) if (arg.StartsWith("-p", StringComparison.Ordinal) || arg.StartsWith("--process", StringComparison.Ordinal)) { if (setterPos != -1) - processName = arg[( setterPos + 1 )..]; + processName = arg[(setterPos + 1)..]; else if (i + 1 < args.Length) { string nextArg = args[++i]; @@ -97,7 +97,7 @@ public static int Main(string[] args) { targets.Add(Target.VOLUME); if (setterPos != -1) - volumeLevel = Convert.ToDecimal(arg[( setterPos + 1 )..]); + volumeLevel = Convert.ToDecimal(arg[(setterPos + 1)..]); else if (i + 1 < args.Length) { string nextArg = args[++i]; @@ -153,7 +153,7 @@ public static int Main(string[] args) VolumeHelper.SetMute(processName, mute); else if (processId != null) VolumeHelper.SetMute(Convert.ToInt32(processId), mute); - Console.WriteLine($"{processName} {( mute ? "" : "un" )}muted."); + Console.WriteLine($"{processName} {(mute ? "" : "un")}muted."); } } else if (action == Action.GET)