Hi,
How to convert this code in maui net 9.
using Autofac;
using GssdDesktopClient.API.Imp;
using GssdDesktopClient.Maui.Helpers;
using GssdDesktopClient.Maui.Pages;
using GssdDesktopClient.Maui.Startup;
using Microsoft.Maui.Controls.PlatformConfiguration;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Text;
namespace GssdDesktopClient.Maui
{
public partial class App : Application
{
private static Mutex mutex = new Mutex(true, Assembly.GetEntryAssembly().GetName().Name);
public App()
{
if (!mutex.WaitOne(TimeSpan.Zero, true))
{
Current.Quit();
Environment.Exit(0);
}
InitializeComponent();
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
MainPage = new LoginPage();
}
private async void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(LoginConfigurations.GetInstance().SessionToken))
{
var container = new Bootstrapper().Bootstrap();
IAutomationApiClient automationApiClient = container.Resolve<IAutomationApiClient>();
var res = await automationApiClient.PostLogOut($"{LoginConfigurations.GetInstance().Portal}/api/GSPortal/PostLogOut/false", LoginConfigurations.GetInstance().SessionToken);
}
}
catch (Exception ex)
{
}
}
protected override Window CreateWindow(IActivationState activationState)
{
Window window = base.CreateWindow(activationState);
try
{
window.Stopped += async(s,e) =>
{
if (!string.IsNullOrEmpty(LoginConfigurations.GetInstance().SessionToken ))
{
var container = new Bootstrapper().Bootstrap();
IAutomationApiClient automationApiClient = container.Resolve<IAutomationApiClient>();
var results = await automationApiClient.PostLogOut($"{LoginConfigurations.GetInstance().Portal}/api/GSPortal/PostLogOut/false", LoginConfigurations.GetInstance().SessionToken);
if(results)
{
App.Current.Quit();
}
}
};
}
catch (Exception)
{
}
return window;
}
}
}
when running app in debug it works but without debugging is not.
error:
XAML: .NET Runtime version currently executing is 8.0.5, but version 8.0.10 or later is required.
% dotnet --list-runtimes
Microsoft.AspNetCore.App 8.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
This is my dotnet workload list
Last login: Thu Jan 30 08:23:38 on ttys005
sasasoftware@Sasas-MacBook-Air ~ % dotnet workload list
Installed Workload Id Manifest Version Installation Source
maui 9.0.14/9.0.100 SDK 9.0.100
Use dotnet workload search to find additional workloads to install.