调整代码

This commit is contained in:
GG Z
2026-02-22 20:03:42 +08:00
parent 2ad3d0fde0
commit 7e2d5be3cd
258 changed files with 2916 additions and 5013 deletions

View File

@@ -0,0 +1,31 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ShrlAlgoToolkit.RevitAddins.RvMEP
{
public partial class RoomCheckItem : ObservableObject
{
[ObservableProperty]
public partial bool IsSelected { get; set; }
[ObservableProperty]
public partial string Name { get; set; }
[ObservableProperty]
public partial Room Room { get; set; }
// 当 Room 属性被赋值时,这个方法会被自动调用
partial void OnRoomChanged(Room value)
{
// 只有当 Room 不为空时才计算默认颜色
if (value != null)
{
// 这里实现了“初始值”逻辑:每当 Room 变了Color 就重置为 Room 对应的颜色
Color = ColorAssist.GetDistinctColorById(value.Id);
}
}
[ObservableProperty]
public partial Color Color { get; set; }
}
}