private void AddGuard(string name, string imagePrefix, Point posn, Size size, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType, NonClickableZone[] nonClickableZones, bool horizontal = true, bool horizontalRender = true) { AddToggleSwitch(name: name, posn: posn, size: size, defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/LGPanel/" + imagePrefix + "down.png", positionTwoImage: "{M2000C}/Images/LGPanel/" + imagePrefix + "up.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: horizontal, horizontalRender: horizontalRender, nonClickableZones: nonClickableZones, fromCenter: false); }
private ToggleSwitch AddSwitch(string name, string imagePrefix, Point posn, Size size, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType, bool horizontal = false) { return(AddToggleSwitch(name: name, posn: posn, size: size, defaultPosition: defaultPosition, positionOneImage: imagePrefix + "up.png", positionTwoImage: imagePrefix + "down.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: horizontal, fromCenter: false)); }
protected ToggleSwitch AddToggleSwitch(string name, Point posn, Size size, ToggleSwitchPosition defaultPosition, string positionOneImage, string positionTwoImage, ToggleSwitchType defaultType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, bool horizontal = false) { return(AddToggleSwitch(name, posn, size, defaultPosition, positionOneImage, positionTwoImage, defaultType, ClickType.Touch, interfaceDeviceName, interfaceElementName, fromCenter, horizontal)); }
protected ToggleSwitch AddToggleSwitch(string name, Point posn, Size size, ToggleSwitchPosition defaultPosition, string positionOneImage, string positionTwoImage, ToggleSwitchType defaultType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, NonClickableZone[] nonClickableZones = null, bool horizontal = false, bool horizontalRender = false) { if (fromCenter) { posn = FromCenter(posn, size); } string componentName = GetComponentName(name); ToggleSwitch newSwitch = new ToggleSwitch(); newSwitch.Name = componentName; newSwitch.SwitchType = defaultType; newSwitch.ClickType = ClickType.Touch; newSwitch.DefaultPosition = defaultPosition; newSwitch.PositionOneImage = positionOneImage; newSwitch.PositionTwoImage = positionTwoImage; newSwitch.Width = size.Width; newSwitch.Height = size.Height; newSwitch.NonClickableZones = nonClickableZones; if (horizontal) { newSwitch.Orientation = ToggleSwitchOrientation.Horizontal; } else { newSwitch.Orientation = ToggleSwitchOrientation.Vertical; } newSwitch.Top = posn.Y; newSwitch.Left = posn.X; if (horizontalRender) { newSwitch.Rotation = HeliosVisualRotation.CW; newSwitch.Orientation = ToggleSwitchOrientation.Horizontal; } Children.Add(newSwitch); foreach (IBindingTrigger trigger in newSwitch.Triggers) { AddTrigger(trigger, componentName); } AddAction(newSwitch.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(newSwitch); }
private void AddSwitch(string name, Point posn, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType) { AddToggleSwitch(name: name, posn: posn, size: new Size(45, 45), defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/FuelPanel/fuel-transfer-knob-on.png", positionTwoImage: "{M2000C}/Images/FuelPanel/fuel-transfer-knob-off.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: true, horizontalRender: true, nonClickableZones: null, fromCenter: true); }
private ToggleSwitch AddSwitch(string name, string imagePrefix1, string imagePrefix2, Point posn, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType, bool horizontal) { return(AddToggleSwitch(name: name, posn: posn, size: new Size(45, 112), defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/Switches/" + imagePrefix1 + ".png", positionTwoImage: "{M2000C}/Images/Switches/" + imagePrefix2 + ".png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: horizontal, horizontalRender: horizontal, nonClickableZones: null, fromCenter: true)); }
private void AddSwitch(string name, string imagePrefix, Point posn, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType, bool horizontal = false) { AddToggleSwitch(name: name, posn: posn, size: new Size(25, 70), defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/Switches/" + imagePrefix + "up.png", positionTwoImage: "{M2000C}/Images/SWitches/" + imagePrefix + "mid.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: horizontal, fromCenter: false); }
protected ToggleSwitch AddToggleSwitch(string name, Point posn, Size size, ToggleSwitchPosition defaultPosition, string positionOneImage, string positionTwoImage, ToggleSwitchType defaultType, ClickType clickType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, bool horizontal = false, string interfaceIndicatorElementName = "") { if (fromCenter) { posn = FromCenter(posn, size); } string componentName = GetComponentName(name); ToggleSwitch newSwitch = new ToggleSwitch(); newSwitch.Name = componentName; newSwitch.SwitchType = defaultType; newSwitch.ClickType = clickType; newSwitch.DefaultPosition = defaultPosition; newSwitch.HasIndicator = true; if (interfaceIndicatorElementName != "") { // if there is an indicatorElementname then the image names will be partial // and need to be completed newSwitch.PositionOneImage = positionOneImage + " off.png"; newSwitch.PositionTwoImage = positionTwoImage + " off.png"; newSwitch.PositionOneIndicatorOnImage = positionOneImage + " on.png"; newSwitch.PositionTwoIndicatorOnImage = positionTwoImage + " on.png"; newSwitch.HasIndicator = true; } else { newSwitch.PositionOneImage = positionOneImage; newSwitch.PositionTwoImage = positionTwoImage; newSwitch.HasIndicator = false; } newSwitch.Width = size.Width; newSwitch.Height = size.Height; newSwitch.Top = posn.Y; newSwitch.Left = posn.X; if (horizontal) { newSwitch.Rotation = HeliosVisualRotation.CW; newSwitch.Orientation = ToggleSwitchOrientation.Horizontal; } Children.Add(newSwitch); foreach (IBindingTrigger trigger in newSwitch.Triggers) { AddTrigger(trigger, componentName); } AddAction(newSwitch.Actions["set.position"], componentName); AddDefaultOutputBinding( childName: componentName, deviceTriggerName: "position.changed", interfaceActionName: interfaceDeviceName + ".set." + interfaceElementName ); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed", deviceActionName: "set.position"); if (newSwitch.HasIndicator) { AddAction(newSwitch.Actions["set.indicator"], componentName); AddDefaultInputBinding( childName: componentName, interfaceTriggerName: interfaceDeviceName + "." + interfaceIndicatorElementName + ".changed", deviceActionName: "set.indicator"); } return(newSwitch); }
private void AddCover(string name, string imagePrefix, Point posn, Size size, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType, bool horizontal = true) { AddToggleSwitch(name: name, posn: posn, size: size, defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/EnginePanel/" + imagePrefix + "guarded.png", positionTwoImage: "{M2000C}/Images/EnginePanel/" + imagePrefix + "unguarded.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: horizontal, fromCenter: false); }
protected ToggleSwitch AddToggleSwitch(string name, Point posn, Size size, ToggleSwitchPosition defaultPosition, string positionOneImage, string positionTwoImage, ToggleSwitchType defaultType, LinearClickType clickType, string interfaceDeviceName, string interfaceElementName, bool fromCenter, bool horizontal = false) { if (fromCenter) { posn = FromCenter(posn, size); } string componentName = GetComponentName(name); ToggleSwitch newSwitch = new ToggleSwitch { Name = componentName, SwitchType = defaultType, ClickType = clickType, DefaultPosition = defaultPosition, PositionOneImage = positionOneImage, PositionTwoImage = positionTwoImage, Width = size.Width, Height = size.Height, Top = posn.Y, Left = posn.X }; if (horizontal) { newSwitch.Rotation = HeliosVisualRotation.CW; newSwitch.Orientation = ToggleSwitchOrientation.Horizontal; } Children.Add(newSwitch); foreach (IBindingTrigger trigger in newSwitch.Triggers) { AddTrigger(trigger, componentName); } AddAction(newSwitch.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(newSwitch); }
private ToggleSwitch AddSwitch(string name, string imagePrefix, Point posn, ToggleSwitchPosition defaultPosition, ToggleSwitchType defaultType) { return(AddToggleSwitch(name: name, posn: posn, size: new Size(37, 75), defaultPosition: defaultPosition, positionOneImage: "{M2000C}/Images/Switches/" + imagePrefix + "down.png", positionTwoImage: "{M2000C}/Images/Switches/" + imagePrefix + "up.png", defaultType: defaultType, interfaceDeviceName: _interfaceDeviceName, interfaceElementName: name, horizontal: true, horizontalRender: true, nonClickableZones: null, fromCenter: false)); }