add color to textbox when connected/not connected
This commit is contained in:
@@ -209,18 +209,18 @@ namespace HTOLHAST
|
||||
{
|
||||
|
||||
// Mandatory instruments:
|
||||
InitializePSU1(tbResourceStringPSU1.Text);
|
||||
InitializeDAQ(tbResourceStringDAQ.Text);
|
||||
Task.Run(() => InitializePSU1(tbResourceStringPSU1.Text));
|
||||
Task.Run(() => InitializeDAQ(tbResourceStringDAQ.Text));
|
||||
|
||||
// Optional Instruments check if to be used
|
||||
if (cbPSU2Enabled.Checked)
|
||||
{
|
||||
InitializePSU2(tbResourceStringPSU2.Text);
|
||||
Task.Run(() => InitializePSU2(tbResourceStringPSU2.Text));
|
||||
}
|
||||
|
||||
if (cbPAMEnabled.Checked)
|
||||
{
|
||||
InitializePAM(tbResourceStringPAM.Text);
|
||||
Task.Run(() => InitializePAM(tbResourceStringPAM.Text));
|
||||
}
|
||||
}
|
||||
public void InitializePSU1(string resourceString)
|
||||
@@ -235,11 +235,12 @@ namespace HTOLHAST
|
||||
setting.Voltage = PSU1.ReadSetpoint(setting.Channel);
|
||||
}
|
||||
}
|
||||
tbResourceStringPSU1.BackColor = Color.Green;
|
||||
dgvPowerSupplies.Refresh();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
tbResourceStringPSU1.BackColor = Color.Red;
|
||||
MessageBox.Show("Unable to Connect to HAMEG 1 PowerSupply");
|
||||
throw;
|
||||
}
|
||||
@@ -250,9 +251,11 @@ namespace HTOLHAST
|
||||
try
|
||||
{
|
||||
PSU2 = new HMP4040(resourceString);
|
||||
tbResourceStringPSU2.BackColor = Color.Green;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tbResourceStringPSU2.BackColor = Color.Red;
|
||||
MessageBox.Show("Unable to Connect to HAMEG 2 PowerSupply");
|
||||
throw;
|
||||
}
|
||||
@@ -270,9 +273,11 @@ namespace HTOLHAST
|
||||
|
||||
// Measure DC current
|
||||
PAM.PerformZeroCheck();
|
||||
tbResourceStringPAM.BackColor = Color.Green;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tbResourceStringPAM.BackColor = Color.Red;
|
||||
MessageBox.Show("Unable to Connect to PicoAmmeter");
|
||||
throw;
|
||||
}
|
||||
@@ -283,10 +288,11 @@ namespace HTOLHAST
|
||||
try
|
||||
{
|
||||
DAQ = new Agilent34970a(resourceString);
|
||||
tbResourceStringDAQ.BackColor = Color.Green;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
tbResourceStringDAQ.BackColor = Color.Red;
|
||||
MessageBox.Show("Unable to Connect to DAQ");
|
||||
throw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user