mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 19:14:20 +01:00
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DS4Windows;
|
|
using DS4WinWPF.DS4Forms.ViewModels.Util;
|
|
|
|
namespace DS4WinWPF.DS4Forms.ViewModels.SpecialActions
|
|
{
|
|
public class SASteeringWheelViewModel : NotifyDataErrorBase
|
|
{
|
|
private int delay;
|
|
public int Delay { get => delay; set => delay = value; }
|
|
|
|
public void LoadAction(SpecialAction action)
|
|
{
|
|
delay = (int)action.delayTime;
|
|
}
|
|
|
|
public void SaveAction(SpecialAction action, bool edit = false)
|
|
{
|
|
Global.SaveAction(action.name, action.controls, 7, delay.ToString(), edit);
|
|
}
|
|
|
|
public override bool IsValid(SpecialAction action)
|
|
{
|
|
ClearOldErrors();
|
|
|
|
bool valid = true;
|
|
List<string> delayErrors = new List<string>();
|
|
|
|
if (delay < 0 || delay > 60)
|
|
{
|
|
delayErrors.Add("Delay out of range");
|
|
errors["Delay"] = delayErrors;
|
|
RaiseErrorsChanged("Delay");
|
|
}
|
|
|
|
return valid;
|
|
}
|
|
|
|
public override void ClearOldErrors()
|
|
{
|
|
if (errors.Count > 0)
|
|
{
|
|
errors.Clear();
|
|
RaiseErrorsChanged("Delay");
|
|
}
|
|
}
|
|
}
|
|
}
|