KeiChat.WinUI 6.0.3

dotnet add package KeiChat.WinUI --version 6.0.3
                    
NuGet\Install-Package KeiChat.WinUI -Version 6.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KeiChat.WinUI" Version="6.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KeiChat.WinUI" Version="6.0.3" />
                    
Directory.Packages.props
<PackageReference Include="KeiChat.WinUI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KeiChat.WinUI --version 6.0.3
                    
#r "nuget: KeiChat.WinUI, 6.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KeiChat.WinUI@6.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KeiChat.WinUI&version=6.0.3
                    
Install as a Cake Addin
#tool nuget:?package=KeiChat.WinUI&version=6.0.3
                    
Install as a Cake Tool

A modern WPF UI toolkit for building chat clients on the .NET 5+ ecosystem. Below is the usage example:

public partial class App : Application
{
    private const string Tag = nameof(Tag);

    static App()
    {
        // Configure API gateway endpoints for the demo environment.
        AppSettings.SetGateway("https://api-chat-demo.chat-example.com");
        AppSettings.SetUploadFileGateway("https://upload-file-chat-example.com");
        AppSettings.SetUploadVideoGateway("https://upload-video-chat-example.com");
        AppSettings.SetUploadPictureGateway("https://upload-picture-chat-example.com");
        AppSettings.SetUploadAudioGateway("https://upload-audio-chat-example.com");
        AppSettings.SetUploadMergeGateway("https://upload-merge-chat-example.com");

        // Configure IM server connection details.
        AppSettings.SetIMServerHost("ims://im-demo.example.com");
        AppSettings.SetIMServerPort(89);
    }

    public App()
    {
        // Retrieve the assembly version string directly.
        string? versionString = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString();

        if (versionString != null)
        {
            AppSettings.SetVersion(versionString);
        }
    }

    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        // Subscribe to unhandled UI thread exceptions.
        DispatcherUnhandledException += App_DispatcherUnhandledException;
        // Subscribe to unhandled non-UI thread exceptions.
        // AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        // Subscribe to unobserved task exceptions.
        // TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

        // Launch image or video viewer if a single argument is provided.
        if (e.Args != null && e.Args.Length == 1)
        {
            // Handle preload argument.
            if ("-preload".Equals(e.Args[0]))
            {
                LogUtilityEx.Info("KeiChatPhotoApplication", "-preload");
                PhotoUI.KeiChatPhotoApplication.Preload();
                return;
            }

            // Merge photo viewer theme resources.
            Resources.MergedDictionaries.Add(new PhotoUI.Themes.Theme());
            // Launch the photo/video viewer application.
            PhotoUI.KeiChatPhotoApplication.Run(this, e.Args);
        }
        // Launch main chat application if no arguments or insufficient arguments are provided.
        else if (e.Args == null || e.Args.Length < PhotoUI.KeiChatPhotoApplication.CmdArgsLength)
        {
            // Merge main application theme resources.
            Resources.MergedDictionaries.Add(new WinUI.Themes.Theme());

            // Enable phone number login.
            AppSettings.EnablePhoneLogin(true);
            // Set callbacks for displaying legal documents.
            AppSettings.SetViewUserAgreement(UserAgreementWindow.Open);
            AppSettings.SetViewPrivacyPolicy(PrivacyPolicyWindow.Open);
            // Run the main chat application.
            KeiChatApplication.Run(e);
        }
        // Launch photo viewer with specific arguments.
        else
        {
            // Merge photo viewer theme resources.
            Resources.MergedDictionaries.Add(new PhotoUI.Themes.Theme());

            // Configure the endpoint for retrieving domain certificates.
            PhotoUI.AppSettings.SetCertificateUrl(Service.CertificateService.GenerateUrl());
            // Launch the photo/video viewer application.
            PhotoUI.KeiChatPhotoApplication.Run(this, e.Args);
        }
    }

    private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
    {
        // Log the fatal UI thread exception.
        LogUtilityEx.Fatal(Tag, "Unhandled UI thread exception occurred.", e.Exception);
        // Prevent application crash (uncomment to handle gracefully).
        // e.Handled = true;

        // Handle authentication failures specifically.
        if (e.Exception is AuthenticationException authenticationException)
        {
            EntryWindow.ExcUnAuthorized();
        }
    }

    private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        // Log the fatal non-UI thread exception.
        if (e.ExceptionObject is Exception ex)
        {
            LogUtilityEx.Fatal(Tag, "Unhandled non-UI thread exception occurred.", ex);
        }
        else
        {
            LogUtilityEx.Fatal(Tag, $"Unhandled non-UI thread exception object: {e}");
        }
    }

    private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
    {
        // Log the unobserved task exception.
        LogUtilityEx.Fatal(Tag, "Unobserved task exception occurred.", e.Exception);
        // Mark the exception as observed to prevent process termination.
        e.SetObserved();
    }
}

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.3 89 8/9/2026
6.0.2 80 8/5/2026
6.0.0 123 4/23/2026