From 41ebb0d7161f25951625593e3d57e3d33e5489d3 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 17 Aug 2018 14:36:35 -0500 Subject: [PATCH] Use BeginInvoke in timer method --- DS4Windows/DS4Forms/DS4Form.cs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index ed02469..0cb547b 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -535,22 +535,32 @@ namespace DS4Windows string slide = Program.rootHub.TouchpadSlide(i); if (slide == "left") { - if (cbs[i].SelectedIndex <= 0) - cbs[i].SelectedIndex = cbs[i].Items.Count - 2; - else - cbs[i].SelectedIndex--; - + this.BeginInvoke((System.Action)(() => + { + if (cbs[i].SelectedIndex <= 0) + cbs[i].SelectedIndex = cbs[i].Items.Count - 2; + else + cbs[i].SelectedIndex--; + })); } else if (slide == "right") { - if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2) - cbs[i].SelectedIndex = 0; - else - cbs[i].SelectedIndex++; + this.BeginInvoke((System.Action)(() => + { + if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2) + cbs[i].SelectedIndex = 0; + else + cbs[i].SelectedIndex++; + })); } if (slide.Contains("t")) - ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text)); + { + this.BeginInvoke((System.Action)(() => + { + ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text)); + })); + } } }