public override async void OnAppearing(params object[] datas) { IsLoaded = false; while (!await WebApiService.CheckInternetConnection()) { } // Check Exist Latest Version await UpdateChecker.Execute(); // Table Loader TableLoader.Init(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)); // Check Language { LocalStorage.Storage.GetValueOrDefault <string>(LocalStorageKey.UserLanguageId, out string userLanguageId); if (userLanguageId == null) { userLanguageId = CultureInfo.CurrentUICulture.Name.Split('-')[0]; if (!CoverageLanguage.CoverageLanguages.ContainsKey(userLanguageId)) { // Default Language : EN userLanguageId = AppConfig.DEFAULT_LANGUAGE; } LocalStorage.Storage.AddOrUpdateValue <string>(LocalStorageKey.UserLanguageId, userLanguageId); } CultureInfo.CurrentCulture = new CultureInfo(userLanguageId); CultureInfo.CurrentUICulture = new CultureInfo(userLanguageId); } // Check Timezone { LocalStorage.Storage.GetValueOrDefault <string>(LocalStorageKey.UserTimeZoneId, out string userTimeZoneId); // Delete ExpiredCachedData if (TimeZoneInfo.Local.Id.Equals(userTimeZoneId)) { await _cacheService.DeleteExpiredCachedDataAsync(); } else { await _cacheService.DeleteAllCachedDataAsync(); } LocalStorage.Storage.AddOrUpdateValue <string>(LocalStorageKey.UserTimeZoneId, TimeZoneInfo.Local.Id); } string serverPubKey = await _webApiService.RequestAsync <string>(new WebRequestContext { SerializeType = SerializeType.MessagePack, MethodType = WebMethodType.GET, BaseUrl = AppConfig.PoseWebBaseUrl, ServiceUrl = AuthProxy.ServiceUrl, SegmentGroup = AuthProxy.P_PUBLISH_KEY, }); if (!string.IsNullOrEmpty(serverPubKey)) { CryptoFacade.Instance.RSA_FromXmlString(serverPubKey); ClientContext.eSignature = CryptoFacade.Instance.GetEncryptedSignature(); ClientContext.eSignatureIV = CryptoFacade.Instance.GetEncryptedSignatureIV(); } // Prepare SingletonPage ShinyHost.Resolve <AppMasterViewModel>(); // Notify Init //await _notificationService.Initialize(); // InAppBilling Item Init bool isBillingSystemInit = false; do { isBillingSystemInit = await ShinyHost.Resolve <InAppBillingService>().InitializeProduct(); if (!isBillingSystemInit) { await MaterialDialog.Instance.AlertAsync(LocalizeString.BillingSystem_Not_Available, LocalizeString.App_Title, LocalizeString.Ok, DialogConfiguration.AppTitleAlterDialogConfiguration); } } while (!isBillingSystemInit); var deviceInfoHelper = DependencyService.Resolve <IDeviceInfoHelper>(); if (!deviceInfoHelper.IsLicensed.HasValue || !deviceInfoHelper.IsLicensed.Value) { await MaterialDialog.Instance.AlertAsync(LocalizeString.Service_Not_Available, LocalizeString.App_Title, LocalizeString.Ok, DialogConfiguration.AppTitleAlterDialogConfiguration); } else if (!await _OAuthService.IsAuthenticatedAndValid() || !await ShinyHost.Resolve <LoginViewModel>().PoseLogin(true)) { await _OAuthService.Logout(); await ShinyHost.Resolve <LoginViewModel>().GuestLogin(); } IsLoaded = true; OnPropertyChanged("IsLoaded"); MessagingCenter.Send(this, "LoadingComplete"); }