Exemple #1
0
        public static MvcHtmlString AnchorButton(this HtmlHelper html, string text, ActionResult result,
                                                 ButtonColor color = ButtonColor.Default, ButtonSize size = ButtonSize.Default)
        {
            UrlHelper url = new UrlHelper(html.ViewContext.RequestContext);

            return(AnchorButton(html, text, url.Action(result), color, size));
        }
 public void SwitchButton(ButtonColor color)
 {
     if (buttons[(int)color] != null)
     {
         buttons[(int)color].GetComponent <Image>().enabled = !buttons[(int)color].GetComponent <Image>().enabled;
     }
 }
Exemple #3
0
        private static Tag AddCss(this Tag tag, ButtonColor color)
        {
            switch (color)
            {
            case ButtonColor.Blue: tag.Css("btn-blue"); break;

            case ButtonColor.Orange: tag.Css("btn-orange"); break;

            case ButtonColor.Red: tag.Css("btn-red"); break;

            case ButtonColor.Green: tag.Css("btn-green"); break;

            case ButtonColor.Black: tag.Css("btn-black"); break;

            case ButtonColor.Purple: tag.Css("btn-purple"); break;

            case ButtonColor.Navy: tag.Css("btn-navy"); break;

            case ButtonColor.Maroon: tag.Css("btn-maroon"); break;

            case ButtonColor.Grey: tag.Css("btn-grey"); break;

            case ButtonColor.Yellow: tag.Css("btn-yellow"); break;

            case ButtonColor.Teal: tag.Css("btn-teal"); break;

            case ButtonColor.Pink: tag.Css("btn-pink"); break;

            case ButtonColor.Default:
            default: break;
            }
            return(tag);
        }
Exemple #4
0
        public static MvcHtmlString AnchorButton(this HtmlHelper html, string text, string actionName, object routeValues, object htmlAttributes,
                                                 ButtonColor color = ButtonColor.Default, ButtonSize size = ButtonSize.Default)
        {
            UrlHelper url = new UrlHelper(html.ViewContext.RequestContext);

            return(AnchorButton(html, text, url.Action(actionName, routeValues), htmlAttributes, color, size));
        }
Exemple #5
0
        public ButtonData(ButtonColor BColor)
        {
            this.BColor = BColor;
            switch (BColor)
            {
            case ButtonColor.Red:
                this.MColor = new Color(1, 0, 0);
                break;

            case ButtonColor.Green:
                this.MColor = new Color(0, 1, 0);
                break;

            case ButtonColor.Blue:
                this.MColor = new Color(0, 0, 1);
                break;

            case ButtonColor.Yellow:
                this.MColor = new Color(1, 1, 0);
                break;

            case ButtonColor.Black:
                this.MColor = new Color(0, 0, 0);
                break;

            case ButtonColor.White:
                this.MColor = new Color(1, 1, 1);
                break;

            default:
                break;
            }
        }
Exemple #6
0
        public CalculatorButton(string name, ButtonColor color, string text)
        {
            InitializeComponent();
            switch (color)
            {
            case ButtonColor.Gainsboro:
                BackColor = Color.Gainsboro;
                break;

            case ButtonColor.WhiteSmoke:
                BackColor = Color.WhiteSmoke;
                break;

            case ButtonColor.White:
                BackColor = Color.White;
                break;
            }

            FlatAppearance.BorderSize = 0;
            Dock = DockStyle.Fill;
            FlatAppearance.CheckedBackColor   = Color.Silver;
            FlatAppearance.MouseDownBackColor = Color.Silver;
            FlatAppearance.MouseOverBackColor = Color.Silver;
            FlatStyle = FlatStyle.Flat;
            Font      = new Font("Microsoft Sans Serif", 20.00F);
            Margin    = new Padding(0);
            Name      = name;
            Text      = text;
            AutoSize  = true;
        }
Exemple #7
0
        public static GUIStyle GetButtonStyle(ButtonType buttonType, ButtonColor buttonColor, Color textColor)
        {
            GUIStyle buttonStyle = new GUIStyle(GetButtonStyle(buttonType, buttonColor));

            buttonStyle.normal.textColor = textColor;
            return(buttonStyle);
        }
        private void TurnOnButton(int x, int y, ButtonColor c)
        {
            //Convert into pitch
            int   pitchNum = y * 16 + x;
            Pitch p        = (Pitch)pitchNum;

            launchpadOut.SendNoteOn(Channel.Channel1, p, (int)c);
        }
