Moved right click disconnect method to View Model

This commit is contained in:
Travis Nickles 2019-12-20 20:17:57 -06:00
parent c4cdade076
commit c865e3c9b2
2 changed files with 17 additions and 13 deletions

View File

@ -705,19 +705,7 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
private void ContStatusImg_MouseRightButtonUp(object sender, MouseButtonEventArgs e) private void ContStatusImg_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{ {
CompositeDeviceModel item = conLvViewModel.CurrentItem; CompositeDeviceModel item = conLvViewModel.CurrentItem;
DS4Device tempDev = item.Device; item.RequestDisconnect();
if (tempDev.Synced && !tempDev.Charging)
{
if (tempDev.ConnectionType == ConnectionType.BT)
{
//tempDev.StopUpdate();
tempDev.DisconnectBT();
}
else if (tempDev.ConnectionType == ConnectionType.SONYWA)
{
tempDev.DisconnectDongle();
}
}
} }
private void ExportLogBtn_Click(object sender, RoutedEventArgs e) private void ExportLogBtn_Click(object sender, RoutedEventArgs e)

View File

@ -405,5 +405,21 @@ namespace DS4WinWPF.DS4Forms.ViewModels
SelectedIndex = profileListHolder.ProfileListCol.IndexOf(temp); 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();
}
}
}
} }
} }