From 0d0afbc78ec122e1b1b21a21f0829fdd77934de5 Mon Sep 17 00:00:00 2001 From: ShrlAlgo <903524121@qq.com> Date: Fri, 12 Sep 2025 09:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/copilot.data.migration.agent.xml | 6 + .../.idea/copilot.data.migration.edit.xml | 6 + NeoUI/NeoUI/Assists/WindowAssist.cs | 31 -- NeoUI/NeoUI/Controls/AdornerPopup.cs | 94 ---- NeoUI/NeoUI/Controls/ButtonsStyle.xaml | 10 +- NeoUI/NeoUI/Controls/CalendarStyle.xaml | 2 +- NeoUI/NeoUI/Controls/CheckableTag.xaml | 2 +- NeoUI/NeoUI/Controls/ComboBoxStyle.xaml | 4 +- NeoUI/NeoUI/Controls/ContentAdorner.cs | 56 -- NeoUI/NeoUI/Controls/FlattenTextBox.xaml | 10 +- NeoUI/NeoUI/Controls/ListBoxStyle.xaml | 134 ++++- NeoUI/NeoUI/Controls/ListViewStyle.xaml | 2 +- NeoUI/NeoUI/Controls/MenuStyle.xaml | 3 +- NeoUI/NeoUI/Controls/PaginationControl.xaml | 2 +- NeoUI/NeoUI/Controls/Pill.xaml | 4 +- NeoUI/NeoUI/Controls/ScrollViewerStyle.xaml | 18 +- NeoUI/NeoUI/Controls/TabViewStyle.xaml | 2 +- NeoUI/NeoUI/Controls/ToggleButtonStyle.xaml | 15 +- NeoUI/NeoUI/Controls/TreeViewStyle.xaml | 8 +- NeoUI/NeoUI/Controls/WindowStyle.xaml | 27 +- NeoUI/NeoUI/Controls/WindowStyle.xaml.cs | 266 ++++----- NeoUI/NeoUI/Themes/Dark.xaml | 4 +- NeoUI/NeoUI/Themes/Light.xaml | 4 +- NeoUI/NeoUITest/MainWindow.xaml | 55 +- Sample/MainWindow.xaml | 1 + Sample/MainWindow.xaml.cs | 14 + .../Converters/Rv2WinColorConverter.cs | 36 +- .../Converters/SearchTypeValueConverter.cs | 2 + .../ModelManager/SeparateModelWin.xaml | 2 +- .../RvCivil/FloorFinishesView.xaml | 1 - .../RvCivil/SplitComsByLevelCmd.cs | 507 +++++++++--------- .../RvFamily/RenameFamilyView.xaml | 41 +- .../RvFamily/RenameTypeView.xaml | 18 +- .../NetworkCreator/NetworkCreatorView.xaml | 2 +- .../RvMEP/AnyConnectView.xaml | 2 +- .../RvMEP/FlipWorkplaneCmd.cs | 44 +- .../RvMEP/HeadroomCheckView.xaml | 5 +- .../RvMEP/RotateMEPView.xaml | 2 +- .../RvView/SystemDisplayView.xaml | 1 - 39 files changed, 706 insertions(+), 737 deletions(-) create mode 100644 .idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml create mode 100644 .idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml delete mode 100644 NeoUI/NeoUI/Controls/AdornerPopup.cs delete mode 100644 NeoUI/NeoUI/Controls/ContentAdorner.cs diff --git a/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml new file mode 100644 index 0000000..4ea72a9 --- /dev/null +++ b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml new file mode 100644 index 0000000..8648f94 --- /dev/null +++ b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/NeoUI/NeoUI/Assists/WindowAssist.cs b/NeoUI/NeoUI/Assists/WindowAssist.cs index a22b34b..cb0be8f 100644 --- a/NeoUI/NeoUI/Assists/WindowAssist.cs +++ b/NeoUI/NeoUI/Assists/WindowAssist.cs @@ -30,35 +30,4 @@ public class WindowAssist /// public static readonly DependencyProperty TitleBarBackgroundProperty = DependencyProperty.RegisterAttached("TitleBarBackground", typeof(Brush), typeof(WindowAssist)); - - /// - /// 附加属性,用于手动控制控件的视觉状态。 - /// XAML中的Triggers将绑定到此属性,而不是IsMouseOver或IsPressed。 - /// - public static readonly DependencyProperty WindowButtonStateProperty = - DependencyProperty.RegisterAttached( - "WindowButtonState", // 属性名 - typeof(WindowButtonState), // 属性类型 (我们定义的枚举) - typeof(WindowAssist), // 拥有者类 - new PropertyMetadata(WindowButtonState.Normal)); // 默认值 - - public static WindowButtonState GetWindowButtonState(DependencyObject obj) - { - return (WindowButtonState)obj.GetValue(WindowButtonStateProperty); - } - - public static void SetWindowButtonState(DependencyObject obj, WindowButtonState value) - { - obj.SetValue(WindowButtonStateProperty, value); - } - -} -/// 定义自定义窗口按钮的视觉状态。 -/// -public enum WindowButtonState -{ - Normal, - MouseOver, - Pressed, - Disabled } \ No newline at end of file diff --git a/NeoUI/NeoUI/Controls/AdornerPopup.cs b/NeoUI/NeoUI/Controls/AdornerPopup.cs deleted file mode 100644 index 86be945..0000000 --- a/NeoUI/NeoUI/Controls/AdornerPopup.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; - -namespace NeoUI.Controls -{ - /// - /// 一个使用AdornerLayer实现、可作为原生Popup直接替代品的控件。 - /// 它能被窗口和ScrollViewer正确裁剪。 - /// - public class AdornerPopup : ContentControl - { - private Adorner? _adorner; - - // 【修正】将 _childCache 的类型从 UIElement? 更改为 FrameworkElement? - private FrameworkElement? _childCache; - - #region Dependency Properties (模仿原生Popup) - - public static readonly DependencyProperty IsOpenProperty = - DependencyProperty.Register("IsOpen", typeof(bool), typeof(AdornerPopup), - new PropertyMetadata(false, OnIsOpenChanged)); - - public bool IsOpen - { - get => (bool)GetValue(IsOpenProperty); - set => SetValue(IsOpenProperty, value); - } - - public static readonly DependencyProperty PlacementTargetProperty = - DependencyProperty.Register("PlacementTarget", typeof(UIElement), typeof(AdornerPopup), - new PropertyMetadata(null)); - - public UIElement PlacementTarget - { - get => (UIElement)GetValue(PlacementTargetProperty); - set => SetValue(PlacementTargetProperty, value); - } - - #endregion - - private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d is AdornerPopup popup) - { - popup.UpdateAdorner(); - } - } - - private void UpdateAdorner() - { - var target = PlacementTarget ?? this; - var adornerLayer = AdornerLayer.GetAdornerLayer(target); - if (adornerLayer == null) return; - - if (IsOpen) - { - if (_adorner != null) return; - - // 【修正】将 Content 转换为 FrameworkElement - _childCache = Content as FrameworkElement; - if (_childCache == null) return; - - Content = null; - - // 关键:将自身的DataContext传递给弹出的内容,以修复MVVM绑定 - // 因为 _childCache 现在是 FrameworkElement 类型,所以可以访问 DataContext - _childCache.DataContext = DataContext; - - _adorner = new ContentAdorner(target, _childCache); - adornerLayer.Add(_adorner); - } - else - { - if (_adorner == null) return; - - adornerLayer.Remove(_adorner); - - if (_childCache != null) - { - // 清理 DataContext - _childCache.DataContext = null; - // 恢复内容 - Content = _childCache; - _childCache = null; - } - - _adorner = null; - } - } - } -} diff --git a/NeoUI/NeoUI/Controls/ButtonsStyle.xaml b/NeoUI/NeoUI/Controls/ButtonsStyle.xaml index 4f19768..01389e7 100644 --- a/NeoUI/NeoUI/Controls/ButtonsStyle.xaml +++ b/NeoUI/NeoUI/Controls/ButtonsStyle.xaml @@ -327,7 +327,7 @@ - + @@ -347,7 +347,7 @@ - + @@ -365,7 +365,7 @@ - + @@ -383,7 +383,7 @@ - + @@ -401,7 +401,7 @@ - + diff --git a/NeoUI/NeoUI/Controls/CalendarStyle.xaml b/NeoUI/NeoUI/Controls/CalendarStyle.xaml index 7e1a61f..f1d4c19 100644 --- a/NeoUI/NeoUI/Controls/CalendarStyle.xaml +++ b/NeoUI/NeoUI/Controls/CalendarStyle.xaml @@ -43,7 +43,7 @@ - + diff --git a/NeoUI/NeoUI/Controls/CheckableTag.xaml b/NeoUI/NeoUI/Controls/CheckableTag.xaml index fb001cc..b412d60 100644 --- a/NeoUI/NeoUI/Controls/CheckableTag.xaml +++ b/NeoUI/NeoUI/Controls/CheckableTag.xaml @@ -72,7 +72,7 @@ - + diff --git a/NeoUI/NeoUI/Controls/ComboBoxStyle.xaml b/NeoUI/NeoUI/Controls/ComboBoxStyle.xaml index 55ead87..1af06ce 100644 --- a/NeoUI/NeoUI/Controls/ComboBoxStyle.xaml +++ b/NeoUI/NeoUI/Controls/ComboBoxStyle.xaml @@ -226,7 +226,6 @@ - + + + diff --git a/NeoUI/NeoUI/Controls/ContentAdorner.cs b/NeoUI/NeoUI/Controls/ContentAdorner.cs deleted file mode 100644 index 6e69038..0000000 --- a/NeoUI/NeoUI/Controls/ContentAdorner.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Media; - -namespace NeoUI.Controls -{ - public class ContentAdorner : Adorner - { - private readonly Grid _container; - private readonly ContentPresenter _contentPresenter; - private double _offsetY; - - public ContentAdorner(UIElement adornedElement, UIElement content) : base(adornedElement) - { - _container = new Grid { Background = Brushes.Transparent }; - _contentPresenter = new ContentPresenter { Content = content }; - _container.Children.Add(_contentPresenter); - AddLogicalChild(_container); - AddVisualChild(_container); - } - - protected override int VisualChildrenCount => 1; - protected override Visual GetVisualChild(int index) => _container; - - public override GeneralTransform GetDesiredTransform(GeneralTransform transform) - { - var result = new GeneralTransformGroup(); - result.Children.Add(base.GetDesiredTransform(transform)); - result.Children.Add(new TranslateTransform(0, _offsetY)); - return result; - } - - protected override Size MeasureOverride(Size constraint) - { - _container.Measure(constraint); - return _container.DesiredSize; - } - - protected override Size ArrangeOverride(Size finalSize) - { - var finalRect = new Rect(new Point(0, 0), finalSize); - if (_contentPresenter.Content is FrameworkElement contentElement) - { - _offsetY = AdornedElement.RenderSize.Height + contentElement.Margin.Top; - } - else - { - _offsetY = AdornedElement.RenderSize.Height; - } - _container.Arrange(finalRect); - return finalSize; - } - } -} diff --git a/NeoUI/NeoUI/Controls/FlattenTextBox.xaml b/NeoUI/NeoUI/Controls/FlattenTextBox.xaml index c4bb3b9..d68e22c 100644 --- a/NeoUI/NeoUI/Controls/FlattenTextBox.xaml +++ b/NeoUI/NeoUI/Controls/FlattenTextBox.xaml @@ -15,7 +15,7 @@ - + @@ -29,23 +29,23 @@ SnapsToDevicePixels="True" x:Name="border"> - + - + - + diff --git a/NeoUI/NeoUI/Controls/ListBoxStyle.xaml b/NeoUI/NeoUI/Controls/ListBoxStyle.xaml index d7afb5c..e3bdb3e 100644 --- a/NeoUI/NeoUI/Controls/ListBoxStyle.xaml +++ b/NeoUI/NeoUI/Controls/ListBoxStyle.xaml @@ -2,6 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:assists="clr-namespace:NeoUI.Assists" + xmlns:controls="clr-namespace:NeoUI.Controls" xmlns:converters="clr-namespace:NeoUI.Converters" xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations" xmlns:internal="clr-namespace:NeoUI.Converters.Internal"> @@ -34,8 +35,8 @@ Padding="-4" CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" Intensity="0.2" - Visibility="Collapsed" - ShaderEnabled="False"/> + ShaderEnabled="False" + Visibility="Collapsed" /> - + @@ -101,7 +102,7 @@ - + @@ -172,7 +173,7 @@ - + @@ -250,7 +251,8 @@ - + + @@ -259,7 +261,7 @@ - + @@ -269,9 +271,12 @@ + + + - + + + - - - @@ -125,8 +100,8 @@ + EditingElementStyle="{StaticResource DataGridCheckBox}" + ElementStyle="{StaticResource DataGridCheckBox}"> - @@ -112,8 +114,8 @@ + EditingElementStyle="{StaticResource DataGridCheckBox}" + ElementStyle="{StaticResource DataGridCheckBox}"> @@ -177,7 +179,7 @@ IsEnabled="{Binding CanInput}" Margin="5" ui:InputAssist.Placeholder="前缀"> - + @@ -187,7 +189,7 @@ IsEnabled="{Binding CanInput}" Margin="5" ui:InputAssist.Placeholder="后缀"> - + diff --git a/ShrlAlgoToolkit.RevitAddins/RvIndependent/NetworkCreator/NetworkCreatorView.xaml b/ShrlAlgoToolkit.RevitAddins/RvIndependent/NetworkCreator/NetworkCreatorView.xaml index eeb3a7a..04bd8a9 100644 --- a/ShrlAlgoToolkit.RevitAddins/RvIndependent/NetworkCreator/NetworkCreatorView.xaml +++ b/ShrlAlgoToolkit.RevitAddins/RvIndependent/NetworkCreator/NetworkCreatorView.xaml @@ -1,5 +1,5 @@  + ui:ButtonAssist.Icon="{ui:Icon SymbolValue=PlugConnect}" /> diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs index 9187a73..3b6f98d 100644 --- a/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs +++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs @@ -1,5 +1,6 @@ using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; + using Nice3point.Revit.Toolkit.External; @@ -11,27 +12,34 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP { public override void Execute() { - ICollection familyInstances; - if (UiDocument.Selection.GetElementIds().Count > 0) + try + { + ICollection familyInstances; + if (UiDocument.Selection.GetElementIds().Count > 0) + { + familyInstances = UiDocument.Selection.GetElementIds().Select(Document.GetElement).OfType().ToList(); + + } + else + { + familyInstances = UiDocument.SelectObjects("请选择族实例"); + } + Document.Invoke( + ts => + { + foreach (var ins in familyInstances) + { + if (ins.CanFlipWorkPlane) + { + ins.IsWorkPlaneFlipped = !ins.IsWorkPlaneFlipped; + } + } + }); + } + catch (Exception ex) { - familyInstances = UiDocument.Selection.GetElementIds().Select(Document.GetElement).OfType().ToList(); } - else - { - familyInstances = UiDocument.SelectObjects("请选择族实例"); - } - Document.Invoke( - ts => - { - foreach (var ins in familyInstances) - { - if (ins.CanFlipWorkPlane) - { - ins.IsWorkPlaneFlipped = !ins.IsWorkPlaneFlipped; - } - } - }); } } } \ No newline at end of file diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckView.xaml b/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckView.xaml index 2eed789..dc58569 100644 --- a/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckView.xaml +++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckView.xaml @@ -7,6 +7,7 @@ x:Class="ShrlAlgoToolkit.RevitAddins.RvMEP.HeadroomCheckView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" + xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -36,7 +37,7 @@ - + diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPView.xaml b/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPView.xaml index 4b6d013..3833f4b 100644 --- a/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPView.xaml +++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPView.xaml @@ -81,7 +81,7 @@ - + -