WuYongJie 5821d73291 初始提交:3D家具安装展示系统
包含:
- furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画)
- autocad-plugin:AutoCAD 家具导出插件源码
- 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:00:19 +08:00

68 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
namespace FurnitureExporter;
internal sealed class PendingExportSession
{
public PendingExportSession(string documentKey, IReadOnlyList<string> panelHandles)
{
DocumentKey = documentKey;
PanelHandles = panelHandles;
CreatedAtUtc = DateTime.UtcNow;
}
public string DocumentKey { get; }
public DateTime CreatedAtUtc { get; }
public IReadOnlyList<string> PanelHandles { get; }
}
/// <summary>
/// 导出向导的“暂停/恢复”会话管理。
/// 仅保存在内存中(不落盘),用于允许用户在两步之间调整图层显示等操作。
/// </summary>
internal static class ExportSessionManager
{
private static readonly object Sync = new();
private static readonly Dictionary<string, PendingExportSession> Sessions =
new(StringComparer.OrdinalIgnoreCase);
public static PendingExportSession? Get(string documentKey)
{
if (string.IsNullOrWhiteSpace(documentKey)) return null;
lock (Sync)
{
Sessions.TryGetValue(documentKey, out var session);
return session;
}
}
public static PendingExportSession SetPanels(string documentKey, IReadOnlyList<string> panelHandles)
{
if (string.IsNullOrWhiteSpace(documentKey))
throw new ArgumentException("documentKey is required", nameof(documentKey));
if (panelHandles == null)
throw new ArgumentNullException(nameof(panelHandles));
lock (Sync)
{
var session = new PendingExportSession(documentKey, panelHandles);
Sessions[documentKey] = session;
return session;
}
}
public static void Clear(string documentKey)
{
if (string.IsNullOrWhiteSpace(documentKey)) return;
lock (Sync)
{
Sessions.Remove(documentKey);
}
}
}