public UserViewModel(UserModel user = null) { if (user == null) { this.user = new UserModel(); } else { this.user = user; copyUser = this.user.GetCopy(); connectedToFb = AppInfo.AppUser?.FbId != null && AppInfo.AppUser?.FbId != "no_email_accept" && AppInfo.AppUser?.FbId != "no_facebook"; UserDataUpdated(); } this.Image = new BitmapImage(new Uri(@"ms-appx:///Assets/Graphics/btn_owl.png")); LogicHelper.DownloadPhoto(LogicHelper.CreateImageUrl(ImageTypeToDownload.ProfilePhotoBig, this.user.UserId), PhotoDownloaded); countryCodes = Task.Run(async() => await LogicHelper.GetCountriesCodes()).Result; if (string.IsNullOrWhiteSpace(this.user.CountryCode)) { var region = new GeographicRegion().CodeThreeLetter; var item = countryCodes.FirstOrDefault(r => r.ContryCode == region); if (item != null) { selectedCountry = item; } else { selectedCountry = countryCodes.FirstOrDefault(); } this.user.CountryCode = selectedCountry.PhoneCodeDigitOnly; } else { var item = countryCodes.FirstOrDefault(r => r.PhoneCodeDigitOnly == this.user.CountryCode); if (item != null) { selectedCountry = item; } else { selectedCountry = countryCodes.FirstOrDefault(); } } }