清理ColorPicker,进度条。修复UI问题
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -15,7 +13,7 @@ public class SystemDisplayCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
var view = new DrawSheet.SystemDisplayView()
|
||||
var view = new SystemDisplayView()
|
||||
{
|
||||
DataContext = new SystemDisplayViewModel(UiApplication)
|
||||
};
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mep="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
|
||||
xmlns:rvMep="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
|
||||
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
|
||||
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
|
||||
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
|
||||
Title="系统设置"
|
||||
Width="550"
|
||||
Height="450"
|
||||
@@ -75,19 +75,26 @@
|
||||
</DataGridTemplateColumn.CellStyle>-->
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border>
|
||||
<!--<Border>
|
||||
<Button
|
||||
Command="{Binding DataContext.OpenColorPickerCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="编辑" />
|
||||
</Border>
|
||||
|
||||
</Border>-->
|
||||
<ui:ColorPicker SelectedColor="{Binding FillColor, Converter={x:Static converters:Rv2WinColorConverter.Instance}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="保存" />
|
||||
<!--<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
-->
|
||||
<!--<colorpicker:StandardColorPicker x:Name="main" Style="{StaticResource DefaultColorPickerStyle}" />
|
||||
|
||||
@@ -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