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;
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
 private async void InitTouch()
 {
     tsc2046 = await TouchPanels.Devices.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 (System.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;
 }