ACAT.Lib.Extension.CommandHandlers.AppWindowManagementHandler.isForegroundWindowSizeable C# (CSharp) Method

isForegroundWindowSizeable() private method

Checks if the foreground window is sizeable
private isForegroundWindowSizeable ( ) : bool
return bool
        private bool isForegroundWindowSizeable()
        {
            IntPtr fgHandle = Windows.GetForegroundWindow();
            if (fgHandle == IntPtr.Zero)
            {
                return false;
            }

            bool retVal = false;

            var window = AutomationElement.FromHandle(fgHandle);
            object objPattern;
            Log.Debug("controltype: " + window.Current.ControlType.ProgrammaticName);

            if (window.TryGetCurrentPattern(WindowPattern.Pattern, out objPattern))
            {
                var windowPattern = objPattern as WindowPattern;
                retVal = (windowPattern.Current.CanMinimize ||
                            windowPattern.Current.CanMaximize) &&
                            !windowPattern.Current.IsModal;

                Log.Debug("canminimize: " + windowPattern.Current.CanMinimize +
                            ", ismodal: " + windowPattern.Current.IsModal);
            }

            Log.Debug("returning " + retVal);

            return retVal;
        }
    }