コード例 #1
0
        /// <summary>
        /// Restores the state of a window.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="windowName">Name of the window.</param>
        /// <param name="attachToWindow">if set to <c>true</c> attach to the window to capture when it is destroyed.</param>
        public void RestoreState(
            Window window,
            string windowName,
            bool attachToWindow)
        {
            // Check to see if we know about the window.
            if (!windowStates.ContainsKey(windowName))
            {
                // If we are attaching, we need to get the event so we make
                // a state.
                if (!attachToWindow)
                {
                    return;
                }

                // Create a new state by saving this one.
                SaveState(window, windowName);
            }

            // Set the state of the window.
            WindowState state = windowStates[windowName];

            state.Restore(window, attachToWindow);
        }