整理代码

This commit is contained in:
ShrlAlgo
2025-10-10 11:19:58 +08:00
parent 4722a4c881
commit 9d40762f03
111 changed files with 3238 additions and 3112 deletions

View File

@@ -1,20 +1,21 @@
<ui:NeoWindow
Height="600"
MinHeight="600"
MinWidth="1050"
ResizeMode="CanResizeWithGrip"
Title="本地族库"
Width="1050"
d:DataContext="{d:DesignInstance Type=local:FamilyLibraryViewModel}"
mc:Ignorable="d"
x:Class="ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary.FamilyLibraryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/NeoUI"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Title="本地族库"
Width="1050"
Height="600"
MinWidth="1050"
MinHeight="600"
d:DataContext="{d:DesignInstance Type=local:FamilyLibraryViewModel}"
Icon="{DynamicResource RevitIcon}"
ResizeMode="CanResizeWithGrip"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -36,23 +37,22 @@
<ColumnDefinition Width="220" />
</Grid.ColumnDefinitions>
<Button
Grid.Row="0"
Margin="5"
HorizontalAlignment="Stretch"
Command="{Binding SelectPathCommand}"
Content="打开族目录"
FontFamily="{StaticResource BoxIcons}"
Grid.Row="0"
HorizontalAlignment="Stretch"
Margin="5"
ToolTip="{Binding FamilyPath, Mode=OneWay, StringFormat=族目录:{}{0}}" >
ToolTip="{Binding FamilyPath, Mode=OneWay, StringFormat=族目录:{}{0}}">
<ui:ButtonAssist.Icon>
<ui:IconElement Glyph="&#xEADF;"
FontFamily="{StaticResource BoxIcons}"/>
<ui:IconElement FontFamily="{StaticResource BoxIcons}" Glyph="&#xEADF;" />
</ui:ButtonAssist.Icon>
</Button>
<TreeView
x:Name="FolderTreeView"
Grid.Row="1"
ItemsSource="{Binding FolderTreeViewItems}"
d:ItemsSource="{d:SampleData}"
x:Name="FolderTreeView">
ItemsSource="{Binding FolderTreeViewItems}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectedItemChanged">
<i:InvokeCommandAction Command="{Binding SelectDirTreeNodeCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type TreeView}, Mode=FindAncestor}}" />
@@ -61,18 +61,18 @@
</i:Interaction.Triggers>
</TreeView>
<GridSplitter
Grid.Column="1"
Grid.Row="1"
Grid.Column="1"
Width="1"
HorizontalAlignment="Center"
ShowsPreview="True"
Width="1" />
ShowsPreview="True" />
<TextBox
Cursor="IBeam"
Grid.Column="2"
x:Name="SearchBox"
Grid.Row="0"
Grid.Column="2"
Margin="5"
ui:InputAssist.Placeholder="请输入搜索关键词"
x:Name="SearchBox">
Cursor="IBeam">
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding SearchFamilyCommand}" CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType={x:Type TextBox}, Mode=FindAncestor}}" />
@@ -80,12 +80,12 @@
</i:Interaction.Triggers>
</TextBox>
<ListView
Grid.Column="2"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="2"
d:ItemsSource="{d:SampleData}"
ItemsSource="{Binding FamilyPageListViewItems}"
SelectedItem="{Binding SelectedFamily}"
d:ItemsSource="{d:SampleData}">
SelectedItem="{Binding SelectedFamily}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding LvSelectionChangedCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type ListView}, Mode=FindAncestor}}" />
@@ -131,12 +131,12 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border
x:Name="border"
Margin="5"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="2"
CornerRadius="5"
Margin="5"
x:Name="border">
CornerRadius="5">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
@@ -145,10 +145,10 @@
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" TargetName="border" Value="Gray" />
<Setter TargetName="border" Property="BorderBrush" Value="Gray" />
</MultiTrigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="LightSkyBlue" />
<Setter TargetName="border" Property="BorderBrush" Value="LightSkyBlue" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -164,23 +164,23 @@
<ListView.ItemTemplate>
<DataTemplate>
<ui:Card Padding="0">
<Grid Height="210" Width="170">
<Grid Width="170" Height="210">
<Grid.RowDefinitions>
<RowDefinition Height="170" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image
Grid.Row="0"
Width="128"
Height="128"
Source="{Binding ImageData}"
Stretch="Uniform"
ToolTip="{Binding ToolTip}"
Width="128" />
ToolTip="{Binding ToolTip}" />
<StackPanel
Grid.Row="0"
HorizontalAlignment="Center"
Orientation="Horizontal"
VerticalAlignment="Bottom">
VerticalAlignment="Bottom"
Orientation="Horizontal">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="Visibility" Value="Collapsed" />
@@ -212,10 +212,10 @@
</StackPanel>
<TextBlock
Grid.Row="1"
Width="128"
Text="{Binding Title}"
TextAlignment="Center"
TextWrapping="WrapWithOverflow"
Width="128" />
TextWrapping="WrapWithOverflow" />
</Grid>
</ui:Card>
</DataTemplate>
@@ -223,9 +223,9 @@
<ListView.Template>
<ControlTemplate TargetType="{x:Type ListView}">
<ScrollViewer
x:Name="scr"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
x:Name="scr">
VerticalScrollBarVisibility="Auto">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ScrollChanged">
<i:InvokeCommandAction Command="{Binding LvScrollCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollViewer}, Mode=FindAncestor}}" />
@@ -237,20 +237,20 @@
</ListView.Template>
</ListView>
<GridSplitter
Grid.Column="3"
Grid.Row="1"
Grid.Column="3"
Width="1"
HorizontalAlignment="Center"
ShowsPreview="True"
Width="1" />
ShowsPreview="True" />
<DataGrid
Grid.Row="1"
Grid.Column="4"
Margin="5"
d:ItemsSource="{d:SampleData}"
AutoGenerateColumns="False"
CanUserAddRows="False"
Grid.Column="4"
Grid.Row="1"
IsReadOnly="True"
ItemsSource="{Binding SelectedItem.Parameters, ElementName=CbbSymbols, Mode=TwoWay}"
Margin="5"
d:ItemsSource="{d:SampleData}">
ItemsSource="{Binding SelectedItem.Parameters, ElementName=CbbSymbols, Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="属性名" />
<DataGridTextColumn Binding="{Binding Value}" Header="属性值" />
@@ -280,39 +280,39 @@
</hc:ButtonGroup>
</StackPanel>-->
<ui:StackPanel
Grid.Column="4"
Grid.Row="0"
Grid.Column="4"
Orientation="Horizontal">
<ComboBox
x:Name="CbbSymbols"
ui:SelectorAssist.Placeholder="选择族类型"
ui:StackPanel.Fill="Fill"
DisplayMemberPath="Name"
ItemsSource="{Binding SymbolTypes, Mode=TwoWay}"
ui:InputAssist.Placeholder="选择族类型"
SelectedItem="{Binding SelectedSymbolType, UpdateSourceTrigger=PropertyChanged}"
ui:StackPanel.Fill="Fill"
x:Name="CbbSymbols" />
SelectedItem="{Binding SelectedSymbolType, UpdateSourceTrigger=PropertyChanged}" />
<Button
Grid.Column="1"
Margin="5"
ui:StackPanel.Fill="Auto"
Command="{Binding ImportFamilySymbolCommand}"
Content="&#xEB1F;"
FontFamily="{StaticResource BoxIcons}"
Grid.Column="1"
Margin="5"
ToolTip="载入类型"
ui:StackPanel.Fill="Auto" />
ToolTip="载入类型" />
</ui:StackPanel>
<TextBlock
Grid.Column="0"
Grid.Row="2"
Grid.Column="0"
Margin="5"
Text="{Binding FamilyCount, Mode=OneWay, StringFormat=共计{}{0}个}" />
<ui:Alert
Grid.Column="2"
Grid.Row="2"
Grid.Column="2"
Message="{Binding Message}" />
<!--IsOpen="{Binding ActiveSnackbar}"-->
<!-- IsOpen="{Binding ActiveSnackbar}" -->
<TextBlock
Grid.Column="4"
Grid.Row="2"
Grid.Column="4"
Text="{Binding RevitVersion, Mode=OneWay, StringFormat=当前文件版本Revit \{0\}}" />
</Grid>
</ui:NeoWindow>