private async Task ImprimirImagen() { sesionService = new SesionService(); if (await sesionService.CheckSesionDbAsync() == true) { List <Sesion> listaSesiones = await sesionService.GetSesionDbAsync(); if (listaSesiones.Count > 0) { Sesion sesion = listaSesiones[0]; nombreUsuario.Text = sesion.firstName + " " + sesion.lastName; if (sesion.photo != null) { if (sesion.photo.Contains("https:")) { imagenPerfil.Source = ImageSource.FromUri(new Uri(sesion.photo)); } else { imagenPerfil.Source = ImageSource.FromUri(new Uri("http://www.palmapplicationsv.com/techoapp/public/" + sesion.photo)); } } else { imagenPerfil.Source = ImageSource.FromFile("photo.png"); } } } else { nombreUsuario.Text = ""; imagenPerfil.Source = ImageSource.FromFile("photo.png"); } }
private async Task initializeData() { sesionService = new SesionService(); var exists = await sesionService.CheckSesionDbAsync(); if (exists == false) { StackLayout sl = new StackLayout(); Label l = new Label(); l.HorizontalOptions = LayoutOptions.Center; l.VerticalOptions = LayoutOptions.Start; l.Text = "Necesitas iniciar sesion primero"; l.FontSize = 24; sl.Children.Add(l); Content = sl; } }