public async Task Initialize(Page page) { _page = page; _tsc2046 = await Tsc2046.GetDefaultAsync(); try { await _tsc2046.LoadCalibrationAsync(CalibrationFilename); } catch (System.IO.FileNotFoundException) { await CalibrateTouch(); // Initiate calibration if we don't have a calibration on file } catch (UnauthorizedAccessException) { // No access to documents folder await new Windows.UI.Popups.MessageDialog("Make sure the application manifest specifies access to the documents folder and declares the file type association for the calibration file.", "Configuration Error").ShowAsync(); throw; } // Load up the touch processor and listen for touch events _processor = new TouchPanels.TouchProcessor(_tsc2046); _processor.PointerDown += Processor_PointerDown; _processor.PointerMoved += Processor_PointerMoved; _processor.PointerUp += Processor_PointerUp; }
public LcdCalibrationView(Tsc2046 device) { this._device = device; this.InitializeComponent(); this.Loaded += (s, e) => _loaded.SetResult(true); }
private async void Init() { tsc2046 = await Tsc2046.GetDefaultAsync().ConfigureAwait(true); if (!tsc2046.IsCalibrated) { try { await tsc2046.LoadCalibrationAsync(CalibrationFilename).ConfigureAwait(true); } catch (FileNotFoundException) { await CalibrateTouch().ConfigureAwait(true); //Initiate calibration } catch (UnauthorizedAccessException) { //No access to documents folder await new Windows.UI.Popups.MessageDialog("Make sure the application " + "manifest specifies access to the documents folder and declares the " + "file type association for the calibration file.", "Configuration Error").ShowAsync(); throw; } } //Load up the touch processor and listen for touch events if (processor == null) { processor = new TouchPanels.TouchProcessor(tsc2046); processor.PointerDown += Processor_PointerDown; processor.PointerMoved += Processor_PointerMoved; processor.PointerUp += Processor_PointerUp; } }
private async Task CalibrateTouch(Tsc2046 touchDevice) { var calibration = await TouchPanels.UI.LcdCalibrationView.CalibrateScreenAsync(touchDevice); touchDevice.SetCalibration(calibration.A, calibration.B, calibration.C, calibration.D, calibration.E, calibration.F); await touchDevice.SaveCalibrationAsync(CalibrationFileName); }
public async Task InitializeAsync() { if (!_isInitialized) { _isInitialized = true; if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.IoT") { _tsc2046 = await InitializeTouchControllerAsync(); _processor = InitializeTouchProcessor(_tsc2046); } } }
private async Task <Tsc2046> InitializeTouchControllerAsync() { var tsc2046 = await Tsc2046.GetDefaultAsync(); try { await tsc2046.LoadCalibrationAsync(CalibrationFileName); } catch (System.IO.FileNotFoundException) { await CalibrateTouch(tsc2046); } return(tsc2046); }