Exemple #1
0
        //----------------------------------------------------------------------------

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

            if (cc != null && cc is CommandButton)
            {
                return(new ButtonClient((CommandButton)cc));
            }
            return(null);
        }
Exemple #3
0
        //----------------------------------------------------------------------------

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

            if (cc != null && cc is CommandButton)
            {
                return(new MenuItemClient((CommandButton)cc));
            }
            return(null);
        }
 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();
     //}
 }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #8
0
 public void Remove(CommandControl cc)
 {
     Debug.Assert(_vCommandControls.Contains(cc) == true);
     _vCommandControls.Remove(cc);
 }
Exemple #9
0
 public bool Contains(CommandControl cc)
 {
     return(_vCommandControls.Contains(cc));
 }
Exemple #10
0
 public void     Add(CommandControl cc)
 {
     Debug.Assert(_vCommandControls.Contains(cc) == false);
     _vCommandControls.Add(cc);
 }
Exemple #11
0
 public void ClientUpdate(CommandControl commandControl)
 {
     Debug.Assert(commandControl == _commandButton);
     this.Enabled = _commandButton.Enabled;
 }