Esempio n. 1
0
        private void AddIndicatorPushButton(string name, double x, double y, Size size)
        {
            Helios.Controls.IndicatorPushButton indicator = new Helios.Controls.IndicatorPushButton();
            indicator.Top         = y;
            indicator.Left        = x;
            indicator.Width       = size.Width;
            indicator.Height      = size.Height;
            indicator.Image       = "{Helios}/Images/Indicators/indicator.png";
            indicator.PushedImage = "{Helios}/Images/Indicators/indicator-push.png";
            indicator.Text        = name;
            indicator.Name        = name;
            if (name == "MASTER WARNING")
            {
                indicator.OnTextColor = Color.FromArgb(0xff, 0xc7, 0x1e, 0x1e);
            }
            else
            {
                indicator.OnTextColor = Color.FromArgb(0xff, 0xb3, 0xa2, 0x29);
            }
            indicator.TextColor                      = Color.FromArgb(0xff, 0x1C, 0x1C, 0x1C);
            indicator.TextFormat.FontStyle           = FontStyles.Normal;
            indicator.TextFormat.FontWeight          = FontWeights.Normal;
            indicator.TextFormat.FontSize            = 18;
            indicator.TextFormat.FontFamily          = new FontFamily(_font);
            indicator.TextFormat.PaddingLeft         = 0;
            indicator.TextFormat.PaddingRight        = 0;
            indicator.TextFormat.PaddingTop          = 0;
            indicator.TextFormat.PaddingBottom       = 0;
            indicator.TextFormat.VerticalAlignment   = TextVerticalAlignment.Center;
            indicator.TextFormat.HorizontalAlignment = TextHorizontalAlignment.Center;

            Children.Add(indicator);
            AddTrigger(indicator.Triggers["pushed"], name);
            AddTrigger(indicator.Triggers["released"], name);

            AddAction(indicator.Actions["push"], name);
            AddAction(indicator.Actions["release"], name);
            AddAction(indicator.Actions["set.indicator"], name);
        }
Esempio n. 2
0
        protected IndicatorPushButton AddIndicatorPushButton(string name, Point pos, Size size,
                                                             string image, string pushedImage, Color textColor, Color onTextColor, string font)
        {
            string componentName          = GetComponentName(name);
            IndicatorPushButton indicator = new Helios.Controls.IndicatorPushButton
            {
                Top         = pos.Y,
                Left        = pos.X,
                Width       = size.Width,
                Height      = size.Height,
                Image       = image,
                PushedImage = pushedImage,
                Text        = name,
                Name        = componentName,
                OnTextColor = onTextColor,
                TextColor   = textColor
            };

            indicator.TextFormat.FontStyle           = FontStyles.Normal;
            indicator.TextFormat.FontWeight          = FontWeights.Normal;
            indicator.TextFormat.FontSize            = 18;
            indicator.TextFormat.FontFamily          = new FontFamily(font);
            indicator.TextFormat.PaddingLeft         = 0;
            indicator.TextFormat.PaddingRight        = 0;
            indicator.TextFormat.PaddingTop          = 0;
            indicator.TextFormat.PaddingBottom       = 0;
            indicator.TextFormat.VerticalAlignment   = TextVerticalAlignment.Center;
            indicator.TextFormat.HorizontalAlignment = TextHorizontalAlignment.Center;

            Children.Add(indicator);
            AddTrigger(indicator.Triggers["pushed"], componentName);
            AddTrigger(indicator.Triggers["released"], componentName);

            AddAction(indicator.Actions["push"], componentName);
            AddAction(indicator.Actions["release"], componentName);
            AddAction(indicator.Actions["set.indicator"], componentName);
            return(indicator);
        }
