WIP Avatar

main
Paul Schneider 9 years ago
parent 627ace8478
commit 7d384f6215
2 changed files with 11 additions and 8 deletions

@ -15,26 +15,29 @@ namespace BookAStar.Pages.UserProfile
InitializeComponent(); InitializeComponent();
AvatarButton.Clicked += AvatarButton_Clicked; AvatarButton.Clicked += AvatarButton_Clicked;
} }
public UserProfilePage(UserProfileViewModel model)
{
InitializeComponent();
AvatarButton.Clicked += AvatarButton_Clicked;
BindingContext = model;
}
private async void AvatarButton_Clicked (object sender, EventArgs e) private async void AvatarButton_Clicked (object sender, EventArgs e)
{ {
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{ {
DisplayAlert("No Camera", ":( No camera avaialble.", "OK"); await DisplayAlert("No Camera", ":( No camera avaialble.", "OK");
return; return;
} }
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{ {
Directory = "Sample", Directory = "Avatars",
Name = "test.jpg" Name = "me.jpg"
}); });
if (file == null) if (file == null)
return; return;
// ImageSource.FromFile(file.Path);
await DisplayAlert("File Location", file.Path, "OK");
AvatarButton.Image.File = file.Path;
/* ImageSource.FromStream(() => /* ImageSource.FromStream(() =>
{ {
var stream = file.GetStream(); var stream = file.GetStream();

@ -14,7 +14,7 @@ namespace BookAStar.ViewModels.UserProfile
using Model.Auth.Account; using Model.Auth.Account;
using Pages.UserProfile; using Pages.UserProfile;
internal class UserProfileViewModel : ViewModel public class UserProfileViewModel : ViewModel
{ {
public bool IsAPerformer public bool IsAPerformer
{ {

Loading…