WIP Avatar

This commit is contained in:
Paul Schneider 2016-12-15 02:32:10 +01:00
commit 13a7a35b6d
2 changed files with 11 additions and 8 deletions

View file

@ -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();

View file

@ -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
{ {