diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 3e77bcd..dfffa8d 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -1659,9 +1659,12 @@ namespace DS4Windows { if (cb.SelectedIndex < cb.Items.Count - 1) { - for (int i = 0; i < shortcuts[tdevice].DropDownItems.Count; i++) + for (int i = 0, arlen = shortcuts[tdevice].DropDownItems.Count; i < arlen; i++) + { if (!(shortcuts[tdevice].DropDownItems[i] is ToolStripSeparator)) ((ToolStripMenuItem)shortcuts[tdevice].DropDownItems[i]).Checked = false; + } + ((ToolStripMenuItem)shortcuts[tdevice].DropDownItems[cb.SelectedIndex]).Checked = true; LogDebug(DateTime.Now, Properties.Resources.UsingProfile.Replace("*number*", (tdevice + 1).ToString()).Replace("*Profile name*", cb.Text), false); shortcuts[tdevice].Text = Properties.Resources.ContextEdit.Replace("*number*", (tdevice + 1).ToString()); @@ -1675,6 +1678,7 @@ namespace DS4Windows } else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected ShowOptions(tdevice, ""); + if (cb.Text == "(" + Properties.Resources.NoProfileLoaded + ")") ebns[tdevice].Text = Properties.Resources.New; else diff --git a/DS4Windows/Program.cs b/DS4Windows/Program.cs index 174a204..a04aae0 100644 --- a/DS4Windows/Program.cs +++ b/DS4Windows/Program.cs @@ -19,7 +19,6 @@ namespace DS4Windows // whole system, including other users. But the application can not be brought // into view, of course. private static string SingleAppComEventName = "{a52b5b20-d9ee-4f32-8518-307fa14aa0c6}"; - //static Mutex mutex = new Mutex(true, "{FI329DM2-DS4W-J2K2-HYES-92H21B3WJARG}"); private static BackgroundWorker singleAppComThread = null; private static EventWaitHandle threadComEvent = null; private static bool exitComThread = false; @@ -117,8 +116,6 @@ namespace DS4Windows static private void CreateInterAppComThread() { singleAppComThread = new BackgroundWorker(); - //singleAppComThread.WorkerReportsProgress = false; - //singleAppComThread.WorkerSupportsCancellation = true; singleAppComThread.DoWork += new DoWorkEventHandler(singleAppComThread_DoWork); singleAppComThread.RunWorkerAsync(); } @@ -141,7 +138,7 @@ namespace DS4Windows if (!exitComThread && Application.OpenForms.Count > 0) { Form mainForm = Application.OpenForms[0]; - mainForm.Invoke(new SetFormVisableDelegate(ThreadFormVisable), mainForm); + mainForm?.Invoke(new SetFormVisableDelegate(ThreadFormVisable), mainForm); } } }