Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a checkbox for controlling if the window opens on double click #2227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions FortyOne.AudioSwitcher/AudioSwitcher.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions FortyOne.AudioSwitcher/AudioSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ private void LoadSettings()
chkAutoStartWithWindows.Checked = Program.Settings.AutoStartWithWindows;
chkDisableHotKeys.Checked = Program.Settings.DisableHotKeys;
chkQuickSwitch.Checked = Program.Settings.EnableQuickSwitch;
chkDisableDblClick.Checked = Program.Settings.DisableDoubleClick;
chkDualSwitchMode.Checked = Program.Settings.DualSwitchMode;
chkNotifyUpdates.Checked = Program.Settings.UpdateNotificationsEnabled;

Expand Down Expand Up @@ -1317,9 +1318,12 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)

private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
Show();
BringToFront();
SetForegroundWindow(Handle);
if (!Program.Settings.DisableDoubleClick)
{
Show();
BringToFront();
SetForegroundWindow(Handle);
}
}

private void Form1_Activated(object sender, EventArgs e)
Expand Down Expand Up @@ -1364,6 +1368,10 @@ private void chkQuickSwitch_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.EnableQuickSwitch = chkQuickSwitch.Checked;
}
private void chkDisableDblClick_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.DisableDoubleClick = chkDisableDblClick.Checked;
}

private void chkDualSwitchMode_CheckedChanged(object sender, EventArgs e)
{
Expand Down
15 changes: 15 additions & 0 deletions FortyOne.AudioSwitcher/Configuration/ConfigurationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ConfigurationSettings
public const string SETTING_WINDOWHEIGHT = "WindowHeight";
public const string SETTING_DISABLEHOTKEYS = "DisableHotKeys";
public const string SETTING_ENABLEQUICKSWITCH = "EnableQuickSwitch";
public const string SETTING_DISABLEDOUBLECLICK = "DisableDoubleClick";
public const string SETTING_CHECKFORUPDATESONSTARTUP = "CheckForUpdatesOnStartup";
public const string SETTING_POLLFORUPDATES = "PollForUpdates";
public const string SETTING_STARTUPRECORDINGDEVICE = "StartupRecordingDeviceID";
Expand Down Expand Up @@ -230,6 +231,16 @@ public bool EnableQuickSwitch
set { _configWriter.Set(SETTING_ENABLEQUICKSWITCH, value.ToString()); }
}

public bool DisableDoubleClick
{
get
{
return
Convert.ToBoolean(_configWriter.Get(SETTING_DISABLEDOUBLECLICK));
}
set { _configWriter.Set(SETTING_DISABLEDOUBLECLICK, value.ToString()); }
}

public bool UpdateNotificationsEnabled
{
get
Expand Down Expand Up @@ -257,6 +268,9 @@ public void CreateDefaults()
if (!SettingExists(SETTING_ENABLEQUICKSWITCH))
EnableQuickSwitch = false;

if (!SettingExists(SETTING_DISABLEDOUBLECLICK))
DisableDoubleClick = false;

if (!SettingExists(SETTING_HOTKEYS))
HotKeys = "[]";

Expand Down Expand Up @@ -310,6 +324,7 @@ public void LoadFrom(ConfigurationSettings otherSettings)
DisableHotKeys = otherSettings.DisableHotKeys;
DualSwitchMode = otherSettings.DualSwitchMode;
EnableQuickSwitch = otherSettings.EnableQuickSwitch;
DisableDoubleClick = otherSettings.DisableDoubleClick;
FavouriteDevices = otherSettings.FavouriteDevices;
HotKeys = otherSettings.HotKeys;
PollForUpdates = otherSettings.PollForUpdates;
Expand Down