Performance upgrade - status icons reloaded only when really needed

This commit is contained in:
szporowolik
2019-10-19 13:22:44 +02:00
parent fb0620d178
commit 666c3a859f
2 changed files with 45 additions and 28 deletions

View File

@@ -8,5 +8,9 @@ internal class Globals
public static bool bLogHistoryUpdate = true; // Mark if log control require update public static bool bLogHistoryUpdate = true; // Mark if log control require update
public static string strPerunTitleText = ""; public static string strPerunTitleText = "";
public static bool bdcConnection = false; // Historic db connection status
public static bool btcpcServer = false; // Historic tcp connection status
public static bool bSRSStatus = false; // Historic srs connection status
public static bool bLotATCStatus = false; // Historic lotatc connection status
} }

View File

@@ -367,6 +367,7 @@ namespace Perun_v1
} }
// Update status icons at main form // Update status icons at main form
if (dcConnection.bStatus != Globals.bdcConnection) {
if (dcConnection.bStatus) if (dcConnection.bStatus)
{ {
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db"); con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db");
@@ -374,6 +375,10 @@ namespace Perun_v1
{ {
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
} }
Globals.bdcConnection = dcConnection.bStatus;
}
if (tcpcServer.bStatus != Globals.btcpcServer) {
if (tcpcServer.bStatus) if (tcpcServer.bStatus)
{ {
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game"); con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game");
@@ -382,14 +387,21 @@ namespace Perun_v1
{ {
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
} }
Globals.btcpcServer = tcpcServer.bStatus;
}
if (bSRSStatus != Globals.bSRSStatus) {
if (bSRSStatus) if (bSRSStatus)
{ {
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs"); con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs");
} }
else else
{ {;
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
} }
Globals.bSRSStatus = bSRSStatus;
}
if (bLotATCStatus != Globals.bLotATCStatus)
{
if (bLotATCStatus) if (bLotATCStatus)
{ {
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc"); con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc");
@@ -398,7 +410,8 @@ namespace Perun_v1
{ {
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
} }
Globals.bLotATCStatus = bLotATCStatus;
}
} }