Check for valid trigger names. Check for null value

This commit is contained in:
Travis Nickles 2019-12-30 22:35:31 -06:00
parent 694af58154
commit be93e16da6
2 changed files with 24 additions and 3 deletions

View File

@ -124,28 +124,44 @@ namespace DS4WinWPF.DS4Forms
private void LoadAction(DS4Windows.SpecialAction specialAction)
{
specialActVM.LoadAction(specialAction);
foreach(string control in specialActVM.ControlTriggerList)
string[] tempTriggers = specialActVM.ControlTriggerList.ToArray();
foreach (string control in tempTriggers)
{
foreach(CheckBox box in triggerBoxes)
bool found = false;
foreach (CheckBox box in triggerBoxes)
{
if (box.Tag.ToString() == control)
{
box.IsChecked = true;
found = true;
break;
}
}
if (!found)
{
specialActVM.ControlTriggerList.Remove(control);
}
}
foreach (string control in specialActVM.ControlUnloadTriggerList)
tempTriggers = specialActVM.ControlUnloadTriggerList.ToArray();
foreach (string control in tempTriggers)
{
bool found = false;
foreach (CheckBox box in unloadTriggerBoxes)
{
if (box.Tag.ToString() == control)
{
box.IsChecked = true;
found = true;
break;
}
}
if (!found)
{
specialActVM.ControlUnloadTriggerList.Remove(control);
}
}
switch (specialAction.typeID)

View File

@ -63,6 +63,11 @@ namespace DS4WinWPF.DS4Forms.ViewModels.SpecialActions
if (profileIndex > 0)
{
string profilename = profileList.ProfileListCol[profileIndex - 1].Name;
if (action.ucontrols == null)
{
action.ucontrols = string.Empty;
}
Global.SaveAction(action.name, action.controls, 3, profilename, edit,
action.ucontrols +
(autoUntrigger ? ((action.ucontrols?.Length ?? 0) > 0 ? "/" : "") + "AutomaticUntrigger" : ""));