Skip to content

Instantly share code, notes, and snippets.

View andreas-nesheim's full-sized avatar

Andreas Nesheim andreas-nesheim

View GitHub Profile
var photo = await MediaPicker.CapturePhotoAsync();
var credentials = new ApiKeyServiceClientCredentials(Constants.SubscriptionKey);
var faceClient = new FaceClient(credentials) { Endpoint = Constants.Endpoint };
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>CommunityToolkit.Mvvm command (async)</Title>
<Shortcut>cmda</Shortcut>
<Description>Code snippet for async ICommand using the CommunityToolkit.Mvvm</Description>
<Author>Andreas Nesheim</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>CommunityToolkit.Mvvm command</Title>
<Shortcut>cmd</Shortcut>
<Description>Code snippet for ICommand using the CommunityToolkit.Mvvm</Description>
<Author>Andreas Nesheim</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>CommunityToolkit.Mvvm property</Title>
<Shortcut>propop</Shortcut>
<Description>Code snippet for ObservableProperty using the CommunityToolkit.Mvvm</Description>
<Author>Andreas Nesheim</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
using Plugin.Fingerprint.Abstractions;
namespace MauiBiometrics;
public partial class MainPage : ContentPage
{
private readonly IFingerprint fingerprint;
public MainPage(IFingerprint fingerprint)
{
var request = new AuthenticationRequestConfiguration("Prove you have fingers!", "Because without it you can't have access");
var result = await CrossFingerprint.Current.AuthenticateAsync(request);
if (result.Authenticated)
{
await DisplayAlert("Authenticated!", "Access granted", "Cool beans");
}
else
{
await DisplayAlert("Not authenticated!", "Access denied", "aww");
}
var command = new LightCommand { Alert = Alert.Once };
await client.SendCommandAsync(command);
private async void OnButtonClicked(object sender, EventArgs e)
{
var bridgeIP = "XXX.XXX.XX.XX";
var appKey = "abcdefghijklmnopqrstuvwxyz1234567890";
ILocalHueClient client = new LocalHueClient(bridgeIP);
client.Initialize(appKey);
}
<Grid Margin="0,10,40,30" ColumnDefinitions="50,50,50,*">
<Border
Margin="10,0,0,0"
Background="LightGray"
HorizontalOptions="Center"
Style="{StaticResource FontIconWithRoundedCornersStyle}"
VerticalOptions="Center">
<Label
FontFamily="IconFontTypes"
FontSize="24"