protected override void OnNavigatedFrom(NavigationEventArgs e) { // *** // *** Stop the timer // *** _timer.Stop(); // *** // *** Dispose the MCP3008 // *** if (_mcp3008 != null) { _mcp3008.Dispose(); _mcp3008 = null; } _dispatcher = null; base.OnNavigatedFrom(e); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // *** // *** Get the current dispatcher for this view // *** _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; // *** // *** Get the calibration value from application settings // *** _calibratedMaximumWaterSensorValue = this.ApplicationSettings.CalibratedMaximumWaterSensorValue; // *** // *** Initialize the MCP3008 // *** _mcp3008 = new Mcp3008(0); await _mcp3008.Initialize(); // *** // *** Start the timer // *** _timer.Start(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // *** // *** Get the calibration value from application settings // *** _calibration = new AdjustedNonLinearCalibration(MagicValue.Defaults.MinimumDepth, MagicValue.Defaults.MaximumDepth, this.ApplicationSettings.CalibrationPoints); // *** // *** Initialize the MCP3008 // *** _mcp3008 = new Mcp3008(0); await _mcp3008.Initialize(); // *** // *** Start the timer // *** _timer.Start(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // *** // *** // *** _steps = new WizardStep[] { new WizardStep() { Instruction = "This wizard will walk you through the calibration steps. Follow the instructions carefully. Click Start to begin. You can press Cancel at any time.", ButtonText = "Start", StepAction = ()=> { } }, new WizardStep() { Instruction = "Place the sensor in the water so that the water level is at 4 inches. Wait for the reading to stabilize and then click Next.", ButtonText = "Next", StepAction = async ()=> { await this.CaptureCalibrationPoint(4, this.SensorReading); this.OnPropertyChanged(nameof(CalibratrionPoint4)); } }, new WizardStep() { Instruction = "Place the sensor in the water so that the water level is at 8 inches. Wait for the reading to stabilize and then click Next.", ButtonText = "Next", StepAction = async ()=> { await this.CaptureCalibrationPoint(8, this.SensorReading); this.OnPropertyChanged(nameof(CalibratrionPoint8)); } }, new WizardStep() { Instruction = "Place the sensor in the water so that the water level is at 12 inches. Wait for the reading to stabilize and then click Next.", ButtonText = "Next", StepAction = async ()=> { await this.CaptureCalibrationPoint(12, this.SensorReading); this.OnPropertyChanged(nameof(CalibratrionPoint12)); } }, new WizardStep() { Instruction = "Remove the sensor completely from the water. Wait for the reading to stabilize and then click Next.", ButtonText = "Next", StepAction = async ()=> { await this.CaptureCalibrationPoint(0, this.SensorReading); } }, new WizardStep() { Instruction = "Your sensor is now calibrated. Click Done to return the sensor reading.", ButtonText = "Done", StepAction = async ()=> { await this.SaveCalibrationPoints(); this.Return(); } } }; // *** // *** Get the current calibration points // *** _calibrationPoints = this.ApplicationSettings.CalibrationPoints; // *** // *** Initialize the MCP3008 // *** _mcp3008 = new Mcp3008(0); await _mcp3008.Initialize(); // *** // *** Start the timer // *** _timer.Start(); // *** // *** Start the wizard // *** await Start(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // *** // *** Initialize the MCP3008 // *** _mcp3008 = new Mcp3008(0); await _mcp3008.Initialize(); // *** // *** Start the timer // *** _timer.Start(); }