Пример #1
0
        //----------------------------------------------------------------------------

        public void UpdateAll()
        {
            for (int i = 0; i < _vCommandControls.Count; i++)
            {
                CommandControl cc = (CommandControl)_vCommandControls[i];
                cc.Update();
            }
        }
Пример #2
0
        public Button   CreateButton(Type type)
        {
            CommandControl cc = Request(type);

            if (cc != null && cc is CommandButton)
            {
                return(new ButtonClient((CommandButton)cc));
            }
            return(null);
        }
Пример #3
0
        //----------------------------------------------------------------------------

        public MenuItem CreateMenuItem(Type type)
        {
            CommandControl cc = Request(type);

            if (cc != null && cc is CommandButton)
            {
                return(new MenuItemClient((CommandButton)cc));
            }
            return(null);
        }
Пример #4
0
 public void ClientUpdate(CommandControl commandControl)
 {
     Debug.Assert(commandControl == _commandButton);
     this.Text     = _commandButton.Text;
     this.Enabled  = _commandButton.Enabled;
     this.Checked  = _commandButton.Checked;
     this.Shortcut = _commandButton.Shortcut;
     //if( _commandButton.Icon != null ) {
     //	this.Icon		= _commandButton.Icon.ToBitmap();
     //}
 }
Пример #5
0
        //----------------------------------------------------------------------------

        public CommandControl Find(Type type)
        {
            for (int i = 0; i < _vCommandControls.Count; i++)
            {
                CommandControl cc = (CommandControl)_vCommandControls[i];
                if (cc.GetType() == type)
                {
                    return(cc);
                }
            }
            return(null);
        }
Пример #6
0
        //----------------------------------------------------------------------------

        public CommandControl Request(Type type)
        {
            CommandControl cc = this.Find(type);

            if (cc != null)
            {
                return(cc);
            }
            Debug.Assert(type.IsSubclassOf(typeof(CommandControl)) == true);

            ConstructorInfo ci = type.GetConstructor(new Type[0]);

            Debug.Assert(ci != null);

            cc = (CommandControl)ci.Invoke(null);
            cc.CommandControls = this;
            Debug.Assert(cc != null);
            Debug.Assert(cc.GetType() == type);

            this.Add(cc);

            return(cc);
        }
Пример #7
0
        public bool Execute(Type type, params object[] list)
        {
            CommandControl cc = Find(type);

            if (cc == null)
            {
                throw new ArgumentException("no CommandControl of name '" + type + "' found", "type");
            }
            if (!(cc is CommandButton))
            {
                throw new ArgumentException("CommandControl '" + type + "' is not a CommandButton", "type");
            }

            CommandButton cb = (CommandButton)cc;

            cb.Update();
            if (cb.Enabled == true)
            {
                cb.Params = list;
                //BugTracking.SetWatch( "CommandControls.LastExecute", cb );
                return(cb.Execute());
            }
            return(false);
        }
Пример #8
0
 public void Remove(CommandControl cc)
 {
     Debug.Assert(_vCommandControls.Contains(cc) == true);
     _vCommandControls.Remove(cc);
 }
Пример #9
0
 public bool Contains(CommandControl cc)
 {
     return(_vCommandControls.Contains(cc));
 }
Пример #10
0
 public void     Add(CommandControl cc)
 {
     Debug.Assert(_vCommandControls.Contains(cc) == false);
     _vCommandControls.Add(cc);
 }
Пример #11
0
 public void ClientUpdate(CommandControl commandControl)
 {
     Debug.Assert(commandControl == _commandButton);
     this.Enabled = _commandButton.Enabled;
 }