private void Auth_Error(object sender, AuthenticatorErrorEventArgs e) { _logger.LogError("Received an error from auth callback.", e.Exception); _toastService.LongToast($"Oops! Looks like there was an issue. Please try again. Error: '{e.Message}'"); LoadingAnimVisible = false; LoadingAnimRunning = false; LoginLayoutVisible = true; }
private async void PurchaseButtonClicked() { LoadAnimationRunning = true; LoadAnimationVisible = true; PurchaseButtonEnabled = false; try { SubscriptionType selected = SubscriptionType.Basic; var subCode = SubscriptionUtility.GetInfoFromSubType(selected).SubscriptionCode; try { await PurchaseSubscription(subCode); await _alertUtility.Display("Purchase Complete", "Thank you for your purchase!", "Ok"); _nav.PopToRoot(); } catch (Exception ex) { _toastService.LongToast($"Failed to purchase subscription. {ex.Message}"); } } catch (Exception ex) { _toastService.LongToast($"Something went wrong when trying to purchase subscription. {ex.Message}"); } finally { try { PurchaseButtonEnabled = true; LoadAnimationRunning = false; LoadAnimationVisible = false; } catch { } } }
private async Task PurchaseButtonClicked() { LoadAnimationRunning = true; LoadAnimationVisible = true; PurchaseButtonEnabled = false; try { var code = SubscriptionUtility.GetSingleReportInfo(_validation).Code; try { await PurchaseItem(code); await _alertUtility.Display("Purchase Complete", "Thank you for your purchase!", "Ok"); _nav.PopToRoot(); } catch (Exception ex) { _toastService.LongToast($"Failed to purchase report. {ex.Message}"); } } catch (Exception ex) { _toastService.LongToast($"Something went wrong when trying to purchase report. {ex.Message}"); } finally { try { PurchaseButtonEnabled = true; LoadAnimationRunning = false; LoadAnimationVisible = false; } catch { } } }
private async Task LoadPropertyAndImage() { try { if ((_property == null || _image == null) && _order.Fulfilled) { // Try to download measurements when order is marked as fulfilled but measurements aren't found. MainLayoutVisible = false; StatusMessageVisible = false; LoadingAnimVisible = true; LoadingAnimRunning = true; if (_property == null) { PropertyModel newModel = null; try { newModel = (await _propertyService.GetProperties(new List <string>() { _order.OrderId })).First().Value; } catch { } if (newModel == null || string.IsNullOrWhiteSpace(newModel.OrderId)) { _toastService.LongToast($"Your order is marked as completed but the measurements cannot be found. Please check your internet connection and try again."); _logger.LogError($"Order is marked as completed but no measurements found.", null, $"Order id: {newModel.OrderId}"); return; } _propertyCache.Put(newModel.OrderId, newModel); _property = newModel; } if (_image == null) { ImageModel image = null; try { image = _imageService.GetImages(new List <string>() { _order.OrderId }).First().Value; } catch { } if (image == null) { _toastService.LongToast($"Your order is marked as completed but the image cannot be found. Please check your internet connection."); _logger.LogError($"Order is marked as completed but no image found.", null, $"Order id: {_order.OrderId}"); } else { _imageCache.Put(_order.OrderId, image); _image = image; } } LoadingAnimVisible = false; LoadingAnimRunning = false; MainLayoutVisible = true; if (_property.Roofs.Count > 1) { RoofSelectionVisible = true; RoofsSource = _property.Roofs.Select(x => x.Name).Distinct().ToList(); RoofsSource = new[] { "All" }.Concat(RoofsSource).ToList(); } else { RoofSelectionVisible = false; } SetUIMeasurements(0); } } catch (Exception ex) { _logger.LogError($"Failed to load property and image.", ex); } }