Пример #1
0
        /// <summary>
        /// Restores the size, position, and state of a window from another window of the same type.
        /// </summary>
        /// <remarks>
        /// This method offsets the window position slightly so that the two windows do not overlap.
        /// </remarks>
        /// <typeparam name="T">The type of the window.</typeparam>
        /// <param name="window">A window.</param>
        /// <param name="otherWindow">The window from which to copy the size, position, and state.</param>
        /// <param name="options">Options for performing the restore. (Optional.)</param>
        public static void RestoreFromWindow <T>(this T window, T otherWindow, RestoreOptions options = RestoreOptions.None)
            where T : Window, IRestorableWindow
        {
            WindowSize windowSize       = WindowSize.FromWindow(otherWindow);
            WindowSize offsetWindowSize = windowSize.Offset();

            window.Restore(offsetWindowSize, options);
        }