summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsot <matthewsot@outlook.com>2017-06-17 13:29:34 -0700
committermatthewsot <matthewsot@outlook.com>2017-06-17 13:29:34 -0700
commitad4dec3d13bef9ca5d5cd6def461d7cdfbcfe282 (patch)
tree773307d8f57a3515bdffe34fc63101fd68a2b657
parentbddc21d5f6fe992f00bbedef0439c193c2090b79 (diff)
assorted code updates, added a checkbox
-rw-r--r--.README.md.swpbin0 -> 12288 bytes
-rw-r--r--AntiVol/.vs/AntiVol/v15/sqlite3/storage.idebin0 -> 618496 bytes
-rw-r--r--AntiVol/AntiVol/Form1.Designer.cs42
-rw-r--r--AntiVol/AntiVol/Form1.cs74
-rw-r--r--AntiVol/AntiVol/Program.cs3
-rw-r--r--AntiVol/AntiVol/Properties/AssemblyInfo.cs1
6 files changed, 47 insertions, 73 deletions
diff --git a/.README.md.swp b/.README.md.swp
new file mode 100644
index 0000000..7bf8072
--- /dev/null
+++ b/.README.md.swp
Binary files differ
diff --git a/AntiVol/.vs/AntiVol/v15/sqlite3/storage.ide b/AntiVol/.vs/AntiVol/v15/sqlite3/storage.ide
new file mode 100644
index 0000000..db61017
--- /dev/null
+++ b/AntiVol/.vs/AntiVol/v15/sqlite3/storage.ide
Binary files differ
diff --git a/AntiVol/AntiVol/Form1.Designer.cs b/AntiVol/AntiVol/Form1.Designer.cs
index 2246cbf..0464f92 100644
--- a/AntiVol/AntiVol/Form1.Designer.cs
+++ b/AntiVol/AntiVol/Form1.Designer.cs
@@ -28,49 +28,39 @@
/// </summary>
private void InitializeComponent()
{
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
+ this.mainToggle = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
- // button1
+ // mainToggle
//
- this.button1.Location = new System.Drawing.Point(71, 29);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "Enable";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(71, 74);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "Disable";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
+ this.mainToggle.AutoSize = true;
+ this.mainToggle.Checked = true;
+ this.mainToggle.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.mainToggle.Location = new System.Drawing.Point(12, 12);
+ this.mainToggle.Name = "mainToggle";
+ this.mainToggle.Size = new System.Drawing.Size(130, 17);
+ this.mainToggle.TabIndex = 2;
+ this.mainToggle.Text = "Hide the volume slider";
+ this.mainToggle.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(284, 261);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
+ this.ClientSize = new System.Drawing.Size(160, 42);
+ this.Controls.Add(this.mainToggle);
this.Name = "Form1";
this.ShowInTaskbar = false;
- this.Text = "Form1";
+ this.Text = "AntiVol";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.CheckBox mainToggle;
}
}
diff --git a/AntiVol/AntiVol/Form1.cs b/AntiVol/AntiVol/Form1.cs
index 0df68b8..5f7eec2 100644
--- a/AntiVol/AntiVol/Form1.cs
+++ b/AntiVol/AntiVol/Form1.cs
@@ -1,62 +1,50 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using NAudio.CoreAudioApi;
namespace AntiVol
{
public partial class Form1 : Form
{
-
public Form1()
{
InitializeComponent();
Program.hook.KeyIntercepted += Hook_KeyIntercepted;
}
- private bool enabled = true;
-
private bool Hook_KeyIntercepted(KeyboardHook.KeyboardHookEventArgs e)
{
- if (!enabled) return true;
- if (!e.KeyName.Contains("Volume") && e.KeyName != "Scroll") return true;
-
- if (e.KeyName == "Scroll")
- {
- //TODO: make it a taskbar thing
- WindowState = FormWindowState.Normal; //using scroll lock as the hotkey for this, as I never have any other use for it
- return false;
- }
-
- //Thanks! https://stackoverflow.com/questions/2534595/get-master-sound-volume-in-c-sharp
- MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
- MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
- switch (e.KeyName)
- {
- case "VolumeUp":
- defaultDevice.AudioEndpointVolume.VolumeStepUp();
- break;
- case "VolumeDown":
- defaultDevice.AudioEndpointVolume.VolumeStepDown();
- break;
- case "VolumeMute":
- defaultDevice.AudioEndpointVolume.Mute = !defaultDevice.AudioEndpointVolume.Mute;
- break;
- case "MediaNextTrack":
- break;
+ try
+ {
+ if (!mainToggle.Checked) return true;
+ if (!e.KeyName.Contains("Volume") && e.KeyName != "Scroll") return true;
+
+ if (e.KeyName == "Scroll")
+ {
+ //TODO: make it a taskbar thing
+ WindowState = FormWindowState.Normal; //using scroll lock as the hotkey for this, as I never have any other use for it
+ return false;
+ }
+
+ //Thanks! https://stackoverflow.com/questions/2534595/get-master-sound-volume-in-c-sharp
+ MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
+ MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
+ switch (e.KeyName)
+ {
+ case "VolumeUp":
+ defaultDevice.AudioEndpointVolume.VolumeStepUp();
+ break;
+ case "VolumeDown":
+ defaultDevice.AudioEndpointVolume.VolumeStepDown();
+ break;
+ case "VolumeMute":
+ defaultDevice.AudioEndpointVolume.Mute = !defaultDevice.AudioEndpointVolume.Mute;
+ break;
+ case "MediaNextTrack":
+ break;
+ }
}
+ finally { }
return false;
}
-
- private KeyboardHook hook;
-
- private void button1_Click(object sender, EventArgs e)
- {
- enabled = true;
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- enabled = false;
- }
}
}
diff --git a/AntiVol/AntiVol/Program.cs b/AntiVol/AntiVol/Program.cs
index d62fa1c..85b4ee3 100644
--- a/AntiVol/AntiVol/Program.cs
+++ b/AntiVol/AntiVol/Program.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace AntiVol
diff --git a/AntiVol/AntiVol/Properties/AssemblyInfo.cs b/AntiVol/AntiVol/Properties/AssemblyInfo.cs
index cee779a..3ae79b7 100644
--- a/AntiVol/AntiVol/Properties/AssemblyInfo.cs
+++ b/AntiVol/AntiVol/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback