Skip to content

Instantly share code, notes, and snippets.

View vhugogarcia's full-sized avatar
🏠
Working from home

Víctor Hugo García Hernández vhugogarcia

🏠
Working from home
View GitHub Profile
@vhugogarcia
vhugogarcia / ObservableRangeCollection.cs
Created April 16, 2024 13:10
Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
namespace Demo.Extensions;
/// <summary>
/// Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
/// </summary>
/// <typeparam name="T"></typeparam>
public class ObservableRangeCollection<T> : ObservableCollection<T>
{
/// <summary>
@vhugogarcia
vhugogarcia / azure-pipelines-ios.yml
Last active December 19, 2022 17:32
Azure Pipelines for .NET MAUI iOS
# Documentation
#
# Set the vX.X.X-X tag (vMAJOR.MINOR.PATCH-BUILD_NUMBER)
# Install the Mobile Versioning in your Azure workspace https://marketplace.visualstudio.com/items?itemName=DamienAicheh.mobile-versioning-task
#
parameters:
- name: environment
displayName: Select an Environment
type: string
@vhugogarcia
vhugogarcia / azure-pipelines-android.yml
Last active March 14, 2024 20:19
Azure DevOps Pipeline for .NET MAUI Android
# Documentation
#
# Set the vX.X.X-X tag (vMAJOR.MINOR.PATCH-BUILD_NUMBER) to trigger the pipeline
# Install the Mobile Versioning in your Azure workspace https://marketplace.visualstudio.com/items?itemName=DamienAicheh.mobile-versioning-task
#
parameters:
- name: environment
displayName: Select an Environment
type: string
@vhugogarcia
vhugogarcia / BackgroundContentPageMAUI.xaml
Created November 28, 2022 17:35
Set gradient background to content page in .NET MAUI
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
ios:Page.UseSafeArea="False">
<FlexLayout Direction="Column"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<FlexLayout.Background>
<LinearGradientBrush EndPoint="0,1">
using Firebase.Crashlytics;
#if IOS
using Foundation;
#else
using Firebase;
#endif
namespace DemoApp.Services.Firebase;
@vhugogarcia
vhugogarcia / FirebaseAnalyticsService.cs
Created October 30, 2022 23:20
.NET MAUI Firebase Analytics Service
using Microsoft.Maui.Controls.Compatibility;
using Firebase.Analytics;
#if IOS
using Foundation;
#else
using Android.Content;
using Android.OS;
#endif
@vhugogarcia
vhugogarcia / PopupService.cs
Last active September 26, 2022 21:59
This Popup service helps to create and update the layout of a popup, so it allows running multiple Lottie animations during a process
using CommunityToolkit.Maui.Views;
namespace MauiApp.Services.ToolkitPopup;
public class PopupService : IPopupService
{
readonly Page page = Application.Current?.MainPage ?? throw new NullReferenceException();
private Popup popup { get; set; }
/// <summary>
@vhugogarcia
vhugogarcia / ImageTinted.cs
Created June 16, 2022 12:27
How to tint an image in .NET MAUI for iOS and Android using Handlers
using System.Diagnostics;
using Microsoft.Maui.Platform;
namespace Demo.Handlers;
public partial class ImageTinted : Image
{
public ImageTinted()
{
ModifyImage();
@vhugogarcia
vhugogarcia / DemoMauiApp.csproj
Last active June 29, 2022 11:06
.NET MAUI Setting code signing keys for iOS physical devices
<!-- For non sim (emulators): $(RuntimeIdentifier.StartsWith('iossimulator-')) -->
<!-- For physical devices: $(RuntimeIdentifier.StartsWith('ios-')) -->
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Debug' and $(RuntimeIdentifier.StartsWith('ios-'))">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<!-- Remove the following line if entitlements are not required -->
<CodesignEntitlement>Entitlements.plist</CodesignEntitlement>
<!-- Set the Apple Certificate Key name -->
<CodesignKey>Apple Development Key(ABCDEF)</CodesignKey>
<!-- Set the Apple Provisioning Profile name -->
<CodesignProvision>App Development Profile</CodesignProvision>
@vhugogarcia
vhugogarcia / Fonts.Material.Design.3.xaml
Created May 25, 2022 23:05
MAUI Font resources for Material Design 3
<?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<x:String x:Key="FontRegular">NunitoRegular</x:String>
<x:String x:Key="FontMedium">NunitoMedium</x:String>
<x:String x:Key="FontMediumItalic">NunitoMediumItalic</x:String>
<x:String x:Key="FontBold">NunitoBold</x:String>