jlandersen / xamarin-forms-camera Goto Github PK
View Code? Open in Web Editor NEWExample of retrieving pictures with a device camera in a Xamarin Forms application
Example of retrieving pictures with a device camera in a Xamarin Forms application
I'm using a WP8.1 device, when I try to retarget the WinPhone project, no works.
After calling the method Camera.TakePicture there is no call back from the Camera class ???????????
It compile but when i go to this page,the page ,where there is the fab that had to call all the stuff with the binding it crash
@jlandersen
`using Sport.Pagine.Login;
using Sport.Services;
using Sport.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Sport.Pagine
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Account : ContentPage
{
public User Current { get; set; }
public Account()
{
NavigationPage.SetHasNavigationBar(this, false);
Current = App.CredentialsService.GetCurrentUser();
BindingContext = Current;
InitializeComponent();
BindingContext = new TakePictureViewModel(DependencyService.Get<ICameraProvider>()); ;
}
private async Task OnDeleteAccount(object sender, EventArgs e)
{
if (!DatabaseManager.IsOnline())
await DisplayAlert("No connection", "Impossible to delete the account", "Ok");
else
{
var answer = await DisplayAlert("Are you sure you want to delete your account?", "All your items and settings will be permanently deleted", "Yes", "No");
if (answer)
{
var items = await DatabaseManager.DefaultManager.GetItemsAsync("allItems");
foreach (var i in items)
{
if (i.UserId.Equals(App.CredentialsService.Id))
await DatabaseManager.DefaultManager.DeleteTaskAsync(i);
}
await DatabaseManager.DefaultManager.DeleteUserParticipations(Current);
await DatabaseManager.DefaultManager.DeleteUserAsync(Current);
await DisplayAlert("Account deleted", "Now you will be logged out", "OK");
MasterDetailPage1.OnLogoutButtonClicked();
}
}
}
private async Task OnSaveChanges(object sender, EventArgs e)
{
if (!DatabaseManager.IsOnline())
await DisplayAlert("No connection", "Impossible to delete the account", "Ok");
else
{
//Current.Name = entryName.Text;
//Current.Email = entryEmail.Text;
await DatabaseManager.DefaultManager.InsertUserAsync(Current);
App.CredentialsService.DeleteCredentials();
App.CredentialsService.SaveCredentials(Current);
await DisplayAlert("Settings saved", "Your settings have been saved", "OK");
await Navigation.PopAsync();
}
}
}
}
<ContentPage.Content>
<controls:CircleImage Source="{Binding Picture}" WidthRequest="65" HeightRequest="65" Aspect="AspectFit" HorizontalOptions="CenterAndExpand" VerticalOptions="Start"/>
<fab:FloatingActionButtonView
ImageName="camera.png"
x:Name="FloatingActionButtonAdd"
ColorNormal="Transparent"
ColorPressed="Transparent"
ColorRipple="Transparent"
IsVisible="True"
HorizontalOptions="End"/>
<StackLayout VerticalOptions="Center" Margin="20">
<Button Text="SAVE CHANGES" BackgroundColor="Blue" TextColor="White" FontSize="Medium" HorizontalOptions="Center" VerticalOptions="Center" Clicked="OnSaveChanges"/>
</StackLayout>
<StackLayout VerticalOptions="Center" Margin="20">
<Button Text="DELETE ACCOUNT" BackgroundColor="Crimson" TextColor="White" FontSize="Medium" HorizontalOptions="Center" VerticalOptions="Center" Clicked="OnDeleteAccount"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.