예제 #1
0
 /// <summary>
 /// Unregister a command.
 /// </summary>
 /// <param name="cmdId">Command identifier</param>
 /// <param name="cmd">The UI component</param>
 public void UnregisterCommand(string cmdId, ICommandComponent cmd)
 {
     if (registeredCommands.ContainsKey(cmdId) && cmd != null)
     {
         var al = (ArrayList)registeredCommands[cmdId];
         al.Remove(cmd);
     }
 }
예제 #2
0
        /// <summary>
        /// Register a GUI component that implements ICommandComponent that
        /// visual state (Enabled, Checked, Visible) have to be controlled by
        /// the Application.
        /// </summary>
        /// <param name="cmdId">A command identifier. Multiple commands that executes the same action should have the same identifier.
        /// They will be switched all to the same state on every state change request.</param>
        /// <param name="cmd">The UI component.</param>
        public void RegisterCommand(string cmdId, ICommandComponent cmd)
        {
            ArrayList al;

            if (registeredCommands.ContainsKey(cmdId))
            {
                al = (ArrayList)registeredCommands[cmdId];
            }
            else
            {
                al = new ArrayList(1);
                registeredCommands.Add(cmdId, al);
            }
            al.Add(cmd);
        }