Exemple #9
0
 public static MvcHtmlString AnchorButton(this HtmlHelper html, string text, string href,
                                          ButtonColor color = ButtonColor.Default, ButtonSize size = ButtonSize.Default)
 {
     return(Tag.A().InnerText(text)
            .AddCss(color).AddCss(size).Css("btn")
            .Attr("href", href)
            .ToMvcHtmlString());
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NControl.Controls.ActionButton"/> class.
        /// </summary>
        public ActionButton()
        {
            var layout = new Grid {
                Padding = 0, ColumnSpacing = 0, RowSpacing = 0
            };

            ButtonShadowElement = new NControlView
            {
                DrawingFunction = (canvas, rect) => {
                    // Draw shadow
                    rect.Inflate(new NGraphics.Size(-4));
                    rect.Y += 4;

                    Device.OnPlatform(

                        //iOS
                        () => canvas.DrawEllipse(rect, null, new NGraphics.RadialGradientBrush(
                                                     new NGraphics.Color(0, 0, 0, 200), NGraphics.Colors.Clear)),

                        // Android
                        () => canvas.DrawEllipse(rect, null, new NGraphics.RadialGradientBrush(
                                                     new NGraphics.Point(rect.Width / 2, (rect.Height / 2) + 2),
                                                     new NGraphics.Size(rect.Width, rect.Height),
                                                     new NGraphics.Color(0, 0, 0, 200), NGraphics.Colors.Clear)),

                        // WP
                        () => canvas.DrawEllipse(rect, null, new NGraphics.RadialGradientBrush(
                                                     new NGraphics.Color(0, 0, 0, 200), NGraphics.Colors.Clear)),

                        null
                        );
                },
            };

            ButtonElement = new NControlView
            {
                DrawingFunction = (canvas, rect) => {
                    // Draw button circle
                    rect.Inflate(new NGraphics.Size(-8));
                    canvas.DrawEllipse(rect, null, new NGraphics.SolidBrush(ButtonColor.ToNColor()));
                }
            };

            ButtonIconLabel = new FontAwesomeLabel
            {
                XAlign    = TextAlignment.Center,
                YAlign    = TextAlignment.Center,
                TextColor = Color.White,
                Text      = AwasomeIcon.FAPlus,
                FontSize  = 24,
            };

            layout.Children.Add(ButtonShadowElement);
            layout.Children.Add(ButtonElement);
            layout.Children.Add(ButtonIconLabel);

            Content = layout;
        }
Exemple #11
0
 public static MvcHtmlString Actions(this HtmlHelper helper, String SubmitTextButton, ButtonColor SubmitColor,String CancelTextButton, ButtonColor CancelColor )
 {
     var panelBuilder = CreatePanel("actions");
     var OkButton = CreateButton(SubmitTextButton, SubmitColor);
     var CancelButton = CreateButton(CancelTextButton, CancelColor);
     panelBuilder.InnerHtml = OkButton.ToString(TagRenderMode.SelfClosing) +
                              CancelButton.ToString(TagRenderMode.SelfClosing);
     return new MvcHtmlString(panelBuilder.ToString());
 }
    public void SetColor(string color)
    {
        ButtonColor buttonColor = ButtonManager.instance.GetColor(color);

        source.sprite = buttonColor.source;
        SpriteState ss = button.spriteState;

        ss.pressedSprite   = buttonColor.pressed;
        button.spriteState = ss;
    }
Exemple #13
0
 public static MvcHtmlString AnchorButton(this HtmlHelper html, string text, string href, object htmlAttributes,
                                          ButtonColor color = ButtonColor.Default, ButtonSize size = ButtonSize.Default)
 {
     return(Tag.A().InnerText(text)
            .If(htmlAttributes != null,
                tag => tag.Attrs(htmlAttributes.ToPropertyDictionary(), true))
            .AddCss(color).AddCss(size).Css("btn")
            .Attr("href", href)
            .ToMvcHtmlString());
 }
Exemple #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ExpenseClaimApp.Controls.ImageActionButton"/> class.
        /// </summary>
        public ImageActionButton()
        {
            var layout = new Grid {
                Padding = 0, ColumnSpacing = 0, RowSpacing = 0
            };

            ButtonShadowElement = new NControlView
            {
                DrawingFunction = (canvas, rect) =>
                {
                    // Draw shadow
                    rect.Inflate(new NGraphics.Size(-4));
                    rect.Y += 4;

                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        //iOS
                        canvas.DrawEllipse(rect, null, new NGraphics.RadialGradientBrush(new NGraphics.Color(0, 0, 0, 200), NGraphics.Colors.Clear));
                    }
                    else if (Device.RuntimePlatform == Device.Android)
                    {
                        // Android
                        canvas.DrawEllipse(rect, null, new NGraphics.RadialGradientBrush(new NGraphics.Point(rect.Width / 2, (rect.Height / 2) + 2),
                                                                                         new NGraphics.Size(rect.Width, rect.Height), new NGraphics.Color(0, 0, 0, 200), NGraphics.Colors.Clear));
                    }
                }
            };

            ButtonElement = new NControlView
            {
                DrawingFunction = (canvas, rect) =>
                {
                    // Draw button circle
                    rect.Inflate(new NGraphics.Size(-8));
                    canvas.DrawEllipse(rect, null, new NGraphics.SolidBrush(ButtonColor.ToNColor()));
                }
            };

            ButtonIconImage = new Image {
                Scale = 0.4
            };

            var imageWrapper = new Grid {
                Padding = 5
            };

            imageWrapper.Children.Add(ButtonIconImage);

            layout.Children.Add(ButtonShadowElement);
            layout.Children.Add(ButtonElement);
            layout.Children.Add(imageWrapper);

            Content = layout;
        }
