Fixed bug with code executing with no user input

This should not be happening in the first place
This commit is contained in:
Travis Nickles 2017-05-17 10:59:49 -07:00
parent 84fdb26d18
commit 1ef0b04dbc
2 changed files with 8 additions and 4 deletions

View File

@ -825,8 +825,10 @@ namespace DS4Windows
public static SpecialAction GetAction(string name)
{
foreach (SpecialAction sA in m_Config.actions)
//foreach (SpecialAction sA in m_Config.actions)
for (int i=0, actionCount = m_Config.actions.Count; i < actionCount; i++)
{
SpecialAction sA = m_Config.actions[i];
if (sA.name == name)
return sA;
}
@ -848,8 +850,8 @@ namespace DS4Windows
foreach (string actionname in m_Config.profileActions[device])
{
m_Config.profileActionDict[device].Add(actionname, Global.GetAction(actionname));
m_Config.profileActionIndexDict[device].Add(actionname, Global.GetActionIndexOf(actionname));
m_Config.profileActionDict[device][actionname] = GetAction(actionname);
m_Config.profileActionIndexDict[device][actionname] = GetActionIndexOf(actionname);
}
}

View File

@ -2680,7 +2680,9 @@ namespace DS4Windows
private void lVActions_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (actionTabSeen)
// Code can get executed even when control is not visible.
// Should not be happening
if (lVActions.Visible && actionTabSeen)
{
List<string> pactions = new List<string>();
foreach (ListViewItem lvi in lVActions.Items)