Minor tweaks

This commit is contained in:
Travis Nickles 2017-08-16 18:00:44 -05:00
parent 28004dfb22
commit 5618bdb270
2 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
}
}