private async void RefreshAuthorization() { try { Busy.SetBusy(true, "Refresh authorization..."); var newAuthorization = await TraktAuthenticationService.Instance.RefreshAuthorizationAsync(); if (newAuthorization != null) { Authorization = newAuthorization; } Busy.SetBusy(false); } catch (TraktException ex) { ShowTraktExceptionMessage(ex); } catch (Exception ex) { ShowExceptionMessage(ex); } finally { Busy.SetBusy(false); } }
public async Task LoadViewModel() { if (string.IsNullOrWhiteSpace(SearchTerm)) { return; } try { Busy.SetBusy(true, "Söker..."); Error = null; var result = await _threadService.SearchThreads(SearchTerm, ForumId); SearchResult = new ObservableCollection <FbItem>(result); } catch (Exception e) { Error = e.ToString(); } finally { Busy.SetBusy(false); } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { Busy.SetBusy(true, "Loading favourite teams"); User currentUser = null; try { currentUser = await _userService.GetUser(); LoggedIn = true; } catch (Microsoft.Graph.ServiceException) { LoggedIn = false; } if (currentUser != null) { TeamNames = new List <FavouriteTeam>(); if (currentUser.FavouriteTeams != null) { foreach (var team in currentUser.FavouriteTeams.FavouriteTeams) { TeamNames.Add(team); } } HasFavouriteTeam = TeamNames.Count > 0; } OnLogInFinished += RefreshPageAsync; await base.OnNavigatedToAsync(parameter, mode, state); Busy.SetBusy(false); }
/// <summary> /// </summary> /// <param name="parameter">FortData containing the Pokestop that we're visiting</param> /// <param name="mode"></param> /// <param name="suspensionState"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { // Recovering the state CurrentPokestop = JsonConvert.DeserializeObject <FortDataWrapper>((string)suspensionState[nameof(CurrentPokestop)]); CurrentPokestopInfo.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentPokestop)]).CreateCodedInput()); CurrentSearchResponse.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentSearchResponse)]).CreateCodedInput()); } else { // Navigating from game page, so we need to actually load the Pokestop Busy.SetBusy(true, "Loading Pokestop"); CurrentPokestop = (FortDataWrapper)NavigationHelper.NavigationState[nameof(CurrentPokestop)]; NavigationHelper.NavigationState.Remove(nameof(CurrentPokestop)); Logger.Write($"Searching {CurrentPokestop.Id}"); CurrentPokestopInfo = await GameClient.GetFort(CurrentPokestop.Id, CurrentPokestop.Latitude, CurrentPokestop.Longitude); Busy.SetBusy(false); // If timeout is expired we can go to to pokestop page if (CurrentPokestop.CooldownCompleteTimestampMs >= DateTime.UtcNow.ToUnixTime()) { // Timeout is not expired yet, player can't get items from the fort SearchInCooldown?.Invoke(null, null); } } }
/// <summary> /// </summary> /// <param name="parameter">MapPokemonWrapper containing the Pokemon that we're trying to capture</param> /// <param name="mode"></param> /// <param name="suspensionState"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { // Recovering the state CurrentEncounter = new EncounterResponse(); CurrentLureEncounter = new DiskEncounterResponse(); CurrentCaptureAward = new CaptureAward(); SelectedCaptureItem = new ItemData(); CurrentPokemon = JsonConvert.DeserializeObject <IMapPokemon>((string)suspensionState[nameof(CurrentPokemon)]); CurrentEncounter.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentEncounter)]).CreateCodedInput()); CurrentLureEncounter.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentLureEncounter)]).CreateCodedInput()); CurrentCaptureAward.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentCaptureAward)]).CreateCodedInput()); SelectedCaptureItem.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(SelectedCaptureItem)]).CreateCodedInput()); RaisePropertyChanged(() => CurrentEncounter); RaisePropertyChanged(() => CurrentLureEncounter); RaisePropertyChanged(() => CurrentCaptureAward); RaisePropertyChanged(() => SelectedCaptureItem); } else { // Navigating from game page, so we need to actually load the encounter CurrentPokemon = (IMapPokemon)NavigationHelper.NavigationState[nameof(CurrentPokemon)]; Busy.SetBusy(true, string.Format(Resources.CodeResources.GetString("LoadingEncounterText"), Resources.Pokemon.GetString(CurrentPokemon.PokemonId.ToString()))); NavigationHelper.NavigationState.Remove(nameof(CurrentPokemon)); Logger.Write($"Catching {CurrentPokemon.PokemonId}"); await HandleEncounter(); } }
/// <summary> /// Starts the timer to update map objects and the handler to update position /// </summary> public static async Task InitializeDataUpdate() { _geolocator = new Geolocator { DesiredAccuracy = PositionAccuracy.High, DesiredAccuracyInMeters = 5, ReportInterval = 5000, MovementThreshold = 5 }; Busy.SetBusy(true, Resources.Translation.GetString("GettingGPSSignal")); Geoposition = Geoposition ?? await _geolocator.GetGeopositionAsync(); GeopositionUpdated?.Invoke(null, Geoposition); _geolocator.PositionChanged += (s, e) => { Geoposition = e.Position; GeopositionUpdated?.Invoke(null, Geoposition); }; _mapUpdateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(10) }; _mapUpdateTimer.Tick += async(s, e) => { Logger.Write("Updating map"); await UpdateMapObjects(); }; // Update before starting timer Busy.SetBusy(true, Resources.Translation.GetString("GettingUserData")); await UpdateMapObjects(); await UpdateInventory(); Busy.SetBusy(false); }
/// <summary> /// /// </summary> /// <param name="parameter">MapPokemonWrapper containing the Pokemon that we're trying to capture</param> /// <param name="mode"></param> /// <param name="suspensionState"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { // Recovering the state CurrentPokemon = (MapPokemonWrapper)suspensionState[nameof(CurrentPokemon)]; CurrentEncounter = (EncounterResponse)suspensionState[nameof(CurrentEncounter)]; CurrentCaptureAward = (CaptureAward)suspensionState[nameof(CurrentCaptureAward)]; SelectedCaptureItem = (ItemData)suspensionState[nameof(SelectedCaptureItem)]; } else if (parameter is bool) { // Navigating from game page, so we need to actually load the encounter CurrentPokemon = (MapPokemonWrapper)NavigationHelper.NavigationState[nameof(CurrentPokemon)]; Busy.SetBusy(true, Utils.Resources.Translation.GetString("LoadingEncounter") + Utils.Resources.Pokemon.GetString(CurrentPokemon.PokemonId.ToString())); NavigationHelper.NavigationState.Remove(nameof(CurrentPokemon)); Logger.Write($"Catching {CurrentPokemon.PokemonId}"); CurrentEncounter = await GameClient.EncounterPokemon(CurrentPokemon.EncounterId, CurrentPokemon.SpawnpointId); SelectedCaptureItem = ItemsInventory.First(item => item.ItemId == ItemId.ItemPokeBall); Busy.SetBusy(false); if (CurrentEncounter.Status != EncounterResponse.Types.Status.EncounterSuccess) { // Encounter failed, probably the Pokemon ran away await new MessageDialog("Pokemon ran away, sorry :(").ShowAsyncQueue(); ReturnToGameScreen.Execute(); } } await Task.CompletedTask; }
/// <summary> /// Starts the timer to update map objects and the handler to update position /// </summary> public static async Task InitializeDataUpdate() { _geolocator = new Geolocator { DesiredAccuracy = PositionAccuracy.High, DesiredAccuracyInMeters = 5, ReportInterval = 5000, MovementThreshold = 5 }; Busy.SetBusy(true, Resources.CodeResources.GetString("GettingGpsSignalText")); Geoposition = Geoposition ?? await _geolocator.GetGeopositionAsync(); GeopositionUpdated?.Invoke(null, Geoposition); _geolocator.PositionChanged += async(s, e) => { Geoposition = e.Position; // Updating player's position var position = Geoposition.Coordinate.Point.Position; await _client.Player.UpdatePlayerLocation(position.Latitude, position.Longitude, position.Altitude); GeopositionUpdated?.Invoke(null, Geoposition); }; // Before starting we need game settings GameSetting = await DataCache.GetAsync(nameof(GameSetting), async() => (await _client.Download.GetSettings()).Settings, DateTime.Now.AddMonths(1)); // Update geolocator settings based on server _geolocator.MovementThreshold = GameSetting.MapSettings.GetMapObjectsMinDistanceMeters; _mapUpdateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(GameSetting.MapSettings.GetMapObjectsMinRefreshSeconds) }; _mapUpdateTimer.Tick += async(s, e) => { // Update before starting but only if more than 10s passed since the last one if ((DateTime.Now - _lastUpdate).Seconds <= GameSetting.MapSettings.GetMapObjectsMinRefreshSeconds) { return; } Logger.Write("Updating map"); try { await UpdateMapObjects(); } catch (Exception ex) { await ExceptionHandler.HandleException(ex); } }; // Update before starting timer Busy.SetBusy(true, Resources.CodeResources.GetString("GettingUserDataText")); await UpdateMapObjects(); await UpdateInventory(); await UpdateItemTemplates(); Busy.SetBusy(false); }
/// <summary> /// </summary> /// <param name="parameter">MapPokemonWrapper containing the Pokemon that we're trying to capture</param> /// <param name="mode"></param> /// <param name="suspensionState"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { // Recovering the state CurrentPokemon = (MapPokemonWrapper)suspensionState[nameof(CurrentPokemon)]; CurrentEncounter = (EncounterResponse)suspensionState[nameof(CurrentEncounter)]; CurrentCaptureAward = (CaptureAward)suspensionState[nameof(CurrentCaptureAward)]; SelectedCaptureItem = (ItemData)suspensionState[nameof(SelectedCaptureItem)]; } else { // Navigating from game page, so we need to actually load the encounter CurrentPokemon = (MapPokemonWrapper)NavigationHelper.NavigationState[nameof(CurrentPokemon)]; Busy.SetBusy(true, string.Format(Resources.CodeResources.GetString("LoadingEncounterText"), Resources.Pokemon.GetString(CurrentPokemon.PokemonId.ToString()))); NavigationHelper.NavigationState.Remove(nameof(CurrentPokemon)); Logger.Write($"Catching {CurrentPokemon.PokemonId}"); CurrentEncounter = await GameClient.EncounterPokemon(CurrentPokemon.EncounterId, CurrentPokemon.SpawnpointId); SelectStartingBall(); Busy.SetBusy(false); if (CurrentEncounter.Status != EncounterResponse.Types.Status.EncounterSuccess) { // Encounter failed, probably the Pokemon ran away await new MessageDialog(Resources.CodeResources.GetString("PokemonRanAwayText")).ShowAsyncQueue(); ReturnToGameScreen.Execute(); } } }
private async Task LoadViewModel(string replyRequestId, bool replyRequestIsQuote) { try { Busy.SetBusy(true, "Laddar..."); Error = null; var model = await _threadService.GetReply(replyRequestId, replyRequestIsQuote); Title = model.Title; Message = model.Message; UserId = model.UserId; ThreadId = model.ThreadId; SubscriptionType = model.SubscriptionType; PostId = replyRequestId; } catch (Exception e) { Error = e.ToString(); } finally { Busy.SetBusy(false); } }
private async Task SetLocation() { Busy.SetBusy(true, "get gps location"); var getAccessStatusFromSettings = SettingsService.Instance.AllowUseGPSDevice; if (getAccessStatusFromSettings == GeolocationAccessStatus.Unspecified) { SettingsService.Instance.AllowUseGPSDevice = await Geolocator.RequestAccessAsync(); getAccessStatusFromSettings = SettingsService.Instance.AllowUseGPSDevice; } if (getAccessStatusFromSettings == GeolocationAccessStatus.Allowed) { Geolocator locator = new Geolocator(); try { var position = await locator.GetGeopositionAsync(); Latitude = position.Coordinate.Latitude; Longitude = position.Coordinate.Longitude; } catch { Latitude = 0; Longitude = 0; } } Busy.SetBusy(false); }
/// <summary> /// Starts the timer to update map objects and the handler to update position /// </summary> public static async Task InitializeDataUpdate() { #region Compass management SettingsService.Instance.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { if (e.PropertyName == nameof(SettingsService.Instance.MapAutomaticOrientationMode)) { switch (SettingsService.Instance.MapAutomaticOrientationMode) { case MapAutomaticOrientationModes.Compass: _compass = Compass.GetDefault(); _compass.ReportInterval = Math.Max(_compass.MinimumReportInterval, 50); _compass.ReadingChanged += compass_ReadingChanged; break; case MapAutomaticOrientationModes.None: case MapAutomaticOrientationModes.GPS: default: if (_compass != null) { _compass.ReadingChanged -= compass_ReadingChanged; _compass = null; } break; } } }; //Trick to trigger the PropertyChanged for MapAutomaticOrientationMode ;) SettingsService.Instance.MapAutomaticOrientationMode = SettingsService.Instance.MapAutomaticOrientationMode; #endregion Busy.SetBusy(true, Resources.CodeResources.GetString("GettingGpsSignalText")); await LocationServiceHelper.Instance.InitializeAsync(); LocationServiceHelper.Instance.PropertyChanged += LocationHelperPropertyChanged; // Before starting we need game settings GameSetting = await DataCache.GetAsync(nameof(GameSetting), async() => (await _client.Download.GetSettings()).Settings, DateTime.Now.AddMonths(1)); // Update geolocator settings based on server LocationServiceHelper.Instance.UpdateMovementThreshold(GameSetting.MapSettings.GetMapObjectsMinDistanceMeters); if (_heartbeat == null) { _heartbeat = new Heartbeat(); } await _heartbeat.StartDispatcher(); // Update before starting timer Busy.SetBusy(true, Resources.CodeResources.GetString("GettingUserDataText")); //await UpdateMapObjects(); await UpdateInventory(); await UpdateItemTemplates(); if (PlayerProfile != null && PlayerStats != null) { Busy.SetBusy(false); } }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { SelectedHeroData = (HeroData)parameter; Busy.SetBusy(false); return(Task.CompletedTask); }
private void HandleExceptions(object sender, UnhandledExceptionEventArgs e) { var exception = e.Exception; ExceptionHandler.HandleException(exception.Message); e.Handled = true; Busy.SetBusy(false); }
private async void SyncLogBooks() { Busy.SetBusy(true, "sync logbooks with OneDrive"); var syncService = new SynchronizingDataService(); await syncService.SynchronizeLogBooks(); Busy.SetBusy(false); }
private async void Import_Data(object sender, RoutedEventArgs e) { Busy.SetBusy(true, "importing data"); long lastUpdatedTicks = (long)localSettings.Values["lastImport"]; localSettings.Values["lastImport"] = await Services.AzureServices.Blob.AzureBlobService.Get_Data(Convert.ToInt32(Timespan.Text), lastUpdatedTicks); Busy.SetBusy(false); }
/// <summary> /// Starts the timer to update map objects and the handler to update position /// </summary> public static async Task InitializeDataUpdate() { if (SettingsService.Instance.IsCompassEnabled) { _compass = Compass.GetDefault(); if (_compass != null) { _compassTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(Math.Max(_compass.MinimumReportInterval, 50)) }; _compassTimer.Tick += (s, e) => { if (SettingsService.Instance.IsAutoRotateMapEnabled) { HeadingUpdated?.Invoke(null, _compass.GetCurrentReading()); } }; _compassTimer.Start(); } } _geolocator = new Geolocator { DesiredAccuracy = PositionAccuracy.High, DesiredAccuracyInMeters = 5, ReportInterval = 1000, MovementThreshold = 5 }; Busy.SetBusy(true, Resources.CodeResources.GetString("GettingGpsSignalText")); Geoposition = Geoposition ?? await _geolocator.GetGeopositionAsync(); GeopositionUpdated?.Invoke(null, Geoposition); _geolocator.PositionChanged += GeolocatorOnPositionChanged; // Before starting we need game settings GameSetting = await DataCache.GetAsync(nameof(GameSetting), async() => (await _client.Download.GetSettings()).Settings, DateTime.Now.AddMonths(1)); // Update geolocator settings based on server _geolocator.MovementThreshold = GameSetting.MapSettings.GetMapObjectsMinDistanceMeters; if (_heartbeat == null) { _heartbeat = new Heartbeat(); } await _heartbeat.StartDispatcher(); // Update before starting timer Busy.SetBusy(true, Resources.CodeResources.GetString("GettingUserDataText")); //await UpdateMapObjects(); await UpdateInventory(); await UpdateItemTemplates(); Busy.SetBusy(false); }
private async void DeviceAuthenticate() { try { var authentication = TraktAuthenticationService.Instance; Busy.SetBusy(true, "Create authorization device..."); var deviceInfo = await authentication.CreateDeviceAsync(); Busy.SetBusy(false); if (deviceInfo.Success) { var primaryButtonDelegate = new DelegateCommand(async() => { var success = await Launcher.LaunchUriAsync(new Uri(deviceInfo.Url)); if (success) { Busy.SetBusy(true, "Retrieve authorization..."); var newAuthorization = await authentication.GetDeviceAuthorizationAsync(); if (newAuthorization.IsValid) { Authorization = newAuthorization; } Busy.SetBusy(false); } }); var dialog = new DeviceAuthenticationDialog { WebsiteUrl = deviceInfo.Url, UserCode = deviceInfo.UserCode, PrimaryButtonCommand = primaryButtonDelegate }; await dialog.ShowAsync(); } } catch (TraktException ex) { ShowTraktExceptionMessage(ex); } catch (Exception ex) { ShowExceptionMessage(ex); } finally { Busy.SetBusy(false); } }
/// <summary> /// Called when [navigated to asynchronous]. /// </summary> /// <param name="parameter">The parameter.</param> /// <param name="mode">The mode.</param> /// <param name="suspensionState">State of the suspension.</param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { Busy.SetBusy(true, "Laster inn data fra API"); await CheckForInternetConnection(); await FillIdList(); await GetNameOfTrips(); await GetStatistics(); Busy.SetBusy(false); Distance = 0; }
public static async Task HandleException(Exception e = null) { try { // Some exceptions can be caught and repaired if (e != null && (e.GetType() == typeof(HashVersionMismatchException))) { } else { bool showDebug = false; try { //get inside try/catch in case exception comes from settings instance (storage access issue, ...) showDebug = SettingsService.Instance.ShowDebugInfoInErrorMessage; } catch { } string message = Resources.CodeResources.GetString("SomethingWentWrongText"); if (showDebug) { message += $"\nException"; message += $"\n Message:[{e?.Message}]"; message += $"\n InnerMessage:[{e?.InnerException?.Message}]"; message += $"\n StackTrace:[{e?.StackTrace}]"; } var dialog = new MessageDialog(message); dialog.Commands.Add(new UICommand(Resources.CodeResources.GetString("YesText")) { Id = 0 }); dialog.Commands.Add(new UICommand(Resources.CodeResources.GetString("NoText")) { Id = 1 }); dialog.DefaultCommandIndex = 0; dialog.CancelCommandIndex = 1; var result = await dialog.ShowAsyncQueue(); if ((int)result.Id == 0) { GameClient.DoLogout(); BootStrapper.Current.NavigationService.Navigate(typeof(MainPage)); Busy.SetBusy(false); } } } catch (Exception ex) { HockeyClient.Current.TrackException(ex); Application.Current.Exit(); } }
//public Models.UserCredentials UserCredentials { get; set; } //private void fbSignup_OnClick(object sender, RoutedEventArgs e) //{ // SignUpRequested?.Invoke(this, null); //} private async void SignUpbtn_Click(object sender, RoutedEventArgs e) { Busy.SetBusy(true, "Registering..."); if (await MobileService.Instance.AuthenticateWithFacebook()) { MobileService.Instance.RegisterUser(UserData); } Busy.SetBusy(false); }
public void SelectedHeroChanged(object sender, ItemClickEventArgs e) { Busy.SetBusy(true); SelectedHero = (e.ClickedItem) as Hero; SelectedHeroData = HeroRepository.GetHeroData(SelectedHero.Name.Replace(Constants.HeroString, string.Empty)); SelectedHeroData.HeroFullImage = SelectedHero.FullImage; SelectedHeroData.AbilityList = HeroRepository.GetHeroAbilityByHeroName(SelectedHero.Name.Replace(Constants.HeroString, string.Empty)); NavigationService.Navigate(typeof(HeroDetail), SelectedHeroData, new SuppressNavigationTransitionInfo()); }
protected async Task LoadPage(int?page = null, int?limit = null) { Busy.SetBusy(true, "Loading box office movies..."); var traktBoxOfficeMovies = await Movies.GetBoxOfficeMoviesAsync(DEFAULT_EXTENDED_INFO); if (traktBoxOfficeMovies != null) { BoxOfficeMovies = traktBoxOfficeMovies; } Busy.SetBusy(false); }
private async void LoginClicked(object sender, RoutedEventArgs e) { Busy.SetBusy(true, "Pairing..."); if (await BandService.Instance.Connect()) { LoggedIn?.Invoke(this, null); HideRequested?.Invoke(this, null); } Busy.SetBusy(false); }
private async void LoginClicked(object sender, RoutedEventArgs e) { Busy.SetBusy(true, "Connecting..."); if (await MobileService.Instance.FacebookLogIn()) { LoggedIn?.Invoke(this, EventArgs.Empty); HideRequested?.Invoke(this, EventArgs.Empty); } Busy.SetBusy(false); }
protected override async Task LoadPage(int?page = null, int?limit = null) { Busy.SetBusy(true, "Loading most watched shows..."); var traktMostWatchedMovies = await Shows.GetMostWatchedShowsAsync(DEFAULT_EXTENDED_INFO, whichPage : page, limitPerPage : limit); if (traktMostWatchedMovies.Items != null) { MostWatchedShows = traktMostWatchedMovies.Items; SetPaginationValues(traktMostWatchedMovies); } Busy.SetBusy(false); }
protected override async Task LoadPage(int?page = default(int?), int?limit = default(int?)) { Busy.SetBusy(true, "Loading popular movies..."); var traktPopularMovies = await Movies.GetPopularMoviesAsync(DEFAULT_EXTENDED_INFO, whichPage : page, limitPerPage : limit); if (traktPopularMovies.Items != null) { PopularMovies = traktPopularMovies.Items; SetPaginationValues(traktPopularMovies); } Busy.SetBusy(false); }
protected override async Task LoadPage(int?page = null, int?limit = null) { Busy.SetBusy(true, "Loading recently updated shows..."); var traktRecentlyUpdatedMovies = await Shows.GetRecentlyUpdatedShowsAsync(extendedInfo : DEFAULT_EXTENDED_INFO, whichPage : page, limitPerPage : limit); if (traktRecentlyUpdatedMovies.Items != null) { RecentlyUpdatedShows = traktRecentlyUpdatedMovies.Items; SetPaginationValues(traktRecentlyUpdatedMovies); } Busy.SetBusy(false); }
public static async Task HandleException(Exception e = null) { try { if (e != null && (e.GetType() == typeof(ApiNonRecoverableException))) { Debug.WriteLine($"[Relogin] {nameof(ApiNonRecoverableException)} from API handled."); Debug.WriteLine("[Relogin] Successfuly ended."); } else if (e != null && e.GetType() == (typeof(AccessTokenExpiredException))) { await new MessageDialog(Resources.CodeResources.GetString("LoginExpired")).ShowAsyncQueue(); GameClient.DoLogout(); BootStrapper.Current.NavigationService.Navigate(typeof(MainPage)); } else if (e != null && e.GetType() == (typeof(AccountLockedException))) { await new MessageDialog("Account locked/banned").ShowAsyncQueue(); GameClient.DoLogout(); BootStrapper.Current.NavigationService.Navigate(typeof(MainPage)); } else { var dialog = new MessageDialog(Resources.CodeResources.GetString("SomethingWentWrongText") #if DEBUG + "\n(" + e?.Message + ")"); #else ); #endif dialog.Commands.Add(new UICommand(Resources.CodeResources.GetString("YesText")) { Id = 0 }); dialog.Commands.Add(new UICommand(Resources.CodeResources.GetString("NoText")) { Id = 1 }); dialog.DefaultCommandIndex = 0; dialog.CancelCommandIndex = 1; var result = await dialog.ShowAsyncQueue(); if ((int)result.Id == 0) { GameClient.DoLogout(); BootStrapper.Current.NavigationService.Navigate(typeof(MainPage)); Busy.SetBusy(false); } }
protected override async Task LoadPage(int?page = null, int?limit = null) { Busy.SetBusy(true, "Loading trending shows..."); var traktTrendingShows = await Shows.GetTrendingShowsAsync(DEFAULT_EXTENDED_INFO, whichPage : page, limitPerPage : limit); if (traktTrendingShows.Items != null) { TrendingShows = traktTrendingShows.Items; SetPaginationValues(traktTrendingShows); TotalUsers = traktTrendingShows.TotalUserCount.GetValueOrDefault(); } Busy.SetBusy(false); }