/// <summary>
        /// Closes the CommandContextManager, ensuring that all commands have been removed from
        /// the CommandManager.
        /// </summary>
        public void Close()
        {
            //	Begin the batch update.
            BeginUpdate();

            //	If entered, leave.
            if (entered)
            {
                Leave();
            }

            //	If activated, deactivate.
            if (activated)
            {
                Deactivate();
            }

            //	Remove normal commands.
            commandManager.Remove(normalCommandCollection);

            //	End the batch update.
            EndUpdate();

            //	Clear our internal tables.
            normalCommandCollection.Clear();
            activatedCommandCollection.Clear();
            enteredCommandCollection.Clear();
            commandContextTable.Clear();
        }
Пример #2
0
        /// <summary>
        /// Sets the specified array as the items of the collection.
        /// </summary>
        /// <param name="editValue">The collection to edit.</param>
        /// <param name="value">An array of objects to set as the collection items.</param>
        /// <returns>The newly created collection object or, otherwise, the collection indicated by the editValue parameter.</returns>
        protected override object SetItems(object editValue, object[] value)
        {
            CommandCollection commandCollection = (CommandCollection)editValue;

            commandCollection.Clear();
            foreach (Command command in value)
            {
                commandCollection.Add(command);
            }
            return(commandCollection);
        }