SuncodeSoftware.SuperSDK.App 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SuncodeSoftware.SuperSDK.App --version 2.2.0
                    
NuGet\Install-Package SuncodeSoftware.SuperSDK.App -Version 2.2.0
                    
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="SuncodeSoftware.SuperSDK.App" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SuncodeSoftware.SuperSDK.App" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SuncodeSoftware.SuperSDK.App" />
                    
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 SuncodeSoftware.SuperSDK.App --version 2.2.0
                    
#r "nuget: SuncodeSoftware.SuperSDK.App, 2.2.0"
                    
#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 SuncodeSoftware.SuperSDK.App@2.2.0
                    
#: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=SuncodeSoftware.SuperSDK.App&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SuncodeSoftware.SuperSDK.App&version=2.2.0
                    
Install as a Cake Tool

SuperSDK.App 使用指南

SuperSDK.App 提供开箱即用的应用框架,集成 ReactiveUI、Logger、SqlDebug。

快速开始

1️⃣ 引入命名空间(使用 SApp 别名)

using SApp = SuperSDK.App.SuperApp;

2️⃣ 在 App.axaml.cs 中初始化和清理

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using SApp = SuperSDK.App.SuperApp;

public partial class App : Application
{
    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);
        
        // 初始化 SuperSDK.App
        SApp.Initialize(config =>
        {
            // 注册内置的 Logger 和 SQL Debug 窗口
            config.UseBuiltInLogger(showOnStartup: false);
            config.UseSqlDebug(showOnStartup: false);
            
            // 注册项目特有的数据库实体
            config.RegisterEntity<YourEntity>();
            
            // 初始化完成后的回调(可选)
            config.OnInitialized = () =>
            {
                SApp.LogInfo("应用初始化完成");
            };
        });
    }

    public override void OnFrameworkInitializationCompleted()
    {
        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
        {
            desktop.MainWindow = new MainWindow();
            
            // 🔥 程序退出时清理资源
            desktop.ShutdownRequested += (s, e) =>
            {
                SApp.Cleanup();
            };
        }

        base.OnFrameworkInitializationCompleted();
    }
}

就这么简单! 只需要在 App.axaml.cs 中添加初始化和清理代码,无需在其他文件中做任何修改。

常用 API

Logger 操作

// 切换 Logger 窗口显示/隐藏
SApp.ToggleLogger();

// 记录日志
SApp.LogDebug("调试信息");
SApp.LogInfo("普通信息");
SApp.LogWarning("警告信息");
SApp.LogError("错误信息");

SQL Debug 操作

// 切换 SQL Debug 窗口显示/隐藏
SApp.ToggleSqlDebug();

完整示例

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using SApp = SuperSDK.App.SuperApp;
using YourApp.Models;

namespace YourApp;

public partial class App : Application
{
    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);
        
        SApp.Initialize(config =>
        {
            config.UseBuiltInLogger(showOnStartup: false);
            config.UseSqlDebug(showOnStartup: false);
            config.RegisterEntity<DeviceInfo>();
            
            config.OnInitialized = () =>
            {
                SApp.LogInfo("应用初始化完成");
            };
        });
    }

    public override void OnFrameworkInitializationCompleted()
    {
        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
        {
            desktop.MainWindow = new MainWindow();
            
            // 程序退出时清理资源
            desktop.ShutdownRequested += (s, e) =>
            {
                SApp.Cleanup();
            };
        }

        base.OnFrameworkInitializationCompleted();
    }
}

核心功能

✅ 自动集成

  • ReactiveUI 配置
  • Semi.Avalonia 主题加载

✅ 内置组件

  • Logger 窗口(GzLoggerView)
  • SQL Debug 窗口(GzSqlDebugView)

✅ 数据库管理

  • 自动注册实体类型
  • 自动初始化 DbContext
  • 支持自定义实体注册

注意事项

  1. 所有代码都在 App.axaml.cs 中完成

    • SApp.Initialize() - 在 Initialize() 方法中调用
    • SApp.Cleanup() - 在 OnFrameworkInitializationCompleted()ShutdownRequested 事件中调用
    • 无需在 MainWindow 或其他地方添加任何代码
  2. GzLogConfig 自动注册

    • 使用 UseBuiltInLogger() 时,GzLogConfig 实体会自动注册
    • 无需手动调用 RegisterEntity<GzLogConfig>()
  3. 别名推荐

    • 使用 using SApp = SuperSDK.App.SuperApp; 简化代码
    • 提高可读性和编码效率

更新日志

v1.1.1

  • ✅ 初始版本发布
  • ✅ 支持内置 Logger 和 SqlDebug
  • ✅ 自动加载 Semi.Avalonia 主题
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  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
2.3.0 0 1/16/2026
2.2.0 0 1/16/2026
2.1.0 0 1/16/2026
2.0.8 49 1/15/2026
2.0.6 45 1/15/2026
2.0.5 45 1/15/2026
2.0.4 48 1/15/2026
2.0.3 50 1/15/2026
2.0.2 47 1/15/2026
2.0.1 48 1/15/2026
2.0.0 53 1/15/2026
1.2.6 178 12/23/2025
1.2.5 166 12/23/2025
1.2.4 170 12/23/2025
1.2.2 168 12/23/2025
1.2.1 169 12/22/2025
1.2.0 160 12/22/2025
1.1.8 162 12/22/2025
1.1.7 167 12/22/2025
1.1.6 160 12/22/2025
1.1.5 168 12/22/2025
1.1.4 170 12/22/2025
1.1.3 165 12/22/2025
1.1.2 164 12/22/2025
1.1.1 166 12/22/2025
1.0.7 261 12/16/2025
1.0.6 260 12/16/2025
1.0.5 261 12/16/2025
1.0.4 262 12/16/2025
1.0.3 261 12/16/2025
1.0.2 260 12/16/2025
1.0.1 230 12/15/2025
1.0.0 219 12/15/2025

all bring readme