첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.15MB

▶ MauiProgram.cs

using System.Diagnostics;

using Microsoft.Maui.LifecycleEvents;

namespace TestProject;

/// <summary>
/// MAUI 프로그램
/// </summary>
public static class MauiProgram
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Method
    ////////////////////////////////////////////////////////////////////////////////////////// Static
    //////////////////////////////////////////////////////////////////////////////// Public

    #region MAUI 앱 생성하기 - CreateMauiApp()

    /// <summary>
    /// MAUI 앱 생성하기
    /// </summary>
    /// <returns>MAUI 앱</returns>
    public static MauiApp CreateMauiApp()
    {
        MauiAppBuilder builder = MauiApp.CreateBuilder();

        builder.UseMauiApp<App>()
            .ConfigureFonts
            (
                fontCollection =>
                {
                    fontCollection.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                }
            )
            .ConfigureLifecycleEvents
            (
                lifecycleBuilder =>
                {
#if WINDOWS
                    lifecycleBuilder.AddWindows
                    (
                        windowsLifecycleBuilder => windowsLifecycleBuilder.OnActivated((window, args) => LogEvent("활성화시"))
                            .OnClosed((window, args) => LogEvent("닫는 경우"))
                            .OnLaunching((window, args) => LogEvent("시작할 경우"))
                            .OnLaunched((window, args) => LogEvent("시작한 경우"))
                            .OnVisibilityChanged((window, args) => LogEvent("표시 변경시"))
                    );
#endif

                    static void LogEvent(string eventName, string type = null)
                    {
                        Debug.WriteLine($"수명 주기 이벤트 : {eventName}{(type == null ? string.Empty : $" ({type})")}");
                    }
                }
            );

        return builder.Build();
    }

    #endregion
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요