清理ColorPicker,进度条。修复UI问题
This commit is contained in:
@@ -8,9 +8,9 @@ using ShrlAlgoToolkit.RevitAddins.Common.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
|
||||
public partial class SystemDisplayViewModel : ObservableRecipient, IRecipient<Color>
|
||||
public partial class SystemDisplayViewModel : ObservableRecipient/*, IRecipient<Color>*/
|
||||
{
|
||||
private SystemModel currentModel;
|
||||
//private SystemModel currentModel;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial List<SystemModel> SystemsCollection { get; set; }
|
||||
@@ -20,8 +20,8 @@ public partial class SystemDisplayViewModel : ObservableRecipient, IRecipient<Co
|
||||
var doc = uiapp.ActiveUIDocument.Document;
|
||||
var enumerable = doc.OfClass<MEPSystemType>().Cast<MEPSystemType>();
|
||||
var systemModels = from mepSystemType in enumerable let model = new SystemModel(mepSystemType) select model;
|
||||
SystemsCollection = new List<SystemModel>(systemModels);
|
||||
IsActive = true;
|
||||
SystemsCollection = [.. systemModels];
|
||||
//IsActive = true;
|
||||
//订阅
|
||||
//WeakReferenceMessenger.Default.RegisterAll(this);
|
||||
//WeakReferenceMessenger.Default.Register<SelectedColor>(this);
|
||||
@@ -36,37 +36,40 @@ public partial class SystemDisplayViewModel : ObservableRecipient, IRecipient<Co
|
||||
//});
|
||||
}
|
||||
|
||||
public void Receive(Color message)
|
||||
{
|
||||
//TaskDialog.Show("消息", "收到颜色消息");
|
||||
if (message != null)
|
||||
{
|
||||
currentModel.FillColor = message;
|
||||
currentModel.BackgroundColor = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(message.Red, message.Green, message.Blue)
|
||||
);
|
||||
}
|
||||
//public void Receive(Color message)
|
||||
//{
|
||||
// //TaskDialog.Show("消息", "收到颜色消息");
|
||||
// if (message != null)
|
||||
// {
|
||||
// currentModel.FillColor = message;
|
||||
// currentModel.BackgroundColor = new System.Windows.Media.SolidColorBrush(
|
||||
// System.Windows.Media.Color.FromRgb(message.Red, message.Green, message.Blue)
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
//currentModel.BackgroundColor = System.Windows.Media.SelectedColor.FromRgb(message.Red, message.Green, message.Blue);
|
||||
}
|
||||
//[RelayCommand]
|
||||
//private void OpenColorPicker(object obj)
|
||||
//{
|
||||
// if (obj is SystemModel model)
|
||||
// {
|
||||
// currentModel = model;
|
||||
// var viewModel = model.FillColor.IsValid
|
||||
// ? new ColorPickerViewModel(
|
||||
// System.Windows.Media.Color.FromRgb(model.FillColor.Red, model.FillColor.Green, model.FillColor.Blue)
|
||||
// )
|
||||
// : new ColorPickerViewModel(System.Windows.Media.Color.FromRgb(0, 0, 0));
|
||||
// var win = new ColorPickerWin(viewModel);
|
||||
// win.ShowDialog();
|
||||
// //WeakReferenceMessenger.Default.Register<SelectedColor>(this, (r, m) =>
|
||||
// //{
|
||||
// // color = m;
|
||||
// //});
|
||||
// }
|
||||
//}
|
||||
[RelayCommand]
|
||||
private void Save()
|
||||
{
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenColorPicker(object obj)
|
||||
{
|
||||
if (obj is SystemModel model)
|
||||
{
|
||||
currentModel = model;
|
||||
var viewModel = model.FillColor.IsValid
|
||||
? new ColorPickerViewModel(
|
||||
System.Windows.Media.Color.FromRgb(model.FillColor.Red, model.FillColor.Green, model.FillColor.Blue)
|
||||
)
|
||||
: new ColorPickerViewModel(System.Windows.Media.Color.FromRgb(0, 0, 0));
|
||||
var win = new ColorPickerWin(viewModel);
|
||||
win.ShowDialog();
|
||||
//WeakReferenceMessenger.Default.Register<SelectedColor>(this, (r, m) =>
|
||||
//{
|
||||
// color = m;
|
||||
//});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user