/// <summary>
        /// Enables or disables the `Minimize` button for provided window.
        /// </summary>
        /// <param name="window">
        /// The window to modify this button for.
        /// </param>
        /// <param name="disabled">
        /// True to disable this button and false to enable it.
        /// </param>
        /// <returns>
        /// True it the Win32 API call was successful and false otherwise.
        /// </returns>
        public static Boolean SetMinimizeButton(Window window, Boolean disabled)
        {
            if (window is null)
            {
                return(false);
            }

            try
            {
                WindowInteropHelper helper = new WindowInteropHelper(window);
                return(WindowButtonHelper.SetWindowStyleFlags(helper.Handle, disabled, WindowButtonHelper.WS_MINIMIZEBOX));
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception);
                return(false);
            }
        }
        private static Boolean SetWindowStyleFlags(IntPtr handle, Boolean disabled, Int32 flags)
        {
            if (handle == IntPtr.Zero || handle == WindowButtonHelper.INVALID_HANDLE_VALUE)
            {
                return(false);
            }

            Int32 style = WindowButtonHelper.GetWindowLongPtr(handle, WindowButtonHelper.GWL_STYLE).ToInt32();

            if (disabled)
            {
                style &= ~flags;
            }
            else
            {
                style |= flags;
            }

            return(WindowButtonHelper.SetWindowLongPtr(handle, WindowButtonHelper.GWL_STYLE, new IntPtr(style)) != IntPtr.Zero);
        }