SuncodeSoftware.SuperSDK.UI 3.0.0

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

SuperSDK.UI

Avalonia UI 通用组件库,提供统一风格的 UI 组件和工具。

🎯 核心功能

1. 窗口组件

  • GzTitleBarCtrl - 统一风格的自定义标题栏(必须使用)
  • GzAboutView - 关于窗口
  • GzLoggerView - 日志查看器
  • GzSqlDebugView - SQL 调试工具

2. MVVM 基础

  • ViewModelBase - ReactiveUI 基类,集成 MessageBus 自动清理

3. 通知与对话框

  • GzNotification - 轻量级通知(右上角弹窗)
  • UIHelper - 模态对话框(错误/警告/信息)

4. 工具类

  • UIThreadHelper - UI 线程调度

📐 UI 风格规范

✅ 必须遵守的规范

1. 使用 GzTitleBarCtrl 作为标题栏
<Window SystemDecorations="None"
        Background="Transparent"
        TransparencyLevelHint="Transparent">
    <Border Background="{DynamicResource SemiColorBackground1}" 
            CornerRadius="6"
            BorderBrush="{DynamicResource SemiColorBorder}"
            BorderThickness="1">
        <Grid RowDefinitions="Auto,*">
            <views:GzTitleBarCtrl Grid.Row="0"
                                  Title="我的窗口"
                                  IsMaxEnabled="True"
                                  IsMinEnabled="True"/>
            <ContentControl Grid.Row="1" Content="{Binding}" />
        </Grid>
    </Border>
</Window>
2. 使用 DynamicResource 适配主题

❌ 错误示例(硬编码颜色):

<Border Background="#1e1e1e" BorderBrush="#3f3f46">
    <TextBlock Foreground="#FFFFFF" Text="标题" />
</Border>

✅ 正确示例(使用 DynamicResource):

<Border Background="{DynamicResource SemiColorBackground1}" 
        BorderBrush="{DynamicResource SemiColorBorder}">
    <TextBlock Foreground="{DynamicResource SemiColorText0}" Text="标题" />
</Border>

🎨 Semi.Avalonia 主题资源

资源名称 用途 示例
背景色
SemiColorBackground0 最深背景(工具栏) #2b2b2b (Dark)
SemiColorBackground1 主背景(窗口) #1e1e1e (Dark)
SemiColorBackground2 次级背景(面板) #252526 (Dark)
SemiColorBackground3 三级背景(卡片) #18181B (Dark)
SemiColorBackground4 最浅背景 #27272A (Dark)
文字色
SemiColorText0 主要文字 #FFFFFF (Dark)
SemiColorText1 次要文字 #CCCCCC (Dark)
SemiColorText2 辅助文字 #808080 (Dark)
SemiColorText3 禁用文字 #666666 (Dark)
边框色
SemiColorBorder 普通边框 #3f3f46 (Dark)
SemiColorFocusBorder 焦点边框 #007ACC (Dark)
填充色
SemiColorFill0 Hover 背景 半透明
SemiColorFill1 次级填充 半透明
SemiColorFill2 三级填充 半透明
语义色
SemiColorPrimary 主题色(蓝) #007ACC
SemiColorSuccess 成功(绿) #28a745
SemiColorDanger 危险(红) #E81123
SemiColorWarning 警告(黄) #FFA500
SemiColorInformation 信息(蓝) #0064fa

🖱️ 交互样式示例

ListBox Hover 和 Selected:

<ListBox.Styles>
    <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
        <Setter Property="Background" Value="{DynamicResource SemiColorFill0}"/>
    </Style>
    <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
        <Setter Property="Background" Value="{DynamicResource SemiColorPrimary}"/>
    </Style>
</ListBox.Styles>

🚀 组件使用

1. ViewModelBase

public class MyViewModel : ViewModelBase
{
    private string _name = "";
    public string Name
    {
        get => _name;
        set => this.RaiseAndSetIfChanged(ref _name, value);
    }
    
    public override void RegisterMsg()
    {
        MessageBus.Subscribe<MyMessage>(this, OnMyMessage);
    }
}

2. GzNotification 通知


// 显示通知
GzNotification.Instance.Show(
    "操作成功", 
    "数据已保存", 
    NotificationType.Success
);

3. UIHelper 对话框

// 错误对话框
await UIHelper.GzShowErrorMsg(
    "加载错误", 
    "文件不存在",
    parentWindow: this
);

// 警告对话框
await UIHelper.GzShowWarningMsg("警告", "此操作无法撤销");

// 信息对话框
await UIHelper.GzShowInfoMsg("提示", "文件已保存");