Exemple #15
0
    public static MvcHtmlString Button(this HtmlHelper htmlHelper, string Value, ButtonColor buttonColor)
    {
        string renderButton =
            string.Format(
                @"<input type=""button"" value=""{0}"" style=""background-color: {1}"" />",
                Value,
                buttonColor.ToString()
                );

        return(MvcHtmlString.Create(renderButton));
    }
Exemple #16
0
 public static MvcHtmlString SubmitButton(this HtmlHelper html, string text, string name, string value,
                                          ButtonColor color = ButtonColor.Default, ButtonSize size = ButtonSize.Default, ButtonIcon icon = ButtonIcon.Default)
 {
     return(Tag.Button().InnerText(text)
            .Attr("type", "submit").Attr("name", name).Attr("value", value)
            .AddCss(color).AddCss(size).AddCss(icon)
            .IfElse(icon == ButtonIcon.Default,
                    tag => tag.Css("btn"),
                    tag => tag.Css("btn-icon"))
            .ToMvcHtmlString());
 }
Exemple #17
0
 public void ShowColor(ButtonColor color, bool HideInactive, bool ShowColor)
 {
     for (int x = 0; x < Width; x++)
     {
         for (int y = 0; y < Height; y++)
         {
             if (Buttons[x, y].BColor == color)
             {
                 Buttons[x, y].SetActive(true, HideInactive, ShowColor);
             }
         }
     }
 }
Exemple #18
0
    public void Test(GameObject obj, RuleVeredict veredict)
    {
        ButtonColor color = obj.GetComponent <ButtonColor>();

        if (color)
        {
            if (color.GetAdj() == colorAdj)
            {
                veredict.AddScore(-1);
                veredict.AddFailureReason("Did not ignore button that should be ignored");
            }
        }
    }
Exemple #19
0
 private static TagBuilder CreateButton(String Text, ButtonColor color)
 {
     String cssClass = "btn ";
     switch (color)
     {
         case ButtonColor.BlueButton:
             cssClass = cssClass + "primary";
             break;
         case ButtonColor.GrayButton:
             break;
     }
     return CreateButton(Text, cssClass);
 }
    public void OnColorChosen(ButtonColor button)
    {
        if (!IsRunning)
        {
            return;
        }

        if (_currentSelectedButtonColor != null)
        {
            _currentSelectedButtonColor.IsPressed = false;
        }

        _currentSelectedButtonColor = button;
    }
Exemple #21
0
        public Button(int bID)
        {
            ID = bID;

            IsOnToogle = false;

            Type = buttonType.Momentary;

            offColor    = ButtonColor.None;
            offFlashing = false;

            onColor    = ButtonColor.None;
            onFlashing = false;
        }
