protected ThreeWayToggleSwitch AddRocker(string name, Point posn, Size size, ThreeWayToggleSwitchPosition defaultPosition, ThreeWayToggleSwitchType defaultType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, string positionOneImage = "{Helios}/Images/Toggles/round-up.png", string positionTwoImage = "{Helios}/Images/Toggles/round-norm.png", string positionThreeImage = "{Helios}/Images/Toggles/round-down.png", LinearClickType clickType = LinearClickType.Touch, bool horizontal = false) { string componentName = GetComponentName(name); ThreeWayToggleSwitch rocker = new ThreeWayToggleSwitch { Top = posn.Y, Left = posn.X, Width = size.Width, Height = size.Height, DefaultPosition = defaultPosition, PositionOneImage = positionOneImage, PositionTwoImage = positionTwoImage, PositionThreeImage = positionThreeImage, SwitchType = defaultType, Name = componentName, ClickType = clickType }; if (horizontal) { rocker.Rotation = HeliosVisualRotation.CW; rocker.Orientation = ToggleSwitchOrientation.Horizontal; } Children.Add(rocker); foreach (IBindingTrigger trigger in rocker.Triggers) { AddTrigger(trigger, componentName); } AddAction(rocker.Actions["set.position"], componentName); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position one.entered", interfaceActionName: interfaceDeviceName + ".push up." + interfaceElementName ); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position two.entered", interfaceActionName: interfaceDeviceName + ".release." + interfaceElementName ); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position three.entered", interfaceActionName: interfaceDeviceName + ".push down." + interfaceElementName ); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed", deviceActionName: "set.position"); return(rocker); }
protected ThreeWayToggleSwitch AddThreeWayToggle(string name, Point pos, Size size, ThreeWayToggleSwitchPosition defaultPosition, ThreeWayToggleSwitchType switchType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, string positionOneImage = "{Helios}/Images/Toggles/round-up.png", string positionTwoImage = "{Helios}/Images/Toggles/round-norm.png", string positionThreeImage = "{Helios}/Images/Toggles/round-down.png", ClickType clickType = ClickType.Swipe, bool horizontal = false, bool horizontalRender = false) { string componentName = GetComponentName(name); ThreeWayToggleSwitch toggle = new ThreeWayToggleSwitch { Top = pos.Y, Left = pos.X, Width = size.Width, Height = size.Height, DefaultPosition = defaultPosition, PositionOneImage = positionOneImage, PositionTwoImage = positionTwoImage, PositionThreeImage = positionThreeImage, SwitchType = switchType, Name = componentName }; toggle.ClickType = clickType; if (horizontal) { toggle.Orientation = ToggleSwitchOrientation.Horizontal; } else { toggle.Orientation = ToggleSwitchOrientation.Vertical; } if (horizontalRender) { toggle.Rotation = HeliosVisualRotation.CW; toggle.Orientation = ToggleSwitchOrientation.Horizontal; } Children.Add(toggle); foreach (IBindingTrigger trigger in toggle.Triggers) { AddTrigger(trigger, componentName); } AddAction(toggle.Actions["set.position"], componentName); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position.changed", interfaceActionName: interfaceDeviceName + ".set." + interfaceElementName ); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed", deviceActionName: "set.position"); return(toggle); }
protected ThreeWayToggleSwitch AddThreeWayToggle(string name, Point pos, Size size, ThreeWayToggleSwitchPosition defaultPosition, ThreeWayToggleSwitchType switchType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, string positionOneImage = "{Helios}/Images/Toggles/round-up.png", string positionTwoImage = "{Helios}/Images/Toggles/round-norm.png", string positionThreeImage = "{Helios}/Images/Toggles/round-down.png") { string componentName = GetComponentName(name); ThreeWayToggleSwitch toggle = new ThreeWayToggleSwitch { Top = pos.Y, Left = pos.X, Width = size.Width, Height = size.Height, DefaultPosition = defaultPosition, PositionOneImage = positionOneImage, PositionTwoImage = positionTwoImage, PositionThreeImage = positionThreeImage, SwitchType = switchType, Name = componentName }; Children.Add(toggle); foreach (IBindingTrigger trigger in toggle.Triggers) { AddTrigger(trigger, componentName); } AddAction(toggle.Actions["set.position"], componentName); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position.changed", interfaceActionName: interfaceDeviceName + ".set." + interfaceElementName ); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed", deviceActionName: "set.position"); return(toggle); }
private void Add3PosnToggle(string name, Point posn, Size size, string image, ThreeWayToggleSwitchType switchType, ThreeWayToggleSwitchPosition defaultPosition, string interfaceDevice, string interfaceElement, bool fromCenter, bool horizontal) { AddThreeWayToggle( name: name, pos: posn, size: size, positionOneImage: image + "up.png", positionTwoImage: image + "mid.png", positionThreeImage: image + "down.png", defaultPosition: defaultPosition, switchType: switchType, interfaceDeviceName: interfaceDevice, interfaceElementName: interfaceElement, horizontal: horizontal, horizontalRender: horizontal, clickType: LinearClickType.Touch, fromCenter: false ); }