/// <summary> /// Refresh access token /// </summary> private async void RefreshToken() { try { //var nis = SimpleIoc.Default.GetInstance<INetworkInformationService>(); if (ObjectSyncDispatcher.HasInternetConnection()) { await ObjectSyncDispatcher.Instance.RefreshToken(); //_logger.LogTrace("AppBootstrapper-RefreshToken| Trying to refresh token"); //await AuthenticationService.RefreshToken(); Debug.WriteLine("App RefreshToken"); } } catch (OAuthException oae) { //_logger.LogException("AppBootstrapper-RefreshToken|", oae); Debug.WriteLine(oae); } catch (Exception ex) { //_logger.LogException("AppBootstrapper-RefreshToken|", ex); Debug.WriteLine(ex); } }
private static async void OnHtmlPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { if (ObjectSyncDispatcher.HasInternetConnection()) { return; } var msgDialog = new MessageDialog("Connection Not Available"); await msgDialog.ShowAsync(); }
private void NetworkInformation_NetworkStatusChanged(object sender) { var hasInternetAccess = ObjectSyncDispatcher.HasInternetConnection(); if (HasInternetConnection != hasInternetAccess) { Messenger.Default.Send(new NetworkStatusChangedMessage(hasInternetAccess)); } HasInternetConnection = hasInternetAccess; }
private async void SyncUpLogs() { try { if (!ObjectSyncDispatcher.HasInternetConnection()) { return; } await ObjectSyncDispatcher.Instance.SyncUpDsaSyncLogs((text) => Debug.WriteLine(text)); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); Debug.WriteLine("SyncUpLogs exception"); } }
public async void SyncUpSearchTerms() { try { // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (!ObjectSyncDispatcher.HasInternetConnection() || !SfdcConfig.CollectSearchTerms) { return; } await ObjectSyncDispatcher.Instance.SyncUpSearchTerms((text) => Debug.WriteLine(text)); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); Debug.WriteLine("SyncUpSearchTerms exception"); } }
protected override async Task OnAfterLogin() { var firstLogin = await ObjectSyncDispatcher.Instance.IsUserFirstLogIn(); if (firstLogin) { if (ControlBarViewModel.ShowInitialynchronizationPopup.CanExecute(this)) { ControlBarViewModel.ShowInitialynchronizationPopup.Execute(this); } } else { if (ObjectSyncDispatcher.HasInternetConnection()) { if (ControlBarViewModel.ShowDeltaSynchronizationPopup.CanExecute(this)) { ControlBarViewModel.ShowDeltaSynchronizationPopup.Execute(this); } } } }
private async Task <bool> SyncUpNewPlaylist(bool syncPlaylistContent = false) { try { if (!ObjectSyncDispatcher.HasInternetConnection()) { return(false); } await ObjectSyncDispatcher.Instance.SyncUpFeaturedPlaylists((text) => Debug.WriteLine(text)); if (syncPlaylistContent) { await ObjectSyncDispatcher.Instance.SyncUpPlaylistContent((text) => Debug.WriteLine(text)); } return(true); } catch (Exception e) { PlatformAdapter.SendToCustomLogger(e, LoggingLevel.Error); Debug.WriteLine("SyncUpNewPlaylist exception"); } return(false); }
private void ShowErrorMessageBoxIfNeeded(AggregateException exception) { var messagesToDisplay = exception.InnerExceptions.Where(e => e != null).Select(e => e.Message).ToList(); if (messagesToDisplay.Any() == false) { return; } var message = string.Join(Environment.NewLine, messagesToDisplay); if (exception.InnerExceptions.Any(e => e is ErrorResponseException)) { var messageHeader = $"You do not have correct permission set for DSA app, report the problem to email address {SfdcConfig.SynchronizationFailedSupportEmail}"; message = messageHeader + Environment.NewLine + Environment.NewLine + message; } if (!ObjectSyncDispatcher.HasInternetConnection()) { message = ObjectSyncDispatcher.NoInternetConnectionMessage; } DispatcherHelper.CheckBeginInvokeOnUI(() => { _dialogService.ShowMessage(message, "Synchronization failed"); }); }
public NetworkInformationService() { HasInternetConnection = ObjectSyncDispatcher.HasInternetConnection(); NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged; }