diff --git a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroLayout/Driver/Controls/Control.cs b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroLayout/Driver/Controls/Control.cs
index 45404291ee..59630fa880 100644
--- a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroLayout/Driver/Controls/Control.cs
+++ b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroLayout/Driver/Controls/Control.cs
@@ -79,7 +79,7 @@ public virtual bool IsVisible
///
/// Gets or sets the left coordinate of the control.
///
- public int Left
+ public virtual int Left
{
get => _left;
set => SetInvalidatingProperty(ref _left, value);
@@ -88,7 +88,7 @@ public int Left
///
/// Gets or sets the top coordinate of the control.
///
- public int Top
+ public virtual int Top
{
get => _top;
set => SetInvalidatingProperty(ref _top, value);
@@ -97,7 +97,7 @@ public int Top
///
/// Gets or sets the width of the control.
///
- public int Width
+ public virtual int Width
{
get => _width;
set => SetInvalidatingProperty(ref _width, value);
@@ -106,7 +106,7 @@ public int Width
///
/// Gets or sets the height of the control.
///
- public int Height
+ public virtual int Height
{
get => _height;
set => SetInvalidatingProperty(ref _height, value);
@@ -115,12 +115,12 @@ public int Height
///
/// Gets the bottom coordinate of the control.
///
- public int Bottom => Top + Height;
+ public virtual int Bottom => Top + Height;
///
/// Gets the right coordinate of the control.
///
- public int Right => Left + Width;
+ public virtual int Right => Left + Width;
///
/// Refreshes the control by redrawing it on the specified surface.
diff --git a/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinForms.cs b/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinForms.cs
index a2ba3c8a5e..453b13dd21 100644
--- a/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinForms.cs
+++ b/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinForms.cs
@@ -87,15 +87,26 @@ protected override void OnClick(EventArgs e)
///
void IPixelDisplay.Show()
{
- this.Invalidate(true);
+ if (this.IsDisposed)
+ {
+ return;
+ }
- if (InvokeRequired)
+ try
{
- Invoke(Update);
+ this.Invalidate(true);
+ if (InvokeRequired)
+ {
+ Invoke(Update);
+ }
+ else
+ {
+ this.Update();
+ }
}
- else
+ catch (ObjectDisposedException)
{
- this.Update();
+ // NOP - can happen when quitting application
}
}
diff --git a/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinFormsPixelBuffer.cs b/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinFormsPixelBuffer.cs
index 58e1e83b07..9e9d127075 100644
--- a/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinFormsPixelBuffer.cs
+++ b/Source/Meadow.Foundation.Peripherals/Displays.WinForms/Driver/WinFormsPixelBuffer.cs
@@ -108,9 +108,13 @@ public void Fill(int originX, int originY, int width, int height, Color color)
}
}
}
+ catch (ArgumentException)
+ {
+ // NOP - can happen on app shutdown
+ }
catch (InvalidOperationException)
{
- // NOP
+ // NOP - can happen on app shutdown
}
}