diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index e8d83d2..03330b3 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -41,9 +41,10 @@ namespace DS4Windows { //sp.Stream = Properties.Resources.EE; // Cause thread affinity to not be tied to main GUI thread - Task.Run(() => { - Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; - x360Bus = new X360Device(); }).Wait(); + Task x360task = new Task(() => { Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; x360Bus = new X360Device(); }); + x360task.Start(); + while (!x360task.IsCompleted) + Thread.SpinWait(500); AddtoDS4List(); diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 48e361b..85569a5 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -919,19 +919,19 @@ namespace DS4Windows protected void Form_Resize(object sender, EventArgs e) { - if (FormWindowState.Minimized == this.WindowState) + if (FormWindowState.Minimized == WindowState) { - this.Hide(); - this.ShowInTaskbar = false; - this.FormBorderStyle = FormBorderStyle.None; + Hide(); + ShowInTaskbar = false; + FormBorderStyle = FormBorderStyle.None; } - else if (FormWindowState.Normal == this.WindowState) + else if (FormWindowState.Normal == WindowState) { //mAllowVisible = true; - this.Show(); - this.ShowInTaskbar = true; - this.FormBorderStyle = FormBorderStyle.Sizable; + Show(); + ShowInTaskbar = true; + FormBorderStyle = FormBorderStyle.Sizable; } chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); diff --git a/DS4Windows/Program.cs b/DS4Windows/Program.cs index a04aae0..dde7caf 100644 --- a/DS4Windows/Program.cs +++ b/DS4Windows/Program.cs @@ -95,7 +95,7 @@ namespace DS4Windows // Create the Event handle threadComEvent = new EventWaitHandle(false, EventResetMode.ManualReset, SingleAppComEventName); - CreateInterAppComThread(); + System.Threading.Tasks.Task.Run(() => { Thread.CurrentThread.Priority = ThreadPriority.Lowest; CreateInterAppComThread(); }).Wait(); //if (mutex.WaitOne(TimeSpan.Zero, true)) //{