From 3d89b3786b924797998d31ebf19b97e709271556 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 8 May 2019 01:11:36 -0500 Subject: [PATCH] Close connection to ViGEmBus before opening Driver Setup window --- DS4Windows/DS4Forms/DS4Form.Designer.cs | 10 --- DS4Windows/DS4Forms/DS4Form.cs | 46 +++++----- DS4Windows/DS4Forms/DS4Form.resx | 111 +++++++++--------------- 3 files changed, 64 insertions(+), 103 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.Designer.cs b/DS4Windows/DS4Forms/DS4Form.Designer.cs index bab0bc9..18ccdb1 100644 --- a/DS4Windows/DS4Forms/DS4Form.Designer.cs +++ b/DS4Windows/DS4Forms/DS4Form.Designer.cs @@ -160,7 +160,6 @@ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.linkProfiles = new System.Windows.Forms.LinkLabel(); this.lnkControllers = new System.Windows.Forms.LinkLabel(); - this.linkUninstall = new System.Windows.Forms.LinkLabel(); this.linkSetup = new System.Windows.Forms.LinkLabel(); this.lLBUpdate = new System.Windows.Forms.LinkLabel(); this.tabLog = new System.Windows.Forms.TabPage(); @@ -1234,7 +1233,6 @@ this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.flowLayoutPanel1.Controls.Add(this.linkProfiles); this.flowLayoutPanel1.Controls.Add(this.lnkControllers); - this.flowLayoutPanel1.Controls.Add(this.linkUninstall); this.flowLayoutPanel1.Controls.Add(this.linkSetup); this.flowLayoutPanel1.Controls.Add(this.lLBUpdate); resources.ApplyResources(this.flowLayoutPanel1, "flowLayoutPanel1"); @@ -1255,13 +1253,6 @@ this.lnkControllers.TabStop = true; this.lnkControllers.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkControllers_LinkClicked); // - // linkUninstall - // - resources.ApplyResources(this.linkUninstall, "linkUninstall"); - this.linkUninstall.Name = "linkUninstall"; - this.linkUninstall.TabStop = true; - this.linkUninstall.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkUninstall_LinkClicked); - // // linkSetup // resources.ApplyResources(this.linkSetup, "linkSetup"); @@ -1476,7 +1467,6 @@ private System.Windows.Forms.CheckBox StartWindowsCheckBox; private System.Windows.Forms.CheckBox startMinimizedCheckBox; private System.Windows.Forms.LinkLabel linkProfiles; - private System.Windows.Forms.LinkLabel linkUninstall; private System.Windows.Forms.CheckBox cBDisconnectBT; private System.Windows.Forms.CheckBox cBSwipeProfiles; private System.Windows.Forms.ToolStripMenuItem startToolStripMenuItem; diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index f4c3ff3..aaef1c7 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -286,9 +286,6 @@ namespace DS4Windows.Forms File.Delete(exepath + "\\Updater.exe"); } - if (!Directory.Exists(appdatapath + "\\Virtual Bus Driver")) - linkUninstall.Visible = false; - bool isElevated = IsAdministrator(); if (!isElevated) { @@ -437,7 +434,6 @@ namespace DS4Windows.Forms private void populateHoverTextDict() { hoverTextDict.Clear(); - hoverTextDict[linkUninstall] = Properties.Resources.IfRemovingDS4Windows; hoverTextDict[cBSwipeProfiles] = Properties.Resources.TwoFingerSwipe; hoverTextDict[cBQuickCharge] = Properties.Resources.QuickCharge; hoverTextDict[cBCloseMini] = Properties.Resources.CloseMinimize; @@ -2156,15 +2152,6 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question Process.Start(appdatapath + "\\Profiles"); } - private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - if (File.Exists(appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe")) - { - try { Process.Start(appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"); } - catch { Process.Start(appdatapath + "\\Virtual Bus Driver"); } - } - } - private void cBoxNotifications_SelectedIndexChanged(object sender, EventArgs e) { Notifications = cBoxNotifications.SelectedIndex; @@ -2172,18 +2159,35 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question private void lLSetup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - Process p = new Process(); - p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location; - p.StartInfo.Arguments = "-driverinstall"; - p.StartInfo.Verb = "runas"; - try { p.Start(); } - catch { } - //WelcomeDialog wd = new WelcomeDialog(); - //wd.ShowDialog(); + DriverSetupPrep(); + tabSettings.Text = originalsettingstext; linkSetup.LinkColor = Color.Blue; } + private void DriverSetupPrep() + { + if (btnStartStop.Text == Properties.Resources.StopText) + BtnStartStop_Clicked(false); + + TaskRunner.Run(() => + { + while (changingService) + { + Thread.SpinWait(1000); + } + + Process p = new Process(); + p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location; + p.StartInfo.Arguments = "-driverinstall"; + p.StartInfo.Verb = "runas"; + try { p.Start(); } + catch { } + //WelcomeDialog wd = new WelcomeDialog(); + //wd.ShowDialog(); + }); + } + bool tempBool = false; private void ScpForm_Closing(object sender, FormClosingEventArgs e) { diff --git a/DS4Windows/DS4Forms/DS4Form.resx b/DS4Windows/DS4Forms/DS4Form.resx index 21c4973..cacfedf 100644 --- a/DS4Windows/DS4Forms/DS4Form.resx +++ b/DS4Windows/DS4Forms/DS4Form.resx @@ -445,10 +445,10 @@ NoControl - 744, 89 + 742, 89 - 149, 22 + 151, 22 50 @@ -472,7 +472,7 @@ NoControl - 345, 34 + 343, 34 39, 20 @@ -574,7 +574,7 @@ NoControl - 704, 89 + 702, 89 34, 22 @@ -604,7 +604,7 @@ NoControl - 704, 117 + 702, 117 34, 22 @@ -703,7 +703,7 @@ None - 587, 33 + 585, 33 111, 21 @@ -730,7 +730,7 @@ NoControl - 704, 61 + 702, 61 34, 22 @@ -757,7 +757,7 @@ None - 587, 61 + 585, 61 111, 21 @@ -781,7 +781,7 @@ None - 587, 89 + 585, 89 111, 21 @@ -808,7 +808,7 @@ NoControl - 704, 33 + 702, 33 34, 22 @@ -835,7 +835,7 @@ None - 587, 117 + 585, 117 111, 21 @@ -868,7 +868,7 @@ NoControl - 588, 7 + 586, 7 109, 15 @@ -940,7 +940,7 @@ NoControl - 341, 7 + 339, 7 47, 15 @@ -976,7 +976,7 @@ NoControl - 434, 7 + 432, 7 51, 15 @@ -1012,7 +1012,7 @@ NoControl - 440, 36 + 438, 36 39, 15 @@ -1048,7 +1048,7 @@ NoControl - 440, 64 + 438, 64 39, 15 @@ -1084,7 +1084,7 @@ NoControl - 440, 92 + 438, 92 39, 15 @@ -1120,7 +1120,7 @@ NoControl - 440, 120 + 438, 120 39, 15 @@ -1150,7 +1150,7 @@ NoControl - 345, 62 + 343, 62 39, 20 @@ -1180,7 +1180,7 @@ NoControl - 345, 90 + 343, 90 39, 20 @@ -1210,7 +1210,7 @@ NoControl - 345, 118 + 343, 118 39, 20 @@ -1243,10 +1243,10 @@ NoControl - 744, 33 + 742, 33 - 149, 22 + 151, 22 50 @@ -1273,10 +1273,10 @@ NoControl - 744, 61 + 742, 61 - 149, 22 + 151, 22 51 @@ -1303,10 +1303,10 @@ NoControl - 744, 117 + 742, 117 - 149, 22 + 151, 22 52 @@ -1336,7 +1336,7 @@ NoControl - 510, 0 + 508, 0 67, 30 @@ -1375,7 +1375,7 @@ NoControl - 536, 37 + 534, 37 15, 14 @@ -1408,7 +1408,7 @@ NoControl - 536, 65 + 534, 65 15, 14 @@ -1441,7 +1441,7 @@ NoControl - 536, 93 + 534, 93 15, 14 @@ -1474,7 +1474,7 @@ NoControl - 536, 121 + 534, 121 15, 14 @@ -1522,7 +1522,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /></Controls><Columns Styles="Percent,62,29144,Percent,20,02225,Percent,17,68632,Absolute,80,AutoSize,0,AutoSize,0,Absolute,154" /><Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /></Controls><Columns Styles="Percent,62.29144,Percent,20.02225,Percent,17.68632,Absolute,80,AutoSize,0,AutoSize,0,Absolute,155" /><Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /></TableLayoutSettings> Fill @@ -2824,7 +2824,7 @@ languagePackComboBox1 - DS4Windows.DS4Forms.LanguagePackComboBox, DS4Windows, Version=1.7.7.0, Culture=neutral, PublicKeyToken=null + DS4Windows.DS4Forms.LanguagePackComboBox, DS4Windows, Version=1.7.8.0, Culture=neutral, PublicKeyToken=null fLPSettings @@ -2949,39 +2949,6 @@ 1 - - True - - - NoControl - - - 7, 30 - - - 106, 13 - - - 44 - - - Uninstall VBus Driver - - - MiddleCenter - - - linkUninstall - - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanel1 - - - 2 - True @@ -2989,7 +2956,7 @@ NoControl - 7, 43 + 7, 30 115, 13 @@ -3010,7 +2977,7 @@ flowLayoutPanel1 - 3 + 2 True @@ -3019,7 +2986,7 @@ NoControl - 7, 56 + 7, 43 116, 13 @@ -3043,7 +3010,7 @@ flowLayoutPanel1 - 4 + 3 TopDown @@ -3598,7 +3565,7 @@ advColorDialog - DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.7.7.0, Culture=neutral, PublicKeyToken=null + DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.7.8.0, Culture=neutral, PublicKeyToken=null DS4Form