private void ButtonGUIDToClipboard_Click(object sender, RoutedEventArgs e) { DirectInputGamepad gamingDevice = DataContext as DirectInputGamepad; if (gamingDevice != null) { Clipboard.SetText(gamingDevice.DeviceInfo.InstanceGuid.ToString()); } else { MessageBox.Show("Error getting DirectInputDevice from DataContext."); } }
/*void GetGamingDevices() * { * DirectInputManager.ReloadDevices(); * * GamingDevices = DirectInputManager.Devices; * }*/ private void ListBoxDevices_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListBoxDevices.SelectedIndex == -1) { SelectedDevice = null; Stack_Buttons.Visibility = Visibility.Hidden; Stack_ThumbSticks.Visibility = Visibility.Hidden; _PollTimer.Stop(); } else { SelectedDevice = DirectInputManager.Devices[ListBoxDevices.SelectedIndex]; /*var infoArray = SelectedDevice.Device.ImageInformation.ImageInformationArray; * foreach (var item in infoArray) * { * if (item.ImagePath != null) * { * Cmn.Msg(item.ImagePath); * } * }*/ _CreateBottonIndicatorControls(SelectedDevice.Buttons.NumberOfButtons); Stack_Buttons.Visibility = Visibility.Visible; _SetThumbStickGaugeControls(SelectedDevice.ThumbSticks); Stack_ThumbSticks.Visibility = Visibility.Visible; _SetDPadsGaugeControls(SelectedDevice.DPads); Stack_DPads.Visibility = Visibility.Visible; _PollTimer.Start(); //Cmn.Msg( ///* Microsoft.DirectX.DirectInput.Device */ SelectedDevice.Device // // .GetBufferedData. // //.Properties // //.GetKeyName(Microsoft.DirectX.DirectInput.ParameterHow.ById, 0) //); } }
private void This_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { DirectInputGamepad gamingDevice = e.NewValue as DirectInputGamepad; if (gamingDevice != null) { TBlock_UniqueName.Text = gamingDevice.Name; //TBlock_InstanceName.Text = gamingDevice.DeviceInfo.InstanceName; TBlock_ThumbSticks_Left.Visibility = Common.BoolToVisibility(gamingDevice.ThumbSticks.HasLeft); TBlock_ThumbSticks_Right.Visibility = Common.BoolToVisibility(gamingDevice.ThumbSticks.HasRight); TBlock_ThumbSticks_Third.Visibility = Common.BoolToVisibility(gamingDevice.ThumbSticks.HasThird); TBlock_ButtonsCount.Text = gamingDevice.Buttons.NumberOfButtons.ToString() + " buttons"; //RCommon.Cmn.Msg(gamingDevice.Device.DeviceInformation.ToString(), true); var sb = new StringBuilder(); sb .Append("ProductName: ").AppendLine(gamingDevice.DeviceInfo.ProductName) .Append("InstanceName: ").AppendLine(gamingDevice.DeviceInfo.InstanceName) .Append("DeviceType / SubType: ") .Append(gamingDevice.RawDevice.DeviceInformation.DeviceType) .Append(" / ") .AppendLine(gamingDevice.DeviceInfo.DeviceSubType.ToString()) .Append("My DeviceType: ").Append(gamingDevice.Type.ToString()); /*DeviceType[] subTypes = Common.GetUniqueFlags(gamingDevice.Types).Cast<DeviceType>().ToArray(); * * sb.Append("Inst.DeviceType(").Append(subTypes.Length).Append("): "); * * if (subTypes.Length > 0) * { * foreach (DeviceType typeFlag in subTypes) * { * sb.Append(typeFlag).Append(" - "); * } * sb.Remove(sb.Length - 3, 3); * } * sb.AppendLine();*/ TBlock_Info.Text = sb.ToString(); TBlock_ProductGUID.Text = "Product GUID: " + gamingDevice.DeviceInfo.ProductGuid.ToString(); TBlock_DriverGUID.Text = "Driver GUID: " + gamingDevice.DeviceInfo.FFDriverGuid.ToString(); TBlock_InstanceGUID.Text = "Instance GUID: " + gamingDevice.DeviceInfo.InstanceGuid.ToString(); } }
public Input2D_GenericController_ThumbStick(DirectInputGamepad parentDevice, byte thumbStickIndex) { ParentDevice = parentDevice; ThumbStickIndex = thumbStickIndex; }
//public Guid? DeviceID { get { return InputDevice.Guid; } } public InputButton_GenericController_DebugFixed(DirectInputGamepad inputDevice) { InputDevice = inputDevice; }
/*public InputButtonGenericController(DirectInputDevice inputDevice) * { * InputDevice = inputDevice; * }*/ public InputButton_GenericController(DirectInputGamepad parentDevice, int buttonNumber) { ParentDevice = parentDevice; _ButtonNumber = buttonNumber; }
public static void UpdateDirectInputDevice(DirectInputGamepad device) { device.Poll(); device.Buttons.Refresh(); device.ThumbSticks.Refresh(); }
public Input2D_GenericController_DPad(DirectInputGamepad parentDevice, int dPadIndex) { ParentDPad = parentDevice.DPads[dPadIndex]; DPadIndex = dPadIndex; }