AdvancedLauncher.Tools.Interop.HwndHostEx.OnWindowPositionChanged C# (CSharp) Method

OnWindowPositionChanged() protected method

protected OnWindowPositionChanged ( Rect rcBoundingBox ) : void
rcBoundingBox System.Windows.Rect
return void
        protected override void OnWindowPositionChanged(Rect rcBoundingBox)
        {
            bool callBase = false;
            bool callAsync = false;

            if (_lastWindowPosChanged != null) {
                // Only call the base if something changed since last time.
                if (rcBoundingBox != _lastWindowPosChanged.Value) {
                    callBase = true;

                    if (rcBoundingBox.Width != _lastWindowPosChanged.Value.Width ||
                        rcBoundingBox.Height != _lastWindowPosChanged.Value.Height) {
                        callAsync = true;
                    }
                }
            } else {
                // First time.
                callBase = true;
                callAsync = true;
            }

            if (callBase) {
                if (callAsync) {
                    Dispatcher.BeginInvoke((Action)delegate {
                        base.OnWindowPositionChanged(rcBoundingBox);
                    });
                } else {
                    base.OnWindowPositionChanged(rcBoundingBox);
                }
            }
            _lastWindowPosChanged = rcBoundingBox;
        }