예제 #1
0
        public Form Button(string displayText, Action <object> onClick,
                           Style style = null,
                           ButtonFunctions functions = null)
        {
            var btn = new Button();

            lib.styleUtil.style(this, btn, style);
            btn.Content = displayText;

            btn.Click += (_s, _args) =>
            {
                onClick(null);
            };

            if (functions != null)
            {
                functions.setStyle = (_newStyle) =>
                {
                    lib.styleUtil.style(this, btn, _newStyle);
                };
            }

            AddRowToHost(btn);
            return(this);
        }
예제 #2
0
        private void RefreshStatus()
        {
            String statusInfoText = modelView.RefreshStatusInfo();

            if (!String.IsNullOrEmpty(statusInfoText))
            {
                statusInfoLabel.Text = statusInfoText;
            }

            ButtonFunctions functions = modelView.RefreshButtonFunctions();

            switch (functions)
            {
            case ButtonFunctions.PauseStop: {
                button1.Visible = button2.Visible = true;
                button1.Text    = "Pause";
                button2.Text    = "Stop";
                button1Function = ButtonFunction.Pause;
                button2Function = ButtonFunction.Stop;
                break;
            }

            case ButtonFunctions.NoneClose: {
                button1.Visible = false;
                button2.Visible = true;
                button2.Text    = "Close";
                button1Function = ButtonFunction.None;
                button2Function = ButtonFunction.Close;
                break;
            }

            case ButtonFunctions.ResumeStop: {
                button1.Visible = button2.Visible = true;
                button1.Text    = "Resume";
                button2.Text    = "Stop";
                button1Function = ButtonFunction.Resume;
                button2Function = ButtonFunction.Stop;
                break;
            }

            case ButtonFunctions.OpenClose: {
                button1.Visible = button2.Visible = true;
                button1.Text    = "Open";
                button2.Text    = "Close";
                button1Function = ButtonFunction.Open;
                button2Function = ButtonFunction.Close;
                break;
            }

            default: {
                button1.Visible = button2.Visible = false;
                button1Function = ButtonFunction.None;
                button2Function = ButtonFunction.None;
                break;
            }
            }
        }
예제 #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        ButtonFunctions shootTarget = (ButtonFunctions)target;

        if (GUILayout.Button("Call"))
        {
            shootTarget.call();
        }
    }
/**
 * @param funcToGet: the ButtonFunction of the radio button desired
 * @return RadioButton object in RadioButtonList whose ButtonFunction is equal to <funcToGet>. If none are found, returns null;
 * @details Gets a RadioButton whose ButtonFunction matches the value of the <funcToGet> argument. If none are found it will return null instead.
 */
    public static RadioButton GetRadioButtonByFunction(ButtonFunctions funcToGet)
    {
        foreach (RadioButton current in RadioButtonList)
        {
            if (current.ButtonFunction == funcToGet)
            {
                return(current);
            }
        }
        return(null);
    }
예제 #5
0
    public Button(string textureFile, Vector2f centerPosition, ButtonFunctions buttonFunction)
    {
        CenterPosition = centerPosition;

        ButtonSprite                = new Sprite(new Texture(textureFile));
        ButtonSprite.Scale         *= 1.25f;
        ButtonSprite.Texture.Smooth = true;
        ButtonSprite.Origin         = new Vector2f(ButtonSprite.GetLocalBounds().Width / 2f, ButtonSprite.GetLocalBounds().Height / 2f);
        ButtonSprite.Position       = centerPosition;

        Function = buttonFunction;
        ButtonList.Add(this);
    }
    public RadioButton(Vector2f ButtonPosition, ButtonFunctions WhatToPaint)
    {
        CircleShape OuterCircle = new CircleShape(15f);

        OuterCircle.FillColor = OuterCircle_FillColor;
        OuterCircle.Origin    = new Vector2f(OuterCircle.GetLocalBounds().Width / 2f, OuterCircle.GetLocalBounds().Height / 2f);
        OuterCircle.Position  = ButtonPosition;
        ButtonShape_Outer     = OuterCircle;

        ButtonShape_Inner           = new CircleShape(ButtonShape_Outer.Radius * 0.50f);
        ButtonShape_Inner.FillColor = ButtonShape_Outer.FillColor;
        ButtonShape_Inner.Origin    = new Vector2f(ButtonShape_Inner.GetLocalBounds().Width / 2f, ButtonShape_Inner.GetLocalBounds().Height / 2f);
        ButtonShape_Inner.Position  = ButtonShape_Outer.Position;

        ButtonFunction = WhatToPaint;

        RadioButtonList.Add(this);
    }
        public ButtonFunctions RefreshButtonFunctions()
        {
            ButtonFunctions result = ButtonFunctions.PauseStop;
            DownloadStatus  status = DownloadStatus;

            if (status == DownloadStatus.Downloading)
            {
                result = ButtonFunctions.PauseStop;
            }
            if (status == DownloadStatus.Paused)
            {
                result = ButtonFunctions.ResumeStop;
            }
            if (status == DownloadStatus.Success)
            {
                result = ButtonFunctions.OpenClose;
            }
            if (status == DownloadStatus.Failed)
            {
                result = ButtonFunctions.NoneClose;
            }
            return(result);
        }
예제 #8
0
 void Start()
 {
     parent = this.GetComponentInParent <ButtonFunctions>();
 }
예제 #9
0
 void TaskOnClick()
 {
     ButtonFunctions.setLevel(lvl);
 }