Beispiel #1
0
        private async Task OpenBotAsync()
        {
            var bots = new[] { Skype, FacebookMessenger };

            try
            {
                var selectedBot =
                    await DialogService.SelectActionAsync(
                        Resources.BotSelectionMessage,
                        Resources.BotSelectionTitle,
                        bots);

                switch (selectedBot)
                {
                case Skype:
                    _openUrlService.OpenSkypeBot(AppSettings.SkypeBotId);
                    _analyticService.TrackEvent("SkypeBot");
                    break;

                case FacebookMessenger:
                    _openUrlService.OpenFacebookBot(AppSettings.FacebookBotId);
                    _analyticService.TrackEvent("FacebookBot");
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"OpenBot: {ex}");

                await DialogService.ShowAlertAsync(
                    Resources.BotError,
                    Resources.ExceptionTitle,
                    Resources.DialogOk);
            }
        }
Beispiel #2
0
 private async void OnSelectMenuItem(Models.MenuItem item)
 {
     if (item.MenuItemType == MenuItemType.Concierge)
     {
         if (Device.RuntimePlatform == Device.UWP)
         {
             _openUrlService.OpenSkypeBot(AppSettings.SkypeBotId);
         }
         else
         {
             await OpenBotAsync();
         }
     }
     else if (item.IsEnabled && item.ViewModelType != null)
     {
         item.AfterNavigationAction?.Invoke();
         await NavigationService.NavigateToAsync(item.ViewModelType, item);
     }
 }