using XFEExtension.NetCore.StringExtension; using XFEExtension.NetCore.XApp.Core; using XFEExtension.NetCore.XApp.Extensions; using XFEExtension.NetCore.XFETransform; internal class Program { [SMTest] private static async Task MainTest() { try { var app = CreateXApp(); var page = await app.GetMainPage(); } catch (Exception ex) { Console.WriteLine(ex); } } private static XApp CreateXApp() { var appInfo = new XAppInformation(string.Empty, "be98276c-48d6-451d-8a0a-a311d782d9d6", "第一个小程序", new Version(1, 0, 3), "这是第一个小程序", "XFE工作室室长", "4174240069", string.Empty, string.Empty, string.Empty, string.Empty); var xApp = new XApp { AppInformation = appInfo }; xApp.AppFiles.Add(XAppCode.FromCode(XAppFileType.XFCS, "XApp.xfcs", """ namespace MyFirstXApp; public class XAppProgram { public static void Main(string[] args) { XAppBuilder.CreateBuilder() .WithPageDev(new MainPage()) .BuildAndRun(); } } """)); xApp.AppFiles.Add(XAppCode.FromCode(XAppFileType.CS, "GlobalUsing.g.cs", """ global using global::Microsoft.Maui; global using global::Microsoft.Maui.Controls; global using global::Microsoft.Maui.Controls.Hosting; global using global::Microsoft.Maui.Controls.Xaml; global using global::Microsoft.Maui.Dispatching; global using global::Microsoft.Maui.Graphics; global using global::System; global using global::System.Collections.Generic; global using global::System.IO; global using global::System.Linq; global using global::XFEExtension.NetCore.XApp; global using global::System.Threading; global using global::System.Threading.Tasks; """)); xApp.AppFiles.Add(XAppCode.FromCode(XAppFileType.XFCS, "MainPage.xfcs", """" namespace MyFirstXApp; public partial class MainPage : ContentPage { public MainPage() { InitXAppPage(); } } """")); xApp.AppFiles.Add(XAppCode.FromCode(XAppFileType.CS, "MainPage.g.cs", """" namespace MyFirstXApp; public partial class MainPage { internal void InitXAppPage() { this.LoadFromXaml(@"[XFMLTOLOAD]"); } } """")); xApp.AppFiles.Add(XAppCode.FromCode(XAppFileType.XFML, "MainPage.xfml", """ """)); return xApp; } }