private void OpenPort() { if (serialPort == null) { throw new NullReferenceException(Properties.Resources.DeviceNotFoundError); } PortCommunication.OpenPort(serialPort); }
/// <summary> /// Handles the Click event of the btnTakeSample control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void TakeSamples(object sender, RoutedEventArgs e) { if (serialPort == null) { throw new NullReferenceException(HaenggiModel.Presentation.Properties.Resources.DeviceNotFoundError); } if (serialPort.IsOpen) { PortCommunication.ClosePort(serialPort); ToogleButtons(true); } else { PortCommunication.OpenPort(serialPort); txt17.Focus(); ToogleButtons(false); } }