Util - UpdateImage and UpdateLabel check isDisposed
This commit is contained in:
parent
a038303db3
commit
0fc26f7f01
|
@ -80,6 +80,11 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
||||||
{
|
{
|
||||||
|
if (pictureBox.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pictureBox.Invoke(new Action(() =>
|
pictureBox.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
pictureBox.Image?.Dispose();
|
pictureBox.Image?.Dispose();
|
||||||
|
@ -89,6 +94,11 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
||||||
{
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
label.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
label.Text = text;
|
label.Text = text;
|
||||||
|
@ -99,6 +109,11 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text, Color backColor)
|
public static void UpdateLabel(this Label label, string text, Color backColor)
|
||||||
{
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
label.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
label.Text = text;
|
label.Text = text;
|
||||||
|
@ -108,6 +123,11 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text)
|
public static void UpdateLabel(this Label label, string text)
|
||||||
{
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
label.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
label.Text = text;
|
label.Text = text;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user