示例#1
0
 private void dispose_Click(object sender, RoutedEventArgs e)
 {
     if (device != null)
     {
         device.Dispose();
         device = null;
     }
 }
示例#2
0
        // 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();
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }