Пример #1
0
        public MainPage()
        {
            measureLengthDevice = new MeasureLengthDevice();

            this.InitializeComponent();

            //When the application starts the stop, and getrawdata buttons should be disabled.
            //This will prevent the user clicking on them
            stopButton.IsEnabled       = false;
            getRawDataButton.IsEnabled = false;

            //Set the unit type
            if (metricRadioButton.IsChecked == true)
            {
                measureLengthDevice.UnitsToUse = Units.Metric;
            }
            else
            {
                measureLengthDevice.UnitsToUse = Units.Imperial;
            }

            //Timer_Tick method will update the values on the screen every 15 seconds
            timer = new Timer(timer_Tick, null, (int)TimeSpan.FromSeconds(1).TotalMilliseconds, (int)TimeSpan.FromSeconds(15).TotalMilliseconds);

            displayData = new DisplayMeasurements
            {
                Measurement          = measureLengthDevice.Measurement,
                History              = measureLengthDevice.History,
                AlternateMeasurement = 0
            };
        }
Пример #2
0
        public MainPage()
        {
            this.InitializeComponent();

            newDevice = new MeasureLengthDevice();

            //Initialize RadioButton DefaultCheck
            //According to instructions we are to assume the default device measurement is in inches and we want cm conversion.
            this.imperialRadioButton.IsChecked = true;
        }