예제 #1
0
파일: Window.cs 프로젝트: AIBrain/ochregui
        /// <summary>
        /// Removes the specified manager from the Window.  The Window will wait until next tick
        /// to actually remove the manager.
        /// </summary>
        /// <param name="manager"></param>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="manager"/> is
        /// null.</exception>
        public void RemoveManager(Manager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            if(managerList.Contains(manager))
            {
                managerRemoveList.Add(manager);
            }

            // make sure to remove any managers waiting to be added
            if(managerAddList.Contains(manager))
            {
                managerAddList.Remove(manager);
            }
        }
예제 #2
0
파일: Window.cs 프로젝트: AIBrain/ochregui
        /// <summary>
        /// Add a previously constructed Manager object to this window.  All added instances
        /// must be reference-unique, or this method will throw an ArgumentException.
        /// </summary>
        /// <param name="manager"></param>
        /// <exception cref="System.ArgumentException">Thrown when the specified
        /// <paramref name="manager"/> instance is already contained by this window.</exception>
        public void AddManager(Manager manager)
        {
            if (managerList.Contains(manager) || managerAddList.Contains(manager))
            {
                throw new ArgumentException("Added manager instances must be unique.");
            }

            managerAddList.Add(manager);
            manager.ParentWindow = this;

            if (!manager.isSetup)
            {
                manager.OnSettingUp();
            }
        }