private void OpenDeviceButton_OnClick(object sender, RoutedEventArgs e) { _device = new UsbBlankGamepad(_wdiCurrent.HardwareId, string.Format("{0}_hid-report.dump.txt", _wdiCurrent.Description)); if (_device.Open() && _device.Start()) { InterpretButton.IsEnabled = true; RevertButton.IsEnabled = true; new TaskDialog { Buttons = {new TaskDialogButton(ButtonType.Ok)}, WindowTitle = "Yay!", Content = "Device opened successfully, proceed with the next step now.", MainIcon = TaskDialogIcon.Information }.ShowDialog(this); } else { new TaskDialog { Buttons = {new TaskDialogButton(ButtonType.Ok)}, WindowTitle = "Ohnoes!", Content = "It didn't work! What a shame :( Please reboot your machine, cross your fingers and try again.", MainIcon = TaskDialogIcon.Error }.ShowDialog(this); } }
private void OpenDeviceButton_OnClick(object sender, RoutedEventArgs e) { if (SelectedHidDevice == null) { new TaskDialog { Buttons = { new TaskDialogButton(ButtonType.Ok) }, WindowTitle = "Hey!", Content = "Please select a device first :)", MainIcon = TaskDialogIcon.Error }.ShowDialog(this); return; } _device = new UsbBlankGamepad(SelectedHidDevice, SelectedHidDevice.DevicePath, string.Format("{0}_hid-report.dump.txt", SelectedHidDevice.ProductName)); if (_device.Open(SelectedHidDevice.DevicePath) && _device.Start()) { InterpretButton.IsEnabled = true; CloseButton.IsEnabled = true; new TaskDialog { Buttons = {new TaskDialogButton(ButtonType.Ok)}, WindowTitle = "Well that worked!", Content = "All fine, proceed with the next step now.", MainIcon = TaskDialogIcon.Information }.ShowDialog(this); } else { new TaskDialog { Buttons = {new TaskDialogButton(ButtonType.Ok)}, WindowTitle = "Ohnoes!", Content = "It didn't work! What a shame :( Please reboot your machine, cross your fingers and try again.", MainIcon = TaskDialogIcon.Error }.ShowDialog(this); } }