コード例 #1
0
        private void PersistWindowDefaultPosition(IWindowMetadataProvider windowInfo, FrameworkElement viewWithDataContext)
        {
            if (!this.windowsAttributes.ContainsKey(windowInfo))
            {
                var top  = WindowPosition.GetWindowTop(windowInfo.VerticalPosition, ((FrameworkElement)this.HostControl).ActualHeight, viewWithDataContext.Height);
                var left = WindowPosition.GetWindowLeft(windowInfo.HorizontalPosition, ((FrameworkElement)this.HostControl).ActualWidth);

                this.windowsAttributes[windowInfo] = new Point(left, top);
            }
        }
コード例 #2
0
        private double GetWindowLeft(object view, IWindowMetadataProvider windowInfo)
        {
            var persistedValue = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "PositionX");

            if (persistedValue.HasValue)
            {
                return(persistedValue.Value);
            }

            return(WindowPosition.GetWindowLeft(windowInfo.HorizontalPosition, ((FrameworkElement)this.HostControl).ActualWidth));
        }
コード例 #3
0
        private double GetWindowTop(object view, IWindowMetadataProvider windowInfo, FrameworkElement viewWithDataContext)
        {
            var persistedValue = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "PositionY");

            if (persistedValue.HasValue)
            {
                return(persistedValue.Value);
            }

            return(WindowPosition.GetWindowTop(windowInfo.VerticalPosition, ((FrameworkElement)this.HostControl).ActualHeight, viewWithDataContext.Height));
        }
コード例 #4
0
        private Size GetWindowSize(object view, IWindowMetadataProvider windowInfo)
        {
            var height = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "Height");
            var width  = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "Width");

            if (height.HasValue && width.HasValue)
            {
                Size windowSize = new Size {
                    Height = height.Value, Width = width.Value
                };

                return(windowSize);
            }

            return(windowInfo.Size);
        }