Commits

Anonymous committed 63db62b

Fixed a bug where windows without a max width/height would fail.

  • Participants
  • Parent commits b068709

Comments (0)

Files changed (2)

File StickyWindowLibrary/IFormAdapter.cs

     {
         IntPtr Handle { get; }
         Rectangle Bounds { get; set; }
-        Size MaximumSize { get; set; }
-        Size MinimumSize { get; set; }
+        Size MaximumSize { get; }
+        Size MinimumSize { get; }
         bool Capture { get; set; }
         void Activate();
         Point PointToScreen(Point point);

File StickyWindowLibrary/WpfFormAdapter.cs

 
         public Size MaximumSize
         {
-            get { return new Size(Convert.ToInt32(_window.MaxWidth), Convert.ToInt32(_window.MaxHeight)); }
-            set { 
-                _window.MaxWidth = value.Width;
-                _window.MaxHeight = value.Height;
+            get
+            {
+                int width = int.MaxValue;
+                int height = int.MaxValue;
+                if (_window.MaxWidth != double.PositiveInfinity)
+                    width = Convert.ToInt32(_window.MaxWidth);
+                if (_window.MaxHeight != double.PositiveInfinity)
+                    height = Convert.ToInt32(_window.MaxHeight);
+
+                return new Size(width, height);
             }
         }
 
         public Size MinimumSize
         {
             get { return new Size(Convert.ToInt32(_window.MinWidth), Convert.ToInt32(_window.MinHeight)); }
-            set
-            {
-                _window.MinWidth = value.Width;
-                _window.MinHeight = value.Height;
-            }
         }
 
         public bool Capture