Esempio n. 3
0
        protected IndicatorPushButton AddIndicatorPushButton(string name, Point pos, Size size, string image, string pushedImage, Color textColor, Color onTextColor, string font,
                                                             string interfaceDeviceName = "", string interfaceElementName = "", string onImage = "", bool fromCenter = false, bool withText = true)
        {
            if (fromCenter)
            {
                pos = FromCenter(pos, size);
            }
            string componentName = GetComponentName(name);

            IndicatorPushButton indicator = new Helios.Controls.IndicatorPushButton
            {
                Top                    = pos.Y,
                Left                   = pos.X,
                Width                  = size.Width,
                Height                 = size.Height,
                Image                  = image,
                PushedImage            = pushedImage,
                IndicatorOnImage       = onImage,
                PushedIndicatorOnImage = onImage,
                Name                   = componentName,
                OnTextColor            = onTextColor,
                TextColor              = textColor
            };

            if (withText)
            {
                indicator.TextFormat.FontStyle           = FontStyles.Normal;
                indicator.TextFormat.FontWeight          = FontWeights.Normal;
                indicator.TextFormat.FontSize            = 18;
                indicator.TextFormat.FontFamily          = new FontFamily(font);
                indicator.TextFormat.PaddingLeft         = 0;
                indicator.TextFormat.PaddingRight        = 0;
                indicator.TextFormat.PaddingTop          = 0;
                indicator.TextFormat.PaddingBottom       = 0;
                indicator.TextFormat.VerticalAlignment   = TextVerticalAlignment.Center;
                indicator.TextFormat.HorizontalAlignment = TextHorizontalAlignment.Center;
                indicator.Text = name;
            }
            else
            {
                indicator.Text = "";
            }

            Children.Add(indicator);
            foreach (IBindingTrigger trigger in indicator.Triggers)
            {
                AddTrigger(trigger, componentName);
            }
            foreach (IBindingAction action in indicator.Actions)
            {
                AddAction(action, componentName);
            }

            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set.indicator");
            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + " Button.changed",
                deviceActionName: "set.physical state");
            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "pushed",
                interfaceActionName: interfaceDeviceName + ".push." + interfaceElementName + " Button");
            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "released",
                interfaceActionName: interfaceDeviceName + ".release." + interfaceElementName + " Button");

            return(indicator);
        }
Esempio n. 4
0
        protected IndicatorPushButton AddIndicatorPushButton(string name, Point posn, Size size,
                                                             string image, string pushedImage, Color textColor, Color onTextColor, string font,
                                                             string interfaceDeviceName, string interfaceElementName,
                                                             bool withText = true)
        {
            string componentName          = GetComponentName(name);
            IndicatorPushButton indicator = new Helios.Controls.IndicatorPushButton
            {
                Top         = posn.Y,
                Left        = posn.X,
                Width       = size.Width,
                Height      = size.Height,
                Image       = image,
                PushedImage = pushedImage,
                Name        = componentName,
                OnTextColor = onTextColor,
                TextColor   = textColor
            };

            if (withText)
            {
                indicator.TextFormat.FontStyle           = FontStyles.Normal;
                indicator.TextFormat.FontWeight          = FontWeights.Normal;
                indicator.TextFormat.FontSize            = 18;
                indicator.TextFormat.FontFamily          = ConfigManager.FontManager.GetFontFamilyByName(font);
                indicator.TextFormat.PaddingLeft         = 0;
                indicator.TextFormat.PaddingRight        = 0;
                indicator.TextFormat.PaddingTop          = 0;
                indicator.TextFormat.PaddingBottom       = 0;
                indicator.TextFormat.VerticalAlignment   = TextVerticalAlignment.Center;
                indicator.TextFormat.HorizontalAlignment = TextHorizontalAlignment.Center;
                indicator.Text = name;
            }
            else
            {
                indicator.Text = "";
            }

            Children.Add(indicator);
            AddTrigger(indicator.Triggers["pushed"], componentName);
            AddTrigger(indicator.Triggers["released"], componentName);

            AddAction(indicator.Actions["push"], componentName);
            AddAction(indicator.Actions["release"], componentName);
            AddAction(indicator.Actions["set.indicator"], componentName);

            // add the default actions
            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "pushed",
                interfaceActionName: interfaceDeviceName + ".push." + interfaceElementName
                );
            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "released",
                interfaceActionName: interfaceDeviceName + ".release." + interfaceElementName
                );
            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set.physical state");
            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set.indicator");
            return(indicator);
        }