public void StoreUser(string id, string name, string photo, UserRole role, string companyId = "", bool hasLocation = false, decimal offset = 0, string idiom = "en-us", string token = "") { Helpers.Settings.DisplayUserId = id; Helpers.Settings.DisplayUserName = name; Helpers.Settings.DisplayUserRole = role.ToString(); Helpers.Settings.DisplayUserPhoto = photo; Helpers.Settings.DisplayUserCompany = companyId; Helpers.Settings.DisplayHasLocation = hasLocation; Helpers.Settings.DisplayMyOffset = offset; if (!string.IsNullOrEmpty(token)) { Helpers.Settings.DisplayUserToken = token; } if (idiom == "1") { Helpers.Settings.DisplayUserIdiom = "pt-br"; } else if (idiom == "2") { Helpers.Settings.DisplayUserIdiom = "en-us"; } else if (idiom == "3") { Helpers.Settings.DisplayUserIdiom = "es-es"; } else if (idiom == "0") { Helpers.Settings.DisplayUserIdiom = "en-us"; } else if (idiom == "4") { Helpers.Settings.DisplayUserIdiom = "it-it"; } else { Helpers.Settings.DisplayUserIdiom = idiom; } //20190104 - XND - Alterei aqui pra so mudar a cultura do resources inves da cultura do app todo var culture = new CultureInfo(Helpers.Settings.DisplayUserIdiom); AppResource.Culture = culture; App.AppCurrent.Culture = culture; MenuListData.Reload(); //Culture = CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(Helpers.Settings.DisplayUserIdiom); //AppResource.Culture = Culture; }
private async void OnRegisterTapped(object sender, EventArgs e) { if (!CheckInfos()) { return; } ApiService service = new ApiService(); try { Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); string deviceType = ""; switch (Device.OS) { case TargetPlatform.Other: deviceType = "Other"; break; case TargetPlatform.iOS: deviceType = "ios"; break; case TargetPlatform.Android: deviceType = "android"; break; case TargetPlatform.WinPhone: deviceType = "WindowsPhone"; break; case TargetPlatform.Windows: deviceType = "Windows"; break; default: deviceType = "None"; break; } _updateUser.Name = txtName.Text; _updateUser.CityName = txtCity.Text; _updateUser.Cellphone = txtPhone.Text; _updateUser.DesirableLanguage = (pckIdioma.SelectedIndex + 1).ToString(); _updateUser.Id = Helpers.Settings.DisplayUserId; if (imageStream != null) { _updateUser.Photo = await service.UploadImage(imageStream); Helpers.Settings.DisplayUserPhoto = _updateUser.Photo; } var json = JsonConvert.SerializeObject(_updateUser); var result = await service.PutAsync(json, "user/updateMe"); App.AppCurrent.UpdateLanguage(_updateUser.DesirableLanguage); MenuListData.Reload(); await App.AppCurrent.ConfigureAppPhase(); var userRetorno = JsonConvert.DeserializeObject <Employee>(result); Helpers.Settings.DisplayUserPhoto = _updateUser.Photo; Helpers.Settings.DisplayUserName = txtName.Text; Acr.UserDialogs.UserDialogs.Instance.Toast(AppResource.lblItemUpdatedSucess); } catch (Exception ex) { this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }