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 AndroidObservables | |
{ | |
public static IObservable<Intent> WhenIntentReceived(string intentAction) | |
{ | |
return Observable.Create<Intent>(ob => | |
{ | |
var filter = new IntentFilter(); | |
filter.AddAction(intentAction); | |
var receiver = new ObservableBroadcastReceiver |
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
async void Button_Clicked_3(System.Object sender, EventArgs args) { | |
var cts = new CancellationTokenSource(); | |
try | |
{ | |
// if any exception is thrown, the progress will be cleaned up automagically | |
using (var disp = UserDialogs.Instance.Loading( | |
"Long Load...", | |
// this will cancel the actual http call | |
() => cts.Cancel(), | |
"Cancel")) |
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
using Microsoft.Extensions.Logging; | |
using System; | |
namespace YourNamespace; | |
// IMauiInitializeService will register immediately after MAUI has built its service container, so this class will be ready to go for all of your code | |
public class MyServiceLocator : Microsoft.Maui.Hosting.IMauiInitializeService | |
{ | |
public static IServiceProvider Services { get; private set; } | |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<!--net6.0 at the end makes vs4mac happy--> | |
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android;net6.0</TargetFrameworks> | |
<OutputType Condition="'$(TargetFramework)' != 'net6.0'">Exe</OutputType> | |
<RootNamespace>MyNamespace</RootNamespace> | |
<UseMaui>true</UseMaui> |