Пример #1
0
 private void ReadButton_Click(object sender, RoutedEventArgs e)
 {
     try {
         DataTextBox.Text = "Reading....";
         EnableButtons(false);
         string calString = HP3478A.ReadCalibration(AddressTextBox.Text);
         DataTextBox.Text = calString;
     } catch (Exception exc) {
         MessageBox.Show("An exception occured: \n\n " + exc.Message, "Error",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     } finally {
         EnableButtons(true);
     }
 }
Пример #2
0
 private void WriteButton_Click(object sender, RoutedEventArgs e)
 {
     try {
         string calStr = DataTextBox.Text;
         bool   valid  = HP3478A.IsValidCalString(calStr);
         if (!valid)
         {
             MessageBox.Show("Provided calibration string is NOT valid.", "Calibration invalid",
                             MessageBoxButton.OK, MessageBoxImage.Exclamation);
             return;
         }
         HP3478A.WriteCalibration(AddressTextBox.Text, calStr);
     } catch (FormatException fex) {
         MessageBox.Show("Formatting error happened: \n\n " + fex.Message, "Format Error",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     } catch (Exception exc) {
         MessageBox.Show("An exception occured: \n\n " + exc.Message, "Error",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #3
0
 private void VerifyButton_Click(object sender, RoutedEventArgs e)
 {
     try {
         string oldCal     = DataTextBox.Text;
         string currentCal = HP3478A.ReadCalibration(AddressTextBox.Text);
         if (HP3478A.CalibrationsEqual(oldCal, currentCal))
         {
             MessageBox.Show("Calibration matches provided data.", "Calibration Verified",
                             MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("Calibration DOES NOT match provided data.", "Calibration MISMATCH",
                             MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
     } catch (Exception exc) {
         MessageBox.Show("An exception occured: \n\n " + exc.Message, "Error",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     } finally {
         EnableButtons(true);
     }
 }