Example #1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral              = taskInstance.GetDeferral();
            taskInstance.Canceled += OnTaskCanceled;

            _source   = new CancellationTokenSource();
            _listener = new DeviceListener(
                brick: new Brick(new CommunicationFactory(), new FileProvider()),
                notify: NotifyMethodAsync
                );

            await ThreadPool.RunAsync(async _ =>
            {
                await _listener.ConnectAsync(_source.Token);
                await _listener.InitializeAsync();
            });
        }
 private async void InitializeClick(object sender, RoutedEventArgs e)
 {
     await _listener.InitializeAsync();
 }