调整代码

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,41 @@
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
public partial class ColorPickerViewModel : ObservableObject
{
public ColorPickerViewModel(Color color)
{
SelectedColor = color;
//this.IsActive = true;
//WeakReferenceMessenger.Default.Register<ColorPickerViewModel>(this, (r, m) =>
//{
// // Handle the message here, with r being the recipient and m being the
// // input message. Using the recipient passed as input makes it so that
// // the lambda expression doesn't capture "this", improving performance.
//});
}
[ObservableProperty]
public partial Color SelectedColor { get; set; }
[RelayCommand]
private void Confirm(object obj)
{
if (obj is System.Windows.Window window)
{
var colorMessage = new Autodesk.Revit.DB.Color(
SelectedColor.R,
SelectedColor.G,
SelectedColor.B
);
//发布
window.DialogResult = true;
WeakReferenceMessenger.Default.Send(colorMessage);
}
}
}
}