This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create scope explicitly | |
using (var scope = Services.CreateScope()) | |
{ | |
var dbService = scope.ServiceProvider.GetRequiredService<IDbService>(); | |
// All resolved services share the same scope | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MauiProgram | |
{ | |
public static MauiApp CreateMauiApp() | |
{ | |
var builder = MauiApp.CreateBuilder(); | |
// Core MAUI services | |
builder.UseMauiApp<App>() | |
.ConfigureFonts(fonts => {...}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet new maui -n MySuperApp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Biometric Auth in .NET 10 | |
var result = await BiometricAuthentication.AuthenticateAsync( | |
new AuthenticationRequest("Login", "Scan your fingerprint")); | |
if (result.Authenticated) LoadSecureData(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<BlazorWebView HostPage="wwwroot/index.html"> | |
<BlazorWebView.RootComponents> | |
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" /> | |
</BlazorWebView.RootComponents> | |
</BlazorWebView> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CollectionView ItemsSource="{Binding Posts}" | |
CachingStrategy="RecycleElement" | |
ItemTemplate="{StaticResource PostTemplate}" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (DeviceInfo.Platform != DevicePlatform.Android || DeviceInfo.DeviceType == DeviceType.Virtual) | |
{ | |
// Simplify animations | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animation = new Animation(v => myLabel.Rotation = v, 0, 360); | |
animation.Commit(this, "RotateAnimation", 16, 2000, Easing.Linear); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<BoxView | |
Color="Red" | |
WidthRequest="60" | |
HeightRequest="60" | |
CornerRadius="30" | |
HorizontalOptions="Start" | |
VerticalOptions="Start"> | |
<BoxView.GestureRecognizers> | |
<PanGestureRecognizer PanUpdated="OnPanUpdated" /> | |
</BoxView.GestureRecognizers> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private double _startX, _startY; | |
void OnPanUpdated(object sender, PanUpdatedEventArgs e) | |
{ | |
var box = (BoxView)sender; | |
switch (e.StatusType) | |
{ | |
case GestureStatus.Started: | |
_startX = box.TranslationX; |