scratch-link/scratch-link-mac/AppDelegate.cs
Christopher Willis-Ford 8be1d8b021 make ScratchLinkApp to take the place of MAUI app
Note that this builds and runs, but doesn't work: the Xamarin.Mac
implementation of `System.Net` always sets `IsWebSocketRequest` to
`false` and doesn't actually support WebSockets connections as a server.
2023-01-13 08:21:36 -08:00

42 lines
1.3 KiB
C#

// <copyright file="AppDelegate.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink.Mac;
using AppKit;
using CoreBluetooth;
using Foundation;
using ScratchLink.Mac.BLE;
/// <summary>
/// Scratch Link's implementation of the NSApplicationDelegate protocol.
/// </summary>
[Register("AppDelegate")]
public class AppDelegate : NSApplicationDelegate
{
/// <summary>
/// Called when the app's initialization is complete but it hasn't received its first event.
/// </summary>
/// <param name="notification">A notification named <c>didFinishLaunchingNotification</c>.</param>
public override void DidFinishLaunching(NSNotification notification)
{
var appBuilder = new ScratchLinkApp.Builder();
appBuilder.SetArguments(new NSProcessInfo().Arguments);
appBuilder.SetSessionManager<MacSessionManager>();
appBuilder.SetGattHelpers<MacGattHelpers, CBUUID>();
var app = appBuilder.Build();
app.Run();
}
/// <summary>
/// Called when the app is about to terminate.
/// </summary>
/// <param name="notification">A notification named <c>willTerminateNotification</c>.</param>
public override void WillTerminate(NSNotification notification)
{
// Insert code here to tear down your application
}
}