diff --git a/DS4Windows/DS4Forms/MainWindow.xaml.cs b/DS4Windows/DS4Forms/MainWindow.xaml.cs index 8b45c1e..be6db00 100644 --- a/DS4Windows/DS4Forms/MainWindow.xaml.cs +++ b/DS4Windows/DS4Forms/MainWindow.xaml.cs @@ -705,19 +705,7 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question private void ContStatusImg_MouseRightButtonUp(object sender, MouseButtonEventArgs e) { CompositeDeviceModel item = conLvViewModel.CurrentItem; - DS4Device tempDev = item.Device; - if (tempDev.Synced && !tempDev.Charging) - { - if (tempDev.ConnectionType == ConnectionType.BT) - { - //tempDev.StopUpdate(); - tempDev.DisconnectBT(); - } - else if (tempDev.ConnectionType == ConnectionType.SONYWA) - { - tempDev.DisconnectDongle(); - } - } + item.RequestDisconnect(); } private void ExportLogBtn_Click(object sender, RoutedEventArgs e) diff --git a/DS4Windows/DS4Forms/ViewModels/ControllerListViewModel.cs b/DS4Windows/DS4Forms/ViewModels/ControllerListViewModel.cs index 5fca52d..a1864a9 100644 --- a/DS4Windows/DS4Forms/ViewModels/ControllerListViewModel.cs +++ b/DS4Windows/DS4Forms/ViewModels/ControllerListViewModel.cs @@ -405,5 +405,21 @@ namespace DS4WinWPF.DS4Forms.ViewModels SelectedIndex = profileListHolder.ProfileListCol.IndexOf(temp); } } + + public void RequestDisconnect() + { + if (device.Synced && !device.Charging) + { + if (device.ConnectionType == ConnectionType.BT) + { + //device.StopUpdate(); + device.DisconnectBT(); + } + else if (device.ConnectionType == ConnectionType.SONYWA) + { + device.DisconnectDongle(); + } + } + } } }