Beispiel #1
0
 private void OnPairServiceResult(PairServiceResultMessage msg)
 {
     // TODO: Localize
     if (msg.Exception == null)
     {
         FlyoutService.ShowMessage($"{msg.Service.DisplayName} paired successfully.", "\xE73E");
     }
     else
     {
         FlyoutService.ShowMessage($"{msg.Service.DisplayName} failed to pair: {msg.Exception.Message}", "\xE783");
     }
 }
Beispiel #2
0
        private async void OnEnableService(EnableServiceMessage msg)
        {
            PairServiceResultMessage resultMsg = null;

            try {
                await EnableServiceAsync(msg.Service);

                if (msg.Service is IPairedService paired)
                {
                    resultMsg = new PairServiceResultMessage(paired);
                }
            } catch (OperationCanceledException) {
            } catch (Exception ex) {
                if (msg.Service is IPairedService paired)
                {
                    resultMsg = new PairServiceResultMessage(paired, ex);
                }
            }

            if (resultMsg != null)
            {
                Messenger.Default.Send(resultMsg);
            }
        }