Example #1
0
        private void InitComp()
        {
            render     = new CircleRender(this, displayText);
            renderThis = (CircleRender)render;

            hover  = new CircleHover(this);
            move   = new Move(this);
            select = new Select(this);

            hover.OnEnter += (DiagramEntity d, Point location) => {
                if (select.select == Select.ESelect.ENABLE)
                {
                    renderThis.SetEntity(Color.Magenta).SetEntity(3);
                }
                else
                {
                    renderThis.SetEntity(Color.Black).SetEntity(3);
                }
            };
            hover.OnOut += (DiagramEntity d, Point location) => {
                if (select.select == Select.ESelect.ENABLE)
                {
                    renderThis.SetEntity(Color.Magenta).SetEntity(2);
                }
                else
                {
                    renderThis.SetEntity(Color.Black).SetEntity(2);
                }
            };

            move.OnStart += (DiagramEntity entity, Point location) => {
                renderThis.SetEntity(Color.LightGray).SetEntity(2);
            };
            move.OnStop += (DiagramEntity entity, Point location) => {
                renderThis.SetEntity(Color.Black).SetEntity(3);
            };

            select.OnDisable += (DiagramEntity entity) => {
                renderThis.SetEntity(Color.Black).SetEntity(3);
            };
            select.OnEnable += (DiagramEntity entity) => {
                renderThis.SetEntity(Color.Magenta).SetEntity(2);
            };

            renderThis.SetEntity(Color.Black).SetEntity(2);
        }
Example #2
0
        public bool Edit(string name, string number)
        {
            this.name = name;

            if (int.TryParse(number, out int tmpNumber))
            {
                this.number = tmpNumber;
            }
            else
            {
                MessageBox.Show("Error");
                return(false);
            }

            UpdateDisplayText();
            render     = new CircleRender(this, displayText);
            renderThis = (CircleRender)render;

            return(true);
        }