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); } }
private Task ClosePopupAsync() { AppSettings.HasBooking = false; MessagingCenter.Send(this, MessengerKeys.CheckoutRequested); _analyticService.TrackEvent("Checkout"); return(PopupNavigation.PopAllAsync(true)); }
/// <summary> /// Закрытие Popup /// </summary> private Task ClosePopupAsync() { // Убираем бронь AppSettings.HasBooking = false; // Посылаем сообщение, что прошла выписка MessagingCenter.Send(this, MessengerKeys.CheckoutRequested); // Фиксируем событие в аналитике _analyticService.TrackEvent("Checkout"); return(PopupNavigation.PopAllAsync()); }
private async void FilterAsync(string search) { try { IsBusy = true; Suggestions = new List <string>( _cities.Select(c => c.ToString()) .Where(c => c.ToLowerInvariant().Contains(search.ToLowerInvariant()))); _analyticService.TrackEvent("Filter", new Dictionary <string, string> { { "Search", search } }); } catch (Exception ex) { Debug.WriteLine($"[Booking] Error: {ex}"); await DialogService.ShowAlertAsync(Resources.ExceptionMessage, Resources.ExceptionTitle, Resources.DialogOk); } finally { IsBusy = false; } }
private async void UpdateSettingsAsync(object obj) { try { IsBusy = true; if (Validate()) { RemoteSettings = await _settingsService.LoadRemoteSettingsAsync(_settingsFileUrl.Value); await _settingsService.PersistRemoteSettingsAsync(RemoteSettings); _settingsService.RemoteFileUrl = SettingsFileUrl.Value; await DialogService.ShowAlertAsync("Remote settings were successfully loaded", "JSON settings loaded!", "Accept"); _analyticService.TrackEvent("UpdateSettings"); } } catch (Exception ex) { await DialogService.ShowAlertAsync(ex.Message, "Error loading JSON settings", "Accept"); } finally { IsBusy = false; } }
public override async Task InitializeAsync(object navigationData) { if (_nfcService != null) { if (!_nfcService.IsAvailable) { await DialogService.ShowAlertAsync(Resources.NoNfc, Resources.Information, Resources.DialogOk); return; } var authenticatedUser = _authenticationService.AuthenticatedUser; var nfcParameter = new NfcParameter { Username = authenticatedUser.Name, Avatar = authenticatedUser.AvatarUrl }; var serializedMessage = JsonConvert.SerializeObject(nfcParameter); MessagingCenter.Send(serializedMessage, MessengerKeys.SendNFCToken); _analyticService.TrackEvent("OpenDoor"); } }
/// <summary> /// Инициализация /// </summary> public override async Task InitializeAsync(object navigationData) { // Служба NFC должна быть создана if (_nfcService != null) { // NFC должен быть включён if (!_nfcService.IsAvailable) { await DialogService.ShowAlertAsync(Resources.NoNfc, Resources.Information, Resources.DialogOk); return; } // Пользователь var authenticatedUser = _authenticationService.AuthenticatedUser; var nfcParameter = new NfcParameter { Username = authenticatedUser.Name, Avatar = authenticatedUser.AvatarUrl }; var serializedMessage = JsonConvert.SerializeObject(nfcParameter); // Посылаем сообщение об открытии дверей MessagingCenter.Send(serializedMessage, MessengerKeys.SendNFCToken); // Отправляем данные в аналитику _analyticService.TrackEvent("OpenDoor"); } }
/// <summary> /// Tracks tap events (button clicks, tap gestures, etc...). /// </summary> /// <param name="analyticService">The analytic service.</param> /// <param name="itemTapped">The item that was tapped.</param> public static void TrackTapEvent(this IAnalyticService analyticService, string itemTapped) { analyticService?.TrackEvent( "tapped", new Dictionary <string, string> { { "tapped_item", itemTapped } }); }
private async void OnDelete(Models.Notification notification) { if (notification != null) { Notifications.Remove(notification); await _notificationService.DeleteNotificationAsync(notification); _analyticService.TrackEvent("DeleteNotification"); HasItems = Notifications.Count > 0; } }
/// <summary> /// Tracks a screen view. /// </summary> /// <param name="analyticService">The analytic service.</param> /// <param name="screenName">Name of the screen.</param> /// <param name="additionalProperties">The additional properties related to the screen.</param> public static void TrackScreen( this IAnalyticService analyticService, string screenName, IDictionary <string, string> additionalProperties = null) { // get or create the dictionary to submit with the event additionalProperties = additionalProperties ?? new Dictionary <string, string>(); additionalProperties.Add("screen_name", screenName); analyticService?.TrackEvent("screen_view", additionalProperties); }
private async Task SignInAsync() { IsBusy = true; bool isValid = Validate(); if (isValid) { bool isAuth = await _authenticationService.LoginAsync(UserName.Value, Password.Value); if (isAuth) { IsBusy = false; _analyticService.TrackEvent("SignIn"); await NavigationService.NavigateToAsync <MainViewModel>(); } } IsBusy = false; }
public async Task SignInAsync() { IsBusy = true; bool isValid = Validate(); if (isValid) { await Task.Delay(1000); bool isAuth = false; if (isAuth) { IsBusy = false; analyticService.TrackEvent("SignIn"); await navigationService.NavigateToAsync <MainViewModel>(); } } IsBusy = false; }