// ========================================
        // method
        // ========================================
        public ICommand GetUpdateCommand()
        {
            var ret = default(ICommand);

            foreach (var editor in _targets)
            {
                if (ret == null)
                {
                    ret = new SetNodeBackgroundCommand(editor, Background);
                }
                else
                {
                    ret = ret.Chain(new SetNodeBackgroundCommand(editor, Background));
                }
            }
            return(ret);
        }
Example #2
0
        protected void SetShapeColorBase(Color color)
        {
            if (_EditorCanvas == null)
            {
                return;
            }

            var background = default(IBrushDescription);

            if (color.A == 0 && color.R == 0 && color.G == 0 && color.B == 0)
            {
                background = null;
            }
            else
            {
                background = new SolidBrushDescription(color);
            }

            var editors = _EditorCanvas.SelectionManager.SelectedEditors;
            var cmd     = default(ICommand);

            foreach (var editor in editors)
            {
                if (editor.Model is MemoShape || editor.Model is MemoTableCell)
                {
                    if (cmd == null)
                    {
                        cmd = new SetNodeBackgroundCommand(editor, background);
                    }
                    else
                    {
                        cmd = cmd.Chain(new SetNodeBackgroundCommand(editor, background));
                    }
                }
            }
            if (cmd != null)
            {
                _EditorCanvas.CommandExecutor.Execute(cmd);
            }
        }