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

TestProject.zip
0.15MB

▶ MauiProgram.cs

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" );
                    fontCollection.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
                }
            )
            .ConfigureEssentials
            (
                essentialsBuilder =>
                {
                    essentialsBuilder.UseVersionTracking();
                }
            );

        return builder.Build();
    }

    #endregion
}

 

728x90

 

▶ MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <Button x:Name="checkButton"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        Text="버전 체크" />
</ContentPage>

 

300x250

 

▶ MainPage.xaml.cs

using System.Text;

namespace TestProject;

/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : ContentPage
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - MainPage()

    /// <summary>
    /// 생성자
    /// </summary>
    public MainPage()
    {
        InitializeComponent();

        this.checkButton.Clicked += checkButton_Clicked;
    }

    #endregion

    //////////////////////////////////////////////////////////////////////////////////////////////////// Method
    ////////////////////////////////////////////////////////////////////////////////////////// Private

    #region 버전 체크 버튼 클릭시 처리하기 - checkButton_Clicked(sender, e)

    /// <summary>
    /// 버전 체크 버튼 클릭시 처리하기
    /// </summary>
    /// <param name="sender">이벤트 발생자</param>
    /// <param name="e">이벤트 인자</param>
    private async void checkButton_Clicked(object sender, EventArgs e)
    {
        StringBuilder stringBuilder = new StringBuilder();

        stringBuilder.AppendLine($"최초 실행 여부 : {VersionTracking.IsFirstLaunchEver}");
        stringBuilder.AppendLine($"현재 버전 최초 실행 여부 : {VersionTracking.IsFirstLaunchForCurrentVersion}");
        stringBuilder.AppendLine($"현재 빌드 최소 실행 여부 : {VersionTracking.IsFirstLaunchForCurrentBuild}");
        stringBuilder.AppendLine($"현재 버전 : {VersionTracking.CurrentVersion}");
        stringBuilder.AppendLine($"현재 빌드 : {VersionTracking.CurrentBuild}");
        stringBuilder.AppendLine($"최초 설치 버전 : {VersionTracking.FirstInstalledVersion}");
        stringBuilder.AppendLine($"최초 설치 빌드 : {VersionTracking.FirstInstalledBuild}");
        stringBuilder.AppendLine($"버전 이력 : {string.Join(',', VersionTracking.VersionHistory)}");
        stringBuilder.AppendLine($"빌드 이력 : {string.Join(',', VersionTracking.BuildHistory)}");
        stringBuilder.AppendLine($"이전 버전 : {VersionTracking.PreviousVersion?.ToString() ?? "없음"}");
        stringBuilder.AppendLine($"이전 빌드 : {VersionTracking.PreviousBuild?.ToString() ?? "없음"}");

        await DisplayAlert("INFORMATION", stringBuilder.ToString(), "확인");
    }

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

댓글을 달아 주세요