示例#1
0
        /// <summary>
        /// Sets the <c>Gate</c> to open without checking if the <c>Gate</c> meets its criteria.
        /// </summary>
        /// <param name="open">If set to <c>true</c> open the <c>Gate</c>.</param>
        public void ForceOpen(bool open)
        {
            bool isOpen = IsOpen();

            if (isOpen == open)
            {
                // if it's already open why open it again?
                return;
            }
            GateStorage.SetOpen(this, open);
            if (open)
            {
                unregisterEvents();
            }
            else
            {
                // we can do this here ONLY because we check 'isOpen == open' a few lines above.
                registerEvents();
            }
        }