protected void AddDefaultInputBinding(string childName, string interfaceTriggerName, string deviceActionName) { DefaultInputBindings.Add(new DefaultInputBinding( childName: childName, interfaceTriggerName: interfaceTriggerName, deviceActionName: deviceActionName )); }
/// <summary> /// A-10C UHF Radio Load Button. /// This includes binding the hidden action to the switch positions of the cover which sits beneath the button to make them reversed visually. /// This is also the first use case of DefaultInputBinding's deviceTriggerName & deviceTriggerBindingValue in composite visual /// </summary> /// <param name="name">name of element</param> /// <param name="x">Horizontal coordinate of the button</param> /// <param name="y">Vertical coordinate of the button</param> /// <param name="size">Size of the button</param> /// <param name="interfaceElementName">Name of the corresponding trigger</param> private void AddLoadButton(string name, double x, double y, Size size, string interfaceElementName) { string componentName = _interfaceDeviceName + "_" + name; PushButton newButton = new PushButton { Top = y, Left = x, Width = size.Width, Height = size.Height, Image = _imageLocation + "A-10C_UHF_Radio_Red_Button_Unpressed.png", PushedImage = _imageLocation + "A-10C_UHF_Radio_Red_Button_Pressed.png", Text = "", Name = componentName, IsHidden = true }; Children.Add(newButton); AddTrigger(newButton.Triggers["pushed"], componentName); AddTrigger(newButton.Triggers["released"], componentName); AddAction(newButton.Actions["set.hidden"], componentName); AddAction(newButton.Actions["set.physical state"], componentName); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position.changed", interfaceActionName: _interfaceDeviceName + ".set." + interfaceElementName ); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: _interfaceDeviceName + "." + interfaceElementName + ".changed", deviceActionName: "set.physical state"); DefaultInputBindings.Add(new DefaultInputBinding( childName: componentName, interfaceTriggerName: "", deviceTriggerName: "UHF Radio_Cover.position two.entered", deviceActionName: "set.hidden", deviceTriggerBindingValue: new BindingValue(false))); DefaultInputBindings.Add(new DefaultInputBinding( childName: componentName, interfaceTriggerName: "", deviceTriggerName: "UHF Radio_Cover.position one.entered", deviceActionName: "set.hidden", deviceTriggerBindingValue: new BindingValue(true))); }