Exemple #22
0
        private static TagBuilder CreateButton(String Text, ButtonColor color)
        {
            String cssClass = "btn ";

            switch (color)
            {
            case ButtonColor.BlueButton:
                cssClass = cssClass + "primary";
                break;

            case ButtonColor.GrayButton:
                break;
            }
            return(CreateButton(Text, cssClass));
        }
        /// <summary>
        /// Converts launchpad midi velocities to .net colors.
        /// </summary>
        private Color MidiToColor(int midi)
        {
            Color ret;

            if (_midiToColor.TryGetValue(midi, out ret) == false)
            {
                var c = new ButtonColor(ColorMapper.ValueToColor(midi), 4);

                //LaunchPadColor.Decode(midi, out red, out green, out flags);
                //ret = Color.FromArgb(red * 85, green *85, 0);
                ret = Color.FromArgb(c.Red, c.Green, 0);
                _midiToColor.Add(midi, ret);
            }
            return(ret);
        }
Exemple #24
0
        /// <summary>
        /// Gestion des Leds
        /// </summary>
        /// <param name="position"></param>
        /// <param name="color"></param>
        /// <param name="flashing"></param>
        /// <param name="systemLed"></param>
        public static void Led(int position, ButtonColor color, bool flashing, bool systemLed)
        {
            int velocity = GetVelocity(color, flashing);



            if (systemLed && position >= 0 && position <= 7)
            {
                position = position + 104;
                SendChannel(ChannelCommand.Controller, 0, position, velocity);
            }
            else if (position >= 0 && position <= 120)
            {
                SendChannel(ChannelCommand.NoteOn, 0, position, velocity);
            }
        }
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.AddCssClass("btn");

            if (Color != ButtonColor.Default)
            {
                output.RemoveCssClass(ButtonColor.Default);
            }

            if (context.TagName.Equals("btn-link"))
            {
                output.RemoveCssClass("btn-link");
            }

            output.AddCssClass(ButtonColor.Parse(Color));
        }
Exemple #26
0
        public static GUIStyle GetButtonStyle(ButtonType buttonType, ButtonColor buttonColor)
        {
            GUIStyle buttonStyle = new GUIStyle(Button);

            if (buttonType == ButtonType.Mid)
            {
                buttonStyle = new GUIStyle(ButtonMid);
            }
            else if (buttonType == ButtonType.Left)
            {
                buttonStyle = new GUIStyle(ButtonLeft);
            }
            else if (buttonType == ButtonType.Right)
            {
                buttonStyle = new GUIStyle(ButtonRight);
            }

            buttonStyle.normal.background   = ButtonStyleDict[buttonColor, buttonType, ButtonState.Normal];
            buttonStyle.onNormal.background = ButtonStyleDict[buttonColor, buttonType, ButtonState.Active];
            buttonStyle.hover.background    = ButtonStyleDict[buttonColor, buttonType, ButtonState.Hover];
            buttonStyle.onHover.background  = ButtonStyleDict[buttonColor, buttonType, ButtonState.Hover];
            buttonStyle.active.background   = ButtonStyleDict[buttonColor, buttonType, ButtonState.Active];
            buttonStyle.onActive.background = ButtonStyleDict[buttonColor, buttonType, ButtonState.Active];

            if (buttonColor == ButtonColor.Blue)
            {
                buttonStyle.normal.textColor = Color.white;
            }
            else if (buttonColor == ButtonColor.Green)
            {
                buttonStyle.normal.textColor = ColorDarkestGreen;
            }
            else if (buttonColor == ButtonColor.Grey)
            {
                buttonStyle.normal.textColor = ColorDarkestBlue;
            }
            else if (buttonColor == ButtonColor.Orange)
            {
                buttonStyle.normal.textColor = Color.white;
            }
            else
            {
                buttonStyle.normal.textColor = ColorDarkestOrange;
            }

            return(buttonStyle);
        }
        public static void ToChange(this Button button, ButtonColor changes)
        {
            switch (changes)
            {
            case ButtonColor.Default:
                button.BackColor = Color.FromArgb(47, 148, 94);
                button.ForeColor = Color.White;

                break;

            case ButtonColor.OnClick:
                button.BackColor = Color.White;
                button.ForeColor = Color.FromArgb(47, 148, 94);

                break;
            }
        }
Exemple #28
0
        public ButtonAttribute(ButtonColor color)
        {
            switch (color)
            {
            case ButtonColor.Red:
                _color = Color.red;
                break;

            case ButtonColor.Green:
                _color = Color.green;
                break;

            case ButtonColor.Yellow:
                _color = Color.yellow;
                break;
            }
        }
