Will do my best to put in the pertinent parts.
I added a reference to;
c:\Windows\Microsoft.net\Framework\v4.0.30319\system.Windows.forms.dll
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Windows.Forms;
public sealed partial class MainPage : Page
{
public System.Windows.Forms.Timer collectorTimer = new System.Windows.Forms.Timer();
....
//this is the event called by the timer tick.
private void collect(Object myObject, EventArgs e)
{
if (timerSwitch == true)
{
measuringDevice.mostRecentMeasure = measuringDevice.GetMeasurement();
measuringDevice.dataCaptured[arrayPosition] = measuringDevice.mostRecentMeasure;
arrayPosition++;
//display
currentMeasurementDisplay.Text = measuringDevice.mostRecentMeasure.ToString();
}
else
{
//throw an expcetion here
}
}
private void startButton_Click(object sender, RoutedEventArgs e)
{
//vars i need
collectorTimer.Interval = 15000;
collectorTimer.Tick += new EventHandler(collect);
collectorTimer.Start();
}
No comments:
Post a Comment