private async void initializeUser(string uid) { try { string res = await RdsConnect.getUser(uid); if (res == "Failure") { await DisplayAlert("Alert", "Error in getUser() in initializeUser() in AboutMePage", "OK"); } //Debug.WriteLine("ABOUT ME: " + res); UserResponse userResponse = JsonConvert.DeserializeObject <UserResponse>(res); ToUser(userResponse); userName.Text = user.FirstName + " " + user.LastName; //userImage.Source = user.PicUrl; if (user.user_birth_date == null) { userBirthDate.Text = "Date of birth: N/A"; } else { try { var date = DateTime.Parse(user.user_birth_date); Debug.WriteLine("DATE OF BIRTH: " + date.ToString("dd MMMM yyyy")); userBirthDate.Text = "Date of birth: " + date.ToString("dd MMMM yyyy"); } catch (Exception birthDate) { //await DisplayAlert("Oops", "Please sign in again to retrieve your account information. Thank you!", "OK"); userBirthDate.Text = "Date of birth: N/A"; } } if (user.PicUrl != null && user.PicUrl != "") { userPic.Source = user.PicUrl; } CreateList(); } catch (Exception a) { } }
private async void initializeUser(string uid) { try { string res = await RdsConnect.getUser(uid); if (res == "Failure") { await DisplayAlert("Alert", "Error in getUser() in initializeUser() in AboutMePage", "OK"); return; } Debug.WriteLine("ABOUT ME: " + res); UserResponse userResponse = JsonConvert.DeserializeObject <UserResponse>(res); ToUser(userResponse); var startDate = DateTime.Parse(user.datetime); var startDateCopy = DateTime.Parse(user.datetime); var endDate = DateTime.Now; startDateLabel.Text = startDate.ToString("MM/dd/yyyy"); endDateLabel.Text = endDate.ToString("MM/dd/yyyy"); int totalDays = -1; while (startDateCopy < endDate) { startDateCopy = startDateCopy.AddDays(1); totalDays++; } //var firstDayOfMonth = new DateTime(date.Year, date.Month, 1); //var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); start = startDate; rangeSliderAge.MinimumValue = 0; rangeSliderAge.LowerValue = 0; rangeSliderAge.MaximumValue = (float)totalDays; rangeSliderAge.UpperValue = (float)totalDays; GetHistoryData(startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")); } catch (Exception a) { } }
private async void initializeUser(string uid) { try { string res = await RdsConnect.getUser(uid); if (res == "Failure") { await DisplayAlert("Alert", "Error in getUser() in initializeUser() in AboutMePage", "OK"); } Debug.WriteLine("ABOUT ME: " + res); UserResponse userResponse = JsonConvert.DeserializeObject <UserResponse>(res); ToUser(userResponse); userName.Text = user.FirstName + " " + user.LastName; //userImage.Source = user.PicUrl; if (user.user_birth_date == null) { userBirthDate.Text = "Date of birth: N/A"; } else { try { var date = DateTime.Parse(user.user_birth_date); Debug.WriteLine("DATE OF BIRTH: " + date.ToString("dd MMMM yyyy")); userBirthDate.Text = "Date of birth: " + date.ToString("dd MMMM yyyy"); } catch (Exception birthDate) { //await DisplayAlert("Oops", birthDate.Message, "OK"); userBirthDate.Text = "Date of birth: N/A"; } } if (user.MessageCard != null) { messageCard.Text = user.MessageCard; } if (user.MessageDay != null) { messageDay.Text = user.MessageDay; } if (user.MajorEvents != null) { majorEvents.Text = user.MajorEvents; } if (user.MyHistory != null) { myHistory.Text = user.MyHistory; } if (user.PicUrl != null && user.PicUrl != "") { userPic.Source = user.PicUrl; } double height = Math.Max(messageCard.Text.Length + messageCard.Text.Length, messageDay.Text.Length + messageDay.Text.Length); Debug.WriteLine("HEIGHT: " + height); frameMessageCard.HeightRequest = height; frameMessageDay.HeightRequest = height; height = Math.Max(majorEvents.Text.Length + majorEvents.Text.Length, myHistory.Text.Length + myHistory.Text.Length); Debug.WriteLine("HEIGHT: " + height); frameMajorEvent.HeightRequest = height; frameMyHistory.HeightRequest = height; } catch (Exception a) { } }