private void dispose_Click(object sender, RoutedEventArgs e) { if (device != null) { device.Dispose(); device = null; } }
// TODO - Declare a delegate to reference NewMeasurementEvent handler. private void startCollecting_Click(object sender, RoutedEventArgs e) { if (device == null) { device = new MeasureMassDevice(Units.Metric, "LogFile.txt"); } // TODO - Use a delegate to refer to the event handler. // Hook up the delegate to an event handler method. // TODO - Hook up the event handler to the event. loggingFileNameBox.Text = device.GetLoggingFile(); unitsBox.Text = device.UnitsToUse.ToString(); device.StartCollecting(); }
private void startCollecting_Click(object sender, RoutedEventArgs e) { if (device == null) { device = new MeasureMassDevice(Units.Metric, "LogFile.txt"); } // Hook up the delegate to an event handler method. newMeasurementTaken = new EventHandler(device_NewMeasurementTaken); device.NewMeasurementTaken += newMeasurementTaken; loggingFileNameBox.Text = device.GetLoggingFile(); unitsBox.Text = device.UnitsToUse.ToString(); device.StartCollecting(); }
private void startCollecting_Click(object sender, RoutedEventArgs e) { if (device == null) { device = new MeasureMassDevice(Units.Metric, "LogFile.txt"); } // Hook up the delegate to an event handler method. newMeasurementTaken = new EventHandler(device_NewMeasurementTaken); device.NewMeasurementTaken += newMeasurementTaken; device.HeartBeat += (o, args) => { heartBeatTimeStamp.Content = string.Format("HeartBeat Timestamp: {0}", args.TimeStamp); }; loggingFileNameBox.Text = device.GetLoggingFile(); unitsBox.Text = device.UnitsToUse.ToString(); device.StartCollecting(); }