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