Exemple #29
0
    public void Test(GameObject obj, RuleVeredict veredict)
    {
        DateTime time = GameController.Instance.GetCurrentTime();

        ButtonColor color = obj.GetComponent <ButtonColor>();

        if (color && color.GetAdj() == colorAdj)
        {
            if (PressedTimeTranslator.TimeSatisfies(time, timeAdj))
            {
                veredict.AddScore(1);
            }
            else
            {
                veredict.AddScore(-1);
                veredict.AddFailureReason("Pressed button at wrong time of day");
            }
        }
    }
Exemple #30
0
        private void SpawnColorButtons(float layout_scale)
        {
            float scale   = 1f * layout_scale;
            int   spread  = (int)(128 * layout_scale);
            int   start_x = (int)(Engine.Game.CanvasWidth / 2 + 240 * scale);
            int   start_y = 128 + spread / 2;

            for (int x = 0; x < 3; x++)
            {
                int offset_x = x * spread;
                for (int y = 0; y < 2; y++)
                {
                    int offset_y  = spread * y - spread / 2;
                    int color_int = (x + (y * 3));
                    var button    = new ButtonColor((Colors)color_int, start_x + offset_x, start_y + offset_y, scale);
                    Engine.SpawnInstance(button);
                }
            }
        }
Exemple #31
0
        public PaintDemo()
        {
            InitializeComponent();

            this.MouseDown += PaintDemo_MouseDown;
            this.MouseMove += PaintDemo_MouseMove;
            this.MouseUp   += PaintDemo_MouseUp;

            this.Paint += PaintDemo_Paint;

            bmp = new Bitmap(this.Width, this.Height);
            g   = Graphics.FromImage(bmp);
            _currentButtonColor = ButtonColor.LEFT;
            _currentColor       = pnLeft.BackColor;

            // optimise form vibration
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        }
        public void SetColor(LaunchpadButton btn, ButtonColor color)
        {
            ButtonBrightness green = ButtonBrightness.Off;
            ButtonBrightness red   = ButtonBrightness.Off;

            switch (color)
            {
            case ButtonColor.Off: break;

            case ButtonColor.Green: green = ButtonBrightness.Full; break;

            case ButtonColor.GreenMid: green = ButtonBrightness.Medium; break;

            case ButtonColor.GreenLow: green = ButtonBrightness.Low; break;

            case ButtonColor.Red: red = ButtonBrightness.Full; break;

            case ButtonColor.RedMid: red = ButtonBrightness.Medium; break;

            case ButtonColor.RedLow: red = ButtonBrightness.Low; break;

            case ButtonColor.Mix_HighHigh: red = ButtonBrightness.Full; green = ButtonBrightness.Full; break;

            case ButtonColor.Mix_HighMedium: red = ButtonBrightness.Full; green = ButtonBrightness.Medium; break;

            case ButtonColor.Mix_HighLow: red = ButtonBrightness.Full; green = ButtonBrightness.Low; break;

            case ButtonColor.Mix_MediumHigh: red = ButtonBrightness.Medium; green = ButtonBrightness.Full; break;

            case ButtonColor.Mix_MediumMedium: red = ButtonBrightness.Medium; green = ButtonBrightness.Medium; break;

            case ButtonColor.Mix_MediumLow: red = ButtonBrightness.Medium; green = ButtonBrightness.Low; break;

            case ButtonColor.Mix_LowHigh: red = ButtonBrightness.Low; green = ButtonBrightness.Full; break;

            case ButtonColor.Mix_LowMedium: red = ButtonBrightness.Low; green = ButtonBrightness.Medium; break;

            case ButtonColor.Mix_LowLow: red = ButtonBrightness.Low; green = ButtonBrightness.Low; break;
            }
            btn.SetBrightness(red, green);
        }
Exemple #33
0
 private void SetMinimizeButtonColor(PictureBox button, ButtonColor color)
 {
     switch (color)
     {
         case ButtonColor.Active:
             button.Image = Properties.Resources.minimize_red;
             break;
         case ButtonColor.Hover:
             button.Image = Properties.Resources.minimize_green;
             break;
         default:
             button.Image = Properties.Resources.minimize_black;
             break;
     }
 }
Exemple #34
0
 public IButton Color(ButtonColor color = ButtonColor.Default)
 {
     Builder.AddClass(color.GetDescription());
     return this;
 }