Replaced another timer

This commit is contained in:
Travis Nickles 2018-02-19 05:48:46 -06:00
parent a4abe7e98e
commit 99197be610

View File

@ -4,6 +4,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using NonFormTimer = System.Timers.Timer;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@ -13,7 +14,8 @@ namespace DS4Windows
public partial class RecordBox : Form public partial class RecordBox : Form
{ {
Stopwatch sw = new Stopwatch(); Stopwatch sw = new Stopwatch();
Timer ds4 = new Timer(); //Timer ds4 = new Timer();
NonFormTimer ds4 = new NonFormTimer();
public List<int> macros = new List<int>(), macrosAfter = new List<int>(); public List<int> macros = new List<int>(), macrosAfter = new List<int>();
public List<string> macronames = new List<string>(); public List<string> macronames = new List<string>();
SpecActions sA; SpecActions sA;
@ -38,7 +40,8 @@ namespace DS4Windows
} }
AddtoDS4List(); AddtoDS4List();
ds4.Tick += ds4_Tick; //ds4.Tick += ds4_Tick;
ds4.Elapsed += ds4_Tick;
ds4.Interval = 1; ds4.Interval = 1;
if (kbm.macrostag.Count > 0) if (kbm.macrostag.Count > 0)
{ {
@ -61,7 +64,8 @@ namespace DS4Windows
if (button > -1) if (button > -1)
sAButton = button; sAButton = button;
ds4.Tick += ds4_Tick; //ds4.Tick += ds4_Tick;
ds4.Elapsed += ds4_Tick;
ds4.Interval = 1; ds4.Interval = 1;
lbRecordTip.Visible = false; lbRecordTip.Visible = false;
cBStyle.Visible = false; cBStyle.Visible = false;
@ -122,11 +126,14 @@ namespace DS4Windows
bool[] pTP = new bool[4]; bool[] pTP = new bool[4];
void ds4_Tick(object sender, EventArgs e) //void ds4_Tick(object sender, EventArgs e)
private void ds4_Tick(object sender, System.Timers.ElapsedEventArgs e)
{ {
if (Program.rootHub.DS4Controllers[0] != null) if (Program.rootHub.DS4Controllers[0] != null)
{ {
cState = Program.rootHub.getDS4State(0); cState = Program.rootHub.getDS4State(0);
this.BeginInvoke((Action)(() =>
{
if (btnRecord.Text == Properties.Resources.StopText) if (btnRecord.Text == Properties.Resources.StopText)
{ {
if (cBRecordDelays.Checked) if (cBRecordDelays.Checked)
@ -227,6 +234,7 @@ namespace DS4Windows
} }
} }
} }
}));
} }
} }