Exemple #1
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();
        }
Exemple #2
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();
        }
Exemple #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;

            device.HeartBeat += (o, args) =>
            {
                heartBeatTimeStamp.Content =
                    string.Format("HeartBeat Timestamp: {0}", args.TimeStamp);
            };

            loggingFileNameBox.Text = device.GetLoggingFile();
            unitsBox.Text           = device.UnitsToUse.ToString();

            device.StartCollecting();
        }