// 确认对话框(返回 true/false)
var result = await UIHelper.GzShowConfirmDialog(
    "确认删除", 
    "是否确定删除该项?",
    this
);
if (result)
{
    // 用户点击确定
}

4. UIThreadHelper

// UI 线程执行
await UIThreadHelper.RunOnUIThread(() =>
{
    StatusText = "完成";
});

5. 窗口关闭事件处理

public partial class MyWindow : Window
{
    public MyWindow()
    {
        InitializeComponent();
        
        // 关闭前确认
        Closing += async (sender, args) =>
        {
            args.Cancel = true;
            var result = await UIHelper.GzShowConfirmDialog(
                "确认", "是否关闭?", this
            );
            if (result)
            {
                Closing -= Closing;
                Close();
            }
        };
    }
}

📝 完整窗口模板

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:views="clr-namespace:SuperSDK.UI.Views;assembly=SuperSDK.UI"
        SystemDecorations="None"
        Background="Transparent"
        TransparencyLevelHint="Transparent"
        CanResize="True">
    
    <Border Background="{DynamicResource SemiColorBackground1}"
            BorderBrush="{DynamicResource SemiColorBorder}"
            BorderThickness="1"
            CornerRadius="6">
        <Grid RowDefinitions="Auto,*,Auto">
            
            <views:GzTitleBarCtrl Grid.Row="0"
                                  Title="我的应用"
                                  IsMaxEnabled="True"
                                  IsMinEnabled="True"/>
            
            
            <Border Grid.Row="1" 
                    Background="{DynamicResource SemiColorBackground2}"
                    Padding="20">
                <TextBlock Text="内容"
                          Foreground="{DynamicResource SemiColorText0}"/>
            </Border>
            
            
            <Border Grid.Row="2"
                    Background="{DynamicResource SemiColorBackground0}"
                    BorderBrush="{DynamicResource SemiColorBorder}"
                    BorderThickness="0,1,0,0"
                    Padding="16,8">
                <Button Content="确定" Classes="Primary"/>
            </Border>
        </Grid>
    </Border>
</Window>
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 (3)

Showing the top 3 NuGet packages that depend on SuncodeSoftware.SuperSDK.UI:

Package Downloads
SuncodeSoftware.SuperSDK.App

Application foundation framework for Avalonia-based Goes applications

GoesSoftware.SuperSDK.Canvas

SuperSDK Canvas - 开箱即用的 Avalonia 画布组件,支持设备绘制、连线管理、缩放平移等功能

SuncodeSoftware.SuperSDK.Canvas

SuperSDK Canvas - 开箱即用的 Avalonia 画布组件,支持设备绘制、连线管理、缩放平移等功能

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.7.1 0 2/6/2026
3.7.0 0 2/6/2026
3.6.0 0 2/6/2026
3.5.0 0 2/6/2026
3.4.0 35 2/5/2026
3.3.0 28 2/5/2026
3.2.0 29 2/5/2026
3.1.1 30 2/5/2026
3.1.0 31 2/5/2026
3.0.0 44 2/5/2026
2.8.5 102 2/3/2026
2.8.4 108 2/3/2026
2.8.2 104 2/3/2026
2.8.1 109 2/3/2026
2.8.0 105 2/3/2026
2.7.0 105 2/3/2026
2.6.1 106 2/3/2026
2.6.0 112 2/3/2026
2.5.0 110 2/3/2026
2.4.0 114 2/2/2026
2.3.0 123 1/16/2026
2.2.0 124 1/16/2026
2.1.0 127 1/16/2026
2.0.8 121 1/15/2026
2.0.7 113 1/15/2026
2.0.6 125 1/15/2026
2.0.5 119 1/15/2026
2.0.4 120 1/15/2026
2.0.3 126 1/15/2026
2.0.2 119 1/15/2026
2.0.1 120 1/15/2026
2.0.0 129 1/15/2026
1.2.6 217 12/23/2025
1.2.5 211 12/23/2025
1.2.4 209 12/23/2025
1.2.2 209 12/23/2025
1.2.1 214 12/22/2025
1.2.0 210 12/22/2025
1.1.8 202 12/22/2025
1.1.7 208 12/22/2025
1.1.6 206 12/22/2025
1.1.5 203 12/22/2025
1.1.4 214 12/22/2025
1.1.3 215 12/22/2025
1.1.2 210 12/22/2025
1.1.1 208 12/22/2025
1.0.7 280 12/16/2025
1.0.6 280 12/16/2025
1.0.5 281 12/16/2025
1.0.4 283 12/16/2025
1.0.3 279 12/16/2025
1.0.2 282 12/16/2025
1.0.1 244 12/15/2025
1.0.0 222 12/15/2025

double theme