Пример #1
0
        /// <summary>
        /// Releases previous redock state.
        /// Current implementation simply notifies the referenced <see cref="DockTabStrip">DockTabStrip</see> that it is not a redock target anymore.
        /// </summary>
        /// <param name="oldState"></param>
        protected void RemovePreviousState(RedockState oldState)
        {
            DockTabStrip oldStrip = oldState.TargetStrip;

            if (oldStrip != null)
            {
                oldStrip.IsRedockTarget = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Removes previously saved redock state for the specified window for the specified DockState.
        /// </summary>
        /// <param name="window"></param>
        /// <param name="dockState"></param>
        /// <returns></returns>
        public bool ClearState(DockWindow window, DockState dockState)
        {
            RedockState state = this.GetState(window, dockState, true);

            if (state == null)
            {
                return(false);
            }

            this.RemovePreviousState(state);
            //remove from clean-up list
            int index = this.oldStates.IndexOf(state);

            if (index != -1)
            {
                this.oldStates.RemoveAt(index);
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Preforms the core Save logic.
        /// </summary>
        /// <param name="window"></param>
        /// <returns></returns>
        protected virtual bool SaveStateCore(DockWindow window)
        {
            Dictionary <DockState, RedockState> states;

            this.redockStates.TryGetValue(window.Name, out states);

            if (states == null)
            {
                states = new Dictionary <DockState, RedockState>();
                this.redockStates[window.Name] = states;
            }

            RedockState savedState;

            if (window.DockState == DockState.Floating)
            {
                savedState = new RedockFloatingState(window);
            }
            else
            {
                savedState = new RedockState(window, window.DockState);
            }

            //invalid state
            if (!savedState.IsValid)
            {
                return(false);
            }

            RedockState oldState;

            states.TryGetValue(window.DockState, out oldState);
            if (oldState != null)
            {
                oldStates.Add(oldState);
            }

            states[window.DockState] = savedState;

            return(true);
        }