修复窗口大小问题
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Szmedi.RevitToolkit.Approval.Controls"
|
||||
xmlns:converters="clr-namespace:Szmedi.RevitToolkit.Approval.Converters"
|
||||
@@ -34,7 +35,7 @@
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:IntToBooleanConverter x:Key="IntToBooleanConverter" />
|
||||
<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Fonts/#Source Han Sans SC</FontFamily>
|
||||
<!--<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Fonts/#Source Han Sans SC</FontFamily>-->
|
||||
<Style x:Key="ExpanderStyle" TargetType="Expander">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
@@ -51,9 +52,14 @@
|
||||
Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"
|
||||
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource MaterialDesignHorizontalHeaderStyle}" />
|
||||
<Rectangle Height="1" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Fill="{StaticResource SZMCBrush}"/>
|
||||
<Border Margin="10"
|
||||
<Rectangle
|
||||
Height="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
DockPanel.Dock="Top"
|
||||
Fill="{StaticResource SZMCBrush}" />
|
||||
<Border
|
||||
Name="ContentSite"
|
||||
Margin="10"
|
||||
Visibility="Collapsed">
|
||||
<ContentPresenter />
|
||||
</Border>
|
||||
@@ -71,7 +77,8 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander Header="{Binding Name}"
|
||||
<Expander
|
||||
Header="{Binding Name}"
|
||||
IsExpanded="False"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<ItemsPresenter />
|
||||
@@ -91,10 +98,11 @@
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<!-- BasedOn="{StaticResource MaterialWindowStyle}" -->
|
||||
<Style x:Key="SZMEDIWindowStyle"
|
||||
<Style
|
||||
x:Key="SZMEDIWindowStyle"
|
||||
BasedOn="{StaticResource MaterialWindowStyle}"
|
||||
TargetType="{x:Type controls:MaterialWindow}">
|
||||
<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />
|
||||
<!--<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />-->
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Icon" Value="{StaticResource Logo}" />
|
||||
</Style>
|
||||
|
||||
@@ -86,9 +86,6 @@
|
||||
<TreatAsUsed>True</TreatAsUsed>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Fonts\SourceHanSansSC-Regular.otf" />
|
||||
</ItemGroup>
|
||||
<!-- <ItemGroup>
|
||||
<ProjectReference Include="..\AduSkin\AduSkin.csproj" />
|
||||
</ItemGroup>-->
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
Title="铺贴"
|
||||
Width="300"
|
||||
Height="370"
|
||||
MinWidth="300"
|
||||
MinHeight="320"
|
||||
d:DataContext="{d:DesignInstance rvCivil:BricksFinishesViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -10,10 +10,7 @@
|
||||
Title="房间饰面"
|
||||
Width="250"
|
||||
Height="500"
|
||||
MinWidth="250"
|
||||
MinHeight="400"
|
||||
d:DataContext="{d:DesignInstance Type=rvCivil:FloorFinishesViewModel}"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Szmedi.RvKits;component/WPFUI.xaml" />
|
||||
@@ -26,12 +23,18 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Header="范围">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<RadioButton Content="所有房间" IsChecked="{Binding RbAllRooms}" />
|
||||
<RadioButton Content="选中房间" IsChecked="{Binding RbAllRooms, Converter={x:Static md:InvertBooleanConverter.Instance}}" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Row="1" VerticalAlignment="Stretch" Header="楼板类型">
|
||||
<GroupBox
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Stretch"
|
||||
Header="楼板类型">
|
||||
<ListBox
|
||||
x:Name="LbFloorType"
|
||||
VerticalAlignment="Stretch"
|
||||
@@ -64,6 +67,9 @@
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>-->
|
||||
<Button Grid.Row="3" Command="{Binding PlaceFloorCommand}" Content="布置" />
|
||||
<Button
|
||||
Grid.Row="3"
|
||||
Command="{Binding PlaceFloorCommand}"
|
||||
Content="布置" />
|
||||
</Grid>
|
||||
</controls:MaterialWindow>
|
||||
@@ -1,19 +1,19 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Szmedi.RvKits.Controls"
|
||||
xmlns:converters="clr-namespace:Szmedi.RvKits.Converters"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes">
|
||||
<!--<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>-->
|
||||
<converters:NotNullToVisibilityConverter NullValue="Collapsed" x:Key="NotNullToVisibilityConverter" />
|
||||
<converters:NotNullToVisibilityConverter x:Key="NotNullToVisibilityConverter" NullValue="Collapsed" />
|
||||
<converters:WindowTitleBarIconVisibilityConverter x:Key="WindowTitleBarIconVisibilityConverter" />
|
||||
<converters:WindowTitleVisibilityConverter x:Key="WindowTitleVisibilityConverter" />
|
||||
<converters:WindowCaptionButtonVisibilityConverter x:Key="WindowCaptionButtonVisibilityConverter" />
|
||||
<converters:WindowCaptionButtonEnabledConverter x:Key="WindowCaptionButtonEnabledConverter" />
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="WindowButtonStyle">
|
||||
<Style x:Key="WindowButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Padding" Value="8,0,8,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
@@ -25,9 +25,9 @@
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Foreground}">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
@@ -42,15 +42,15 @@
|
||||
</Border.Style>
|
||||
</Border>
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</AdornerDecorator>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -68,9 +68,9 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowMinimizeButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowMinimizeButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
@@ -92,9 +92,9 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowMaximizeRestoreButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowMaximizeRestoreButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
@@ -122,9 +122,9 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowCloseButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowCloseButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Setter Property="IsEnabled" Value="True" />
|
||||
<Style.Triggers>
|
||||
@@ -135,20 +135,20 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type md:PackIcon}" x:Key="WindowButtonIconStyle">
|
||||
<Style x:Key="WindowButtonIconStyle" TargetType="{x:Type md:PackIcon}">
|
||||
<Setter Property="Width" Value="24" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBlock}" x:Key="WindowTitleTextBlockStyle">
|
||||
<Style x:Key="WindowTitleTextBlockStyle" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Foreground" Value="{Binding Path=BorderForegroundBrush, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type ResizeGrip}" x:Key="ResizeGripStyle">
|
||||
<Style x:Key="ResizeGripStyle" TargetType="{x:Type ResizeGrip}">
|
||||
<Setter Property="Height" Value="18" />
|
||||
<Setter Property="Width" Value="18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
@@ -160,10 +160,10 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ResizeGrip}">
|
||||
<Grid
|
||||
Background="{TemplateBinding Background}"
|
||||
Width="18"
|
||||
Height="18"
|
||||
SnapsToDevicePixels="True"
|
||||
Width="18">
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Rectangle">
|
||||
<Setter Property="Height" Value="2" />
|
||||
@@ -195,7 +195,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:MaterialWindow}" x:Key="MaterialWindowStyle">
|
||||
<Style x:Key="MaterialWindowStyle" TargetType="{x:Type controls:MaterialWindow}">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
|
||||
<!--<Setter Property="TitleBarIcon" Value="{Binding icon}" />-->
|
||||
@@ -219,10 +219,10 @@
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="OpacityInStoryboard">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
From="0.75"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1">
|
||||
From="0.75"
|
||||
To="1"
|
||||
Duration="0:0:0.2">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<SineEase EasingMode="EaseOut" />
|
||||
</DoubleAnimation.EasingFunction>
|
||||
@@ -230,10 +230,10 @@
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="OpacityOutStoryboard">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
From="1"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.75">
|
||||
From="1"
|
||||
To="0.75"
|
||||
Duration="0:0:0.2">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<SineEase EasingMode="EaseOut" />
|
||||
</DoubleAnimation.EasingFunction>
|
||||
@@ -254,13 +254,13 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding BorderBackgroundBrush}"
|
||||
BorderBrush="{TemplateBinding BorderBackgroundBrush}"
|
||||
ClipToBounds="True"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
ClipToBounds="True">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Style.Triggers>
|
||||
@@ -286,12 +286,12 @@
|
||||
|
||||
<!-- window icon -->
|
||||
<Image
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="8,0,8,0"
|
||||
Panel.ZIndex="2048"
|
||||
Source="{TemplateBinding Icon}"
|
||||
VerticalAlignment="Center"
|
||||
Width="24">
|
||||
Panel.ZIndex="2048"
|
||||
Source="{TemplateBinding Icon}">
|
||||
<Image.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleBarIconVisibilityConverter}">
|
||||
<Binding Path="Icon" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
@@ -302,12 +302,12 @@
|
||||
|
||||
<!-- window title -->
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
Panel.ZIndex="2048"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2048">
|
||||
<Border.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||||
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
@@ -332,28 +332,28 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentControl
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" />
|
||||
VerticalAlignment="Stretch"
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}" />
|
||||
</Border>
|
||||
|
||||
<!-- caption buttons -->
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Height="32"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2048"
|
||||
VerticalAlignment="Stretch">
|
||||
Orientation="Horizontal">
|
||||
<StackPanel.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||||
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</MultiBinding>
|
||||
</StackPanel.Visibility>
|
||||
<Button
|
||||
x:Name="minimizeButton"
|
||||
Style="{StaticResource WindowMinimizeButtonStyle}"
|
||||
ToolTip="最小化"
|
||||
x:Name="minimizeButton">
|
||||
ToolTip="最小化">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -375,7 +375,7 @@
|
||||
</Button.IsEnabled>
|
||||
<md:PackIcon Kind="WindowMinimize" Style="{StaticResource WindowButtonIconStyle}" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource WindowMaximizeRestoreButtonStyle}" x:Name="maximizeRestoreButton">
|
||||
<Button x:Name="maximizeRestoreButton" Style="{StaticResource WindowMaximizeRestoreButtonStyle}">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -411,9 +411,9 @@
|
||||
</md:PackIcon>
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="closeButton"
|
||||
Style="{StaticResource WindowCloseButtonStyle}"
|
||||
ToolTip="关闭"
|
||||
x:Name="closeButton">
|
||||
ToolTip="关闭">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -439,13 +439,13 @@
|
||||
|
||||
<!-- window content -->
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2047"
|
||||
VerticalAlignment="Stretch">
|
||||
Background="{TemplateBinding Background}">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}">
|
||||
<ContentPresenter.Style>
|
||||
@@ -472,11 +472,11 @@
|
||||
|
||||
<!-- resize grip -->
|
||||
<ResizeGrip
|
||||
Grid.Column="2"
|
||||
x:Name="resizeGrip"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Panel.ZIndex="2048"
|
||||
Style="{StaticResource ResizeGripStyle}"
|
||||
x:Name="resizeGrip" />
|
||||
Style="{StaticResource ResizeGripStyle}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
Title="预览"
|
||||
Width="700"
|
||||
Height="500"
|
||||
MinWidth="700"
|
||||
MinHeight="500"
|
||||
Background="{DynamicResource MaterialDesign.Brush.Background}"
|
||||
Closed="Window_Closed"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
@@ -49,7 +47,10 @@
|
||||
<DataGridTextColumn Binding="{Binding Formula}" Header="公式" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="族类型:" />
|
||||
<ComboBox
|
||||
x:Name="CbbFamType"
|
||||
@@ -58,7 +59,10 @@
|
||||
SelectedIndex="0"
|
||||
SelectedValuePath="Value"
|
||||
SelectionChanged="CbbFamType_SelectionChanged" />
|
||||
<Button x:Name="LoadFam" Click="LoadFam_Click" Content="载入" />
|
||||
<Button
|
||||
x:Name="LoadFam"
|
||||
Click="LoadFam_Click"
|
||||
Content="载入" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
@@ -10,10 +10,7 @@
|
||||
Title="族传递"
|
||||
Width="300"
|
||||
Height="600"
|
||||
MinWidth="300"
|
||||
MinHeight="600"
|
||||
Loaded="WpfTransmit_Loaded"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<controls:MaterialWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
Binary file not shown.
@@ -10,9 +10,6 @@
|
||||
Title="深圳市交付标准"
|
||||
Width="800"
|
||||
Height="450"
|
||||
MinWidth="800"
|
||||
MinHeight="500"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Closed">
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
Title="属性匹配"
|
||||
Width="400"
|
||||
Height="280"
|
||||
MinWidth="400"
|
||||
MinHeight="200"
|
||||
d:DataContext="{d:DesignInstance Type=local:MappingElementCodeViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
Title="实例参数编辑"
|
||||
Width="500"
|
||||
Height="400"
|
||||
MinWidth="400"
|
||||
MinHeight="400"
|
||||
d:DataContext="{d:DesignInstance Type=local:WriteParametersViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
Title="整理管线"
|
||||
Width="270"
|
||||
MinHeight="180"
|
||||
Height="180"
|
||||
d:DataContext="{d:DesignInstance Type=local:ArrangeMEPCurveViewModel}"
|
||||
SizeToContent="Height"
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="线缆布置"
|
||||
MinWidth="250"
|
||||
MinHeight="200"
|
||||
Width="250"
|
||||
Height="250"
|
||||
d:DataContext="{d:DesignInstance Type=electricDesign:CableLayoutViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
@@ -41,7 +41,10 @@
|
||||
ItemsSource="{Binding Sizes}"
|
||||
SelectedValue="{Binding Size, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Value" />
|
||||
<TextBox materialDesign:HintAssist.Hint="线缆数量" InputMethod.IsInputMethodEnabled="False" Text="{Binding Count, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
materialDesign:HintAssist.Hint="线缆数量"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
Text="{Binding Count, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Margin="5,15,5,5" Content="布置">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="Click">
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
Title="避让处理"
|
||||
Width="300"
|
||||
Height="520"
|
||||
MinWidth="200"
|
||||
MinHeight="250"
|
||||
d:DataContext="{d:DesignInstance Type=mep:ClashResolveViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
@@ -39,8 +37,14 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Grid.Row="0" Grid.Column="0" Header="角度(°)">
|
||||
<UniformGrid Height="180" Columns="3" Rows="3">
|
||||
<GroupBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Header="角度(°)">
|
||||
<UniformGrid
|
||||
Height="180"
|
||||
Columns="3"
|
||||
Rows="3">
|
||||
<RadioButton Content="15°">
|
||||
<RadioButton.IsChecked>
|
||||
<Binding Converter="{StaticResource ComparisonConverter}" Path="Angle">
|
||||
@@ -106,8 +110,14 @@
|
||||
Rows="1">
|
||||
<GroupBox Header="参考方式">
|
||||
<UniformGrid Rows="1">
|
||||
<RadioButton Content="手动" IsChecked="{Binding LocationType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static mep:LocationType.Manual}}" ToolTip="手动选取两点" />
|
||||
<RadioButton Content="参考" IsChecked="{Binding LocationType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static mep:LocationType.Reference}}" ToolTip="选择相交的两条管线,将翻弯管线偏移一定距离" />
|
||||
<RadioButton
|
||||
Content="手动"
|
||||
IsChecked="{Binding LocationType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static mep:LocationType.Manual}}"
|
||||
ToolTip="手动选取两点" />
|
||||
<RadioButton
|
||||
Content="参考"
|
||||
IsChecked="{Binding LocationType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static mep:LocationType.Reference}}"
|
||||
ToolTip="选择相交的两条管线,将翻弯管线偏移一定距离" />
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="调整方式">
|
||||
@@ -126,7 +136,10 @@
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
<UniformGrid Grid.Row="3" Columns="2">
|
||||
<TextBox md:HintAssist.Hint="偏移量" md:TextFieldAssist.SuffixText="mm" Text="{Binding Offset, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
md:HintAssist.Hint="偏移量"
|
||||
md:TextFieldAssist.SuffixText="mm"
|
||||
Text="{Binding Offset, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Command="{Binding ResolveCommand}" Content="调整" />
|
||||
</UniformGrid>
|
||||
|
||||
|
||||
@@ -11,10 +11,8 @@
|
||||
Title="快速剖面"
|
||||
Width="250"
|
||||
Height="180"
|
||||
MinHeight="180"
|
||||
d:DataContext="{d:DesignInstance Type=local:QuickViewSectionViewModel}"
|
||||
SizeToContent="Height"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<controls:MaterialWindow.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Szmedi.RvKits;component/WPFUI.xaml" />
|
||||
@@ -22,7 +20,10 @@
|
||||
<StackPanel Margin="5">
|
||||
<GroupBox Grid.Row="0" Header="剖面线">
|
||||
<UniformGrid Rows="1">
|
||||
<RadioButton HorizontalAlignment="Center" Content="平行" IsChecked="{Binding IsParallel}" />
|
||||
<RadioButton
|
||||
HorizontalAlignment="Center"
|
||||
Content="平行"
|
||||
IsChecked="{Binding IsParallel}" />
|
||||
<RadioButton
|
||||
x:Name="Perpendicular"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -31,7 +32,10 @@
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
<UniformGrid Rows="1">
|
||||
<Button HorizontalAlignment="Stretch" Command="{Binding CreateViewSectionCommand}" Content="创建" />
|
||||
<Button
|
||||
HorizontalAlignment="Stretch"
|
||||
Command="{Binding CreateViewSectionCommand}"
|
||||
Content="创建" />
|
||||
<Button
|
||||
Margin="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
Title="旋转实例"
|
||||
Width="250"
|
||||
Height="340"
|
||||
MinWidth="250"
|
||||
MinHeight="300"
|
||||
SizeToContent="Height"
|
||||
d:DataContext="{d:DesignInstance Type={x:Type local:RotateMEPViewModel}}"
|
||||
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
<controls:MaterialWindow.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Szmedi.RvKits;component/WPFUI.xaml" />
|
||||
@@ -26,7 +23,10 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Grid.Row="0" Grid.Column="0" Header="角度(°)">
|
||||
<GroupBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Header="角度(°)">
|
||||
<UniformGrid Columns="3" Rows="3">
|
||||
<RadioButton Content="15°">
|
||||
<RadioButton.IsChecked>
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
Title="创建立管"
|
||||
Width="250"
|
||||
Height="320"
|
||||
MinWidth="250"
|
||||
MinHeight="280"
|
||||
d:DataContext="{d:DesignInstance mep:StandMepCurveViewModel}"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
@@ -34,7 +32,10 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<RadioButton x:Name="RbPipe" Content="水管" IsChecked="{Binding IsPipe}" />
|
||||
<RadioButton
|
||||
x:Name="RbPipe"
|
||||
Content="水管"
|
||||
IsChecked="{Binding IsPipe}" />
|
||||
<StackPanel Visibility="{Binding IsPipe, Converter={x:Static md:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<ComboBox
|
||||
md:HintAssist.Hint="管道类型"
|
||||
@@ -47,7 +48,10 @@
|
||||
ItemsSource="{Binding PipeSystemTypes}"
|
||||
SelectedItem="{Binding SelectedPipeSystemType}" />
|
||||
</StackPanel>
|
||||
<RadioButton x:Name="RbDuct" Content="风管" IsChecked="{Binding IsDuct}" />
|
||||
<RadioButton
|
||||
x:Name="RbDuct"
|
||||
Content="风管"
|
||||
IsChecked="{Binding IsDuct}" />
|
||||
<StackPanel Visibility="{Binding IsDuct, Converter={x:Static md:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<ComboBox
|
||||
md:HintAssist.Hint="风管类型"
|
||||
@@ -60,14 +64,20 @@
|
||||
ItemsSource="{Binding DuctSystemTypes}"
|
||||
SelectedItem="{Binding SelectedDuctSystemType}" />
|
||||
</StackPanel>
|
||||
<RadioButton x:Name="RbConduit" Content="线管" IsChecked="{Binding IsConduit}" />
|
||||
<RadioButton
|
||||
x:Name="RbConduit"
|
||||
Content="线管"
|
||||
IsChecked="{Binding IsConduit}" />
|
||||
<ComboBox
|
||||
md:HintAssist.Hint="线管类型"
|
||||
ItemTemplate="{StaticResource MultiDisplayMemberPath}"
|
||||
ItemsSource="{Binding ConduitTypes}"
|
||||
SelectedItem="{Binding SelectedConduitType}"
|
||||
Visibility="{Binding IsConduit, Converter={x:Static md:BooleanToVisibilityConverter.CollapsedInstance}}" />
|
||||
<RadioButton x:Name="RbCableTray" Content="桥架" IsChecked="{Binding IsCableTray}" />
|
||||
<RadioButton
|
||||
x:Name="RbCableTray"
|
||||
Content="桥架"
|
||||
IsChecked="{Binding IsCableTray}" />
|
||||
<ComboBox
|
||||
md:HintAssist.Hint="桥架类型"
|
||||
ItemTemplate="{StaticResource MultiDisplayMemberPath}"
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
Title="{Binding ProjectName, StringFormat={}构件划分 - {0}}"
|
||||
Width="500"
|
||||
Height="400"
|
||||
MinWidth="400"
|
||||
MinHeight="400"
|
||||
d:DataContext="{d:DesignInstance Type=local:LevelSeparateViewModel}"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
@@ -31,7 +29,10 @@
|
||||
SelectionUnit="FullRow"
|
||||
ToolTip="修改划分名称,会填写对应元素的所属楼层属性">
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Binding="{Binding IsVisible, UpdateSourceTrigger=PropertyChanged}" EditingElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnEditingStyle}" ElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnStyle}">
|
||||
<DataGridCheckBoxColumn
|
||||
Binding="{Binding IsVisible, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnEditingStyle}"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnStyle}">
|
||||
<DataGridCheckBoxColumn.Header>
|
||||
<CheckBox Content="可见性" IsChecked="{Binding DataContext.IsAllItemsSelected, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
|
||||
</DataGridCheckBoxColumn.Header>
|
||||
@@ -47,7 +48,10 @@
|
||||
EditingElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnEditingStyle}"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnStyle}"
|
||||
Header="可见性" />-->
|
||||
<DataGridTextColumn Binding="{Binding LevelName}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" Header="划分">
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding LevelName}"
|
||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||
Header="划分">
|
||||
<DataGridTextColumn.HeaderStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
@@ -55,7 +59,10 @@
|
||||
</Style>
|
||||
</DataGridTextColumn.HeaderStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Elements.Count}" Header="构件数" IsReadOnly="True">
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Elements.Count}"
|
||||
Header="构件数"
|
||||
IsReadOnly="True">
|
||||
<DataGridTextColumn.HeaderStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
@@ -106,14 +113,23 @@
|
||||
</ListBox.ItemTemplate>-->
|
||||
</DataGrid>
|
||||
<UniformGrid Grid.Row="1" Columns="3">
|
||||
<CheckBox Content="是否填充颜色区分" IsChecked="{Binding ToFillColor, UpdateSourceTrigger=PropertyChanged}" ToolTip="读取现有划分及根据标高划分命令是否一次性进行颜色填充" />
|
||||
<CheckBox
|
||||
Content="是否填充颜色区分"
|
||||
IsChecked="{Binding ToFillColor, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="读取现有划分及根据标高划分命令是否一次性进行颜色填充" />
|
||||
<!--<CheckBox
|
||||
x:Name="CBFillLevelName"
|
||||
Content="是否填写楼层"
|
||||
IsChecked="{Binding ToFillLevelName, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="根据楼层划分命令或直接修改表中的划分列,是否直接赋予构件标高信息" />-->
|
||||
<Button Command="{Binding ReadCurrentModelCommand}" Content="读取现有划分" ToolTip="获取当前项目的元素,并按所属楼层划分,未填写或没有该属性归为未知楼层, 嵌套共享族、幕墙,会根据主体族,刷新嵌套族属性" />
|
||||
<Button Command="{Binding GroupByLevelCommand}" Content="根据标高划分" ToolTip="根据标高,对所有构件进行默认划分,具有 所属楼层 属性的构件自动填写,没有的该属性则不填写, 获取未定义或无法填写所属楼层的的构件,请使用读取现有划分命令" />
|
||||
<Button
|
||||
Command="{Binding ReadCurrentModelCommand}"
|
||||
Content="读取现有划分"
|
||||
ToolTip="获取当前项目的元素,并按所属楼层划分,未填写或没有该属性归为未知楼层, 嵌套共享族、幕墙,会根据主体族,刷新嵌套族属性" />
|
||||
<Button
|
||||
Command="{Binding GroupByLevelCommand}"
|
||||
Content="根据标高划分"
|
||||
ToolTip="根据标高,对所有构件进行默认划分,具有 所属楼层 属性的构件自动填写,没有的该属性则不填写, 获取未定义或无法填写所属楼层的的构件,请使用读取现有划分命令" />
|
||||
<Button
|
||||
Command="{Binding SelectElementsCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ItemsDG}"
|
||||
@@ -124,7 +140,10 @@
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ItemsDG}"
|
||||
Content="填充颜色"
|
||||
ToolTip="对当前选中的行的元素进行颜色填充" />
|
||||
<Button Command="{Binding ResetColorOverrideCommand}" Content="重置颜色" ToolTip="将所有已经着色的构件,恢复其默认外观" />
|
||||
<Button
|
||||
Command="{Binding ResetColorOverrideCommand}"
|
||||
Content="重置颜色"
|
||||
ToolTip="将所有已经着色的构件,恢复其默认外观" />
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</controls:MaterialWindow>
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
Title="土建材质"
|
||||
Width="350"
|
||||
Height="300"
|
||||
MinWidth="350"
|
||||
MinHeight="200"
|
||||
d:DataContext="{d:DesignInstance local:MaterialBatchViewModel}"
|
||||
SizeToContent="Height"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Closing">
|
||||
@@ -68,7 +65,10 @@
|
||||
ToolTip="根据选中的分类框选构件应用材质" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Row="2" Header="自定义材质批处理" Visibility="{Binding IsChecked, ElementName=SwitchToggleButton, Converter={x:Static materialDesign:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<GroupBox
|
||||
Grid.Row="2"
|
||||
Header="自定义材质批处理"
|
||||
Visibility="{Binding IsChecked, ElementName=SwitchToggleButton, Converter={x:Static materialDesign:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
|
||||
@@ -1187,9 +1187,9 @@ namespace Szmedi.RvKits.ModelManager
|
||||
/// 复审意见
|
||||
/// </summary>
|
||||
public string ReexamineComment { get; set; }
|
||||
///// <summary>
|
||||
///// 意见回复
|
||||
///// </summary>
|
||||
/// <summary>
|
||||
/// 意见回复
|
||||
/// </summary>
|
||||
public string ReplyToComment { get; set; }
|
||||
/// <summary>
|
||||
/// 详细意见备注
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Szmedi.RvKits.ModelManager
|
||||
{
|
||||
foreach (var elem in elementsBaseFace)
|
||||
{
|
||||
sb.AppendLine($"{elem.Id},{elem.Name},基于面主体的图元,不进行移动,");
|
||||
sb.AppendLine($"{elem.Id},{elem.Name},基于面主体的图元,不进行移动,但可能会因为主体移动而错位,请检查,");
|
||||
}
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
|
||||
@@ -74,7 +74,8 @@ public partial class InstanceCreatorViewModel : ObservableObject
|
||||
private BitmapSource image;
|
||||
|
||||
[ObservableProperty]
|
||||
private string searchText;
|
||||
public partial string SearchText { get; set; }
|
||||
|
||||
partial void OnSearchTextChanged(string value)
|
||||
{
|
||||
if (Families != null)
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
x:Class="Szmedi.RvKits.Modeling.InstanceCreatorWin"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:controls="clr-namespace:Szmedi.RvKits.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Szmedi.RvKits.Modeling"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="族实例布置"
|
||||
Width="400"
|
||||
Height="400"
|
||||
MinHeight="300"
|
||||
d:DataContext="{d:DesignInstance local:InstanceCreatorViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<controls:MaterialWindow.Resources>
|
||||
@@ -31,10 +31,10 @@
|
||||
Grid.Column="0"
|
||||
materialDesign:HintAssist.Hint="族名称"
|
||||
DisplayMemberPath="Name"
|
||||
Text="{Binding SearchText,UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding FamiliesView}"
|
||||
SelectedItem="{Binding SelectedFamily, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
SelectedItem="{Binding SelectedFamily, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}">
|
||||
<!--<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="PreviewTextInput">
|
||||
<b:InvokeCommandAction Command="{Binding PreviewTextInputCommand}" PassEventArgsToCommand="True"/>
|
||||
@@ -56,7 +56,10 @@
|
||||
Height="64"
|
||||
Margin="5"
|
||||
Source="{Binding Image}" />
|
||||
<TextBox Grid.Row="3" materialDesign:TextFieldAssist.PrefixText="偏移量:" materialDesign:TextFieldAssist.SuffixText="mm">
|
||||
<TextBox
|
||||
Grid.Row="3"
|
||||
materialDesign:TextFieldAssist.PrefixText="偏移量:"
|
||||
materialDesign:TextFieldAssist.SuffixText="mm">
|
||||
<TextBox.Text>
|
||||
<Binding Path="Offset" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
ProfileFamilyTypesView.Filter = obj =>
|
||||
{
|
||||
if (obj is FamilySymbol fs)
|
||||
if (obj is WrapperSymbol ws)
|
||||
{
|
||||
return fs.Name.Contains(value) || fs.FamilyName.Contains(value);
|
||||
return ws.FullName.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -46,21 +46,41 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
FamilyTypesView.Filter = obj =>
|
||||
{
|
||||
if (obj is FamilySymbol fs)
|
||||
if (obj is WrapperSymbol ws)
|
||||
{
|
||||
return fs.Name.Contains(value) || fs.FamilyName.Contains(value);
|
||||
return ws.FullName.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
FamilyTypesView.Refresh();
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
private string searchMaterialText;
|
||||
|
||||
partial void OnSearchMaterialTextChanged(string value)
|
||||
{
|
||||
|
||||
if (Materials != null)
|
||||
{
|
||||
MaterialsView.Filter = obj =>
|
||||
{
|
||||
if (obj is Material mat)
|
||||
{
|
||||
return mat.Name.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
MaterialsView.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
private CenterCurveType centerCurveType;
|
||||
|
||||
[ObservableProperty]
|
||||
private List<FamilySymbol> familyTypes;
|
||||
public partial List<WrapperSymbol> FamilyTypes { get; set; }
|
||||
|
||||
private readonly ActionEventHandler handler;
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
@@ -106,21 +126,21 @@ namespace Szmedi.RvKits.Modeling
|
||||
private System.Windows.Media.ImageSource previewImage = Resources.TrackPic.ToBitmapSource();
|
||||
|
||||
[ObservableProperty]
|
||||
private List<FamilySymbol> profileFamilyTypes;
|
||||
|
||||
public partial List<WrapperSymbol> ProfileFamilyTypes { get; set; }
|
||||
public ICollectionView ProfileFamilyTypesView { get; set; }
|
||||
public ICollectionView FamilyTypesView { get; set; }
|
||||
public ICollectionView MaterialsView { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
private FamilySymbol selectedFamilyType;
|
||||
public partial WrapperSymbol SelectedFamilyType { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private Material selectedMaterial;
|
||||
public partial Material SelectedMaterial { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
private FamilySymbol selectedProfileFamilyType;
|
||||
public partial WrapperSymbol SelectedProfileFamilyType { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[IsNumeric]
|
||||
@@ -132,11 +152,11 @@ namespace Szmedi.RvKits.Modeling
|
||||
public TrackCreatorViewModel(Document doc)
|
||||
{
|
||||
handler = new();
|
||||
profileFamilyTypes = doc.QueryElementsByTypeAndCategory<FamilySymbol>(BuiltInCategory.OST_ProfileFamilies)
|
||||
ProfileFamilyTypes = doc.QueryElementsByTypeAndCategory<FamilySymbol>(BuiltInCategory.OST_ProfileFamilies)
|
||||
.Cast<FamilySymbol>()
|
||||
.OrderBy(n => n.FamilyName)
|
||||
.ToList();
|
||||
familyTypes = doc.QueryElementsByType<FamilySymbol>()
|
||||
.ToList().ConvertAll(s => new WrapperSymbol(s));
|
||||
FamilyTypes = doc.QueryElementsByType<FamilySymbol>()
|
||||
.OfType<FamilySymbol>()
|
||||
.Where(
|
||||
s =>
|
||||
@@ -146,10 +166,11 @@ namespace Szmedi.RvKits.Modeling
|
||||
&& s.Family.FamilyPlacementType == FamilyPlacementType.OneLevelBased
|
||||
)
|
||||
.OrderBy(n => n.FamilyName)
|
||||
.ToList();
|
||||
materials = doc.QueryElementsByType<Material>().OrderBy(n => n.Name).OfType<Material>().ToList();
|
||||
.ToList().ConvertAll(s => new WrapperSymbol(s));
|
||||
Materials = doc.QueryElementsByType<Material>().OrderBy(n => n.Name).OfType<Material>().ToList();
|
||||
ProfileFamilyTypesView = CollectionViewSource.GetDefaultView(ProfileFamilyTypes);
|
||||
FamilyTypesView = CollectionViewSource.GetDefaultView(FamilyTypes);
|
||||
MaterialsView = CollectionViewSource.GetDefaultView(Materials);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -344,9 +365,9 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
var horizonSpline = HermiteSpline.Create(planePoints, false);
|
||||
|
||||
if (!SelectedFamilyType.IsActive)
|
||||
if (!SelectedFamilyType.FamilySymbol.IsActive)
|
||||
{
|
||||
SelectedFamilyType.Activate();
|
||||
SelectedFamilyType.FamilySymbol.Activate();
|
||||
}
|
||||
//找到零标高
|
||||
var level = new FilteredElementCollector(doc)
|
||||
@@ -377,7 +398,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
Autodesk.Revit.Creation.FamilyInstanceCreationData data1 =
|
||||
new(
|
||||
locLeft,
|
||||
SelectedFamilyType,
|
||||
SelectedFamilyType.FamilySymbol,
|
||||
referVector,
|
||||
level,
|
||||
Autodesk.Revit.DB.Structure.StructuralType.Footing
|
||||
@@ -388,7 +409,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
Autodesk.Revit.Creation.FamilyInstanceCreationData data =
|
||||
new(
|
||||
loc,
|
||||
SelectedFamilyType,
|
||||
SelectedFamilyType.FamilySymbol,
|
||||
referVector,
|
||||
level,
|
||||
Autodesk.Revit.DB.Structure.StructuralType.Footing
|
||||
@@ -422,7 +443,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
//非刚性变换,会改变原几何,此变换在曲线计算导数时,为非刚性变换,各个basis的模不等于1
|
||||
var transform = spline3D.ComputeDerivatives(0, false);
|
||||
|
||||
familyDocument = doc.EditFamily(SelectedProfileFamilyType.Family);
|
||||
familyDocument = doc.EditFamily(SelectedProfileFamilyType.FamilySymbol.Family);
|
||||
XYZ tangent;
|
||||
XYZ rightBasis;
|
||||
XYZ topBasis;
|
||||
@@ -467,7 +488,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
var fm = familyDocument.FamilyManager;
|
||||
foreach (FamilyType type in fm.Types)
|
||||
{
|
||||
if (type.Name == SelectedProfileFamilyType.Name)
|
||||
if (type.Name == SelectedProfileFamilyType.FamilySymbol.Name)
|
||||
{
|
||||
fm.CurrentType = type;
|
||||
break;
|
||||
@@ -626,6 +647,23 @@ namespace Szmedi.RvKits.Modeling
|
||||
// set { SetProperty(ref spacing, value, true); }
|
||||
//}
|
||||
}
|
||||
public class WrapperSymbol
|
||||
{
|
||||
|
||||
public FamilySymbol FamilySymbol { get; }
|
||||
|
||||
public WrapperSymbol(FamilySymbol familySymbol)
|
||||
{
|
||||
FamilySymbol = familySymbol;
|
||||
}
|
||||
|
||||
public string FullName => $"{FamilySymbol.FamilyName} : {FamilySymbol.Name}";
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{FamilySymbol.FamilyName} : {FamilySymbol.Name}";
|
||||
}
|
||||
}
|
||||
public enum CenterCurveType
|
||||
{
|
||||
ModelCurve,
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
Title="轨道创建"
|
||||
Width="420"
|
||||
Height="720"
|
||||
SizeToContent="Height"
|
||||
d:DataContext="{d:DesignInstance Type=local:TrackCreatorViewModel}"
|
||||
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d">
|
||||
<controls:MaterialWindow.Resources>
|
||||
<ResourceDictionary Source="pack://application:,,,/Szmedi.RvKits;component/WPFUI.xaml" />
|
||||
@@ -35,15 +34,18 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Grid.Row="0" Grid.Column="0" Header="轨道">
|
||||
<GroupBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Header="轨道">
|
||||
<StackPanel>
|
||||
<ComboBox
|
||||
materialDesign:HintAssist.Hint="轨道轮廓类型"
|
||||
ItemTemplate="{StaticResource MultiDisplayMemberPath}"
|
||||
ItemsSource="{Binding ProfileFamilyTypesView}"
|
||||
DisplayMemberPath="FullName"
|
||||
IsEditable="True"
|
||||
Text="{Binding SearchProfileText,UpdateSourceTrigger=PropertyChanged}"
|
||||
ItemsSource="{Binding ProfileFamilyTypesView, Mode=OneWay}"
|
||||
SelectedItem="{Binding SelectedProfileFamilyType, UpdateSourceTrigger=PropertyChanged}"
|
||||
Text="{Binding SearchProfileText, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="未选择则不创建,
右键点击清除选择">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="MouseRightButtonUp">
|
||||
@@ -54,8 +56,10 @@
|
||||
<ComboBox
|
||||
materialDesign:HintAssist.Hint="轨道材质"
|
||||
DisplayMemberPath="Name"
|
||||
ItemsSource="{Binding Materials, Mode=OneWay}"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding MaterialsView, Mode=OneWay}"
|
||||
SelectedItem="{Binding SelectedMaterial, UpdateSourceTrigger=PropertyChanged}"
|
||||
Text="{Binding SearchMaterialText, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="未选择无材质,
右键点击清除选择">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="MouseRightButtonUp">
|
||||
@@ -77,15 +81,18 @@
|
||||
ToolTip="向上偏移设置为正值,
向下偏移为负值" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Row="0" Grid.Column="1" Header="扣件、轨枕">
|
||||
<GroupBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Header="扣件、轨枕">
|
||||
<StackPanel>
|
||||
<ComboBox
|
||||
materialDesign:HintAssist.Hint="扣件或轨枕类型"
|
||||
ItemTemplate="{StaticResource MultiDisplayMemberPath}"
|
||||
ItemsSource="{Binding FamilyTypesView}"
|
||||
DisplayMemberPath="FullName"
|
||||
IsEditable="True"
|
||||
Text="{Binding SearchFamilyText,UpdateSourceTrigger=PropertyChanged}"
|
||||
ItemsSource="{Binding FamilyTypesView, Mode=OneWay}"
|
||||
SelectedItem="{Binding SelectedFamilyType, UpdateSourceTrigger=PropertyChanged}"
|
||||
Text="{Binding SearchFamilyText, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="未选择则不创建,
右键点击清除选择">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="MouseRightButtonUp">
|
||||
@@ -115,9 +122,18 @@
|
||||
</Grid>
|
||||
<GroupBox Grid.Row="2" Header="中心线类型">
|
||||
<UniformGrid VerticalAlignment="Center" Rows="1">
|
||||
<RadioButton Content="模型线" IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.ModelCurve}, Converter={StaticResource ComparisonConverter}}" ToolTip="框选连续、非闭合的模型线并在工具栏完成选择,
模型线的定位平面为绘制时的工作平面,
如在楼层楼层平面为该楼层高度" />
|
||||
<RadioButton Content="体量族" IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.MassCurve}, Converter={StaticResource ComparisonConverter}}" ToolTip="体量族中仅包含有一条连续的三维曲线" />
|
||||
<RadioButton Content="dwg链接" IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.DWGCurve}, Converter={StaticResource ComparisonConverter}}" ToolTip="dwg中仅有一条连续的三维曲线" />
|
||||
<RadioButton
|
||||
Content="模型线"
|
||||
IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.ModelCurve}, Converter={StaticResource ComparisonConverter}}"
|
||||
ToolTip="框选连续、非闭合的模型线并在工具栏完成选择,
模型线的定位平面为绘制时的工作平面,
如在楼层楼层平面为该楼层高度" />
|
||||
<RadioButton
|
||||
Content="体量族"
|
||||
IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.MassCurve}, Converter={StaticResource ComparisonConverter}}"
|
||||
ToolTip="体量族中仅包含有一条连续的三维曲线" />
|
||||
<RadioButton
|
||||
Content="dwg链接"
|
||||
IsChecked="{Binding CenterCurveType, ConverterParameter={x:Static local:CenterCurveType.DWGCurve}, Converter={StaticResource ComparisonConverter}}"
|
||||
ToolTip="dwg中仅有一条连续的三维曲线" />
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
<UniformGrid Grid.Row="3" Rows="1">
|
||||
@@ -132,7 +148,10 @@
|
||||
Content="两侧布置"
|
||||
IsChecked="{Binding IsTwoSides}"
|
||||
ToolTip="截面或者实例是否在中心线另一侧创建或布置" />
|
||||
<Button Command="{Binding CreateTrackCommand}" Content="创建" ToolTip="选择合适的选项,创建模型。
注意:两根模型线之间若角度极小,
可作为一条直线时,使用一条直线代替" />
|
||||
<Button
|
||||
Command="{Binding CreateTrackCommand}"
|
||||
Content="创建"
|
||||
ToolTip="选择合适的选项,创建模型。
注意:两根模型线之间若角度极小,
可作为一条直线时,使用一条直线代替" />
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</controls:MaterialWindow>
|
||||
|
||||
1
Szmedi.RvKits/Properties/Settings.Designer.cs
generated
1
Szmedi.RvKits/Properties/Settings.Designer.cs
generated
@@ -259,6 +259,7 @@ namespace Szmedi.RvKits.Properties {
|
||||
<string>界面控件压缩</string>
|
||||
<string>增加根据EAM编码表填写编码工具,在参数管理下拉菜单</string>
|
||||
<string>增加部分功能的弹窗提示,避免误操作</string>
|
||||
<string>修复轨道创建下拉框无法搜索并选择的问题</string>
|
||||
</ArrayOfString>")]
|
||||
public global::System.Collections.Specialized.StringCollection UpdateNotes {
|
||||
get {
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
<string>界面控件压缩</string>
|
||||
<string>增加根据EAM编码表填写编码工具,在参数管理下拉菜单</string>
|
||||
<string>增加部分功能的弹窗提示,避免误操作</string>
|
||||
<string>修复轨道创建下拉框无法搜索并选择的问题</string>
|
||||
</ArrayOfString></Value>
|
||||
</Setting>
|
||||
<Setting Name="APIKey" Type="System.String" Scope="User">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<AssemblyName>Szmedi.RvKits</AssemblyName>
|
||||
<RootNamespace>$(AssemblyName)</RootNamespace>
|
||||
<Company>Szmedi</Company>
|
||||
<AssemblyVersion>2.2.3.74</AssemblyVersion>
|
||||
<AssemblyVersion>2.2.3.75</AssemblyVersion>
|
||||
<ProductVersion>$(AssemblyVersion)</ProductVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
</PropertyGroup>
|
||||
@@ -165,7 +165,6 @@
|
||||
<Content Include="Szmedi.RvKits.addin">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Remove="Fonts\SourceHanSansSC-Regular.otf" />
|
||||
<None Remove="Templates\template.txt" />
|
||||
<Content Include="Properties\launchSettings.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
@@ -174,9 +173,6 @@
|
||||
<ItemGroup>
|
||||
<None Include="Civil\ArchiRoomData.db" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Fonts\SourceHanSansSC-Regular.otf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="InfoManager\EAMTools\EAMFacilityCodeWin.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/Internal/MaterialDesignTheme.BaseThemeColors.xaml" />-->
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />-->
|
||||
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Teal" SecondaryColor="Green" />
|
||||
<materialDesign:BundledTheme
|
||||
BaseTheme="Dark"
|
||||
PrimaryColor="Teal"
|
||||
SecondaryColor="Green" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Szmedi.RvKits;component/Controls/MaterialWindow.xaml" />
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />-->
|
||||
@@ -23,7 +26,7 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignDarkTheme.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!--<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#744CE0" />-->
|
||||
<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RvKits;component/Fonts/#Source Han Sans SC</FontFamily>
|
||||
<!--<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RvKits;component/Fonts/#Source Han Sans SC</FontFamily>-->
|
||||
<!--#region Converters-->
|
||||
<!--<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />-->
|
||||
<!--<converters:InvertBooleanToVisibilityConverter x:Key="InvertBooleanToVisibilityConverter" />-->
|
||||
@@ -74,12 +77,14 @@
|
||||
|
||||
<!--<Style BasedOn="{StaticResource MaterialDesignWindow}" TargetType="{x:Type Window}">
|
||||
<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />
|
||||
--><!--<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />-->
|
||||
-->
|
||||
<!--<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />-->
|
||||
<!--<Setter Property="TextElement.FontSize" Value="13" />-->
|
||||
<!--<Setter Property="TextElement.FontWeight" Value="Regular" />-->
|
||||
<!--<Setter Property="TextOptions.TextRenderingMode" Value="Auto" />-->
|
||||
<!--<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />-->
|
||||
<!--<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />--><!--
|
||||
<!--<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />-->
|
||||
<!--
|
||||
<Setter Property="ShowInTaskbar" Value="False" />
|
||||
<Setter Property="SizeToContent" Value="WidthAndHeight" />
|
||||
</Style>-->
|
||||
@@ -99,15 +104,15 @@
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGrid}" TargetType="DataGrid">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
||||
<Style TargetType="Page">
|
||||
<!--<Setter Property="TextElement.FontSize" Value="13" />-->
|
||||
<!--<Setter Property="TextElement.FontWeight" Value="Regular" />-->
|
||||
<!--<Setter Property="TextOptions.TextRenderingMode" Value="Auto" />-->
|
||||
<!--<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />-->
|
||||
<!--<Setter Property="Background" Value="{StaticResource MaterialDesign.Brush.Background}" />-->
|
||||
<!--<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />-->
|
||||
<!--<Style TargetType="Page">
|
||||
<Setter Property="TextElement.FontSize" Value="13" />
|
||||
<Setter Property="TextElement.FontWeight" Value="Regular" />
|
||||
<Setter Property="TextOptions.TextRenderingMode" Value="Auto" />
|
||||
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
|
||||
<Setter Property="Background" Value="{StaticResource MaterialDesign.Brush.Background}" />
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />
|
||||
</Style>
|
||||
</Style>-->
|
||||
<Style BasedOn="{StaticResource MaterialDesignOutlinedTextBox}" TargetType="TextBox">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
@@ -118,7 +123,10 @@
|
||||
<ControlTemplate>
|
||||
<StackPanel>
|
||||
<AdornedElementPlaceholder Name="Adorner" />
|
||||
<TextBlock HorizontalAlignment="Right" Foreground="Red" Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="Red"
|
||||
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Szmedi.RvKits.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@@ -119,11 +115,16 @@
|
||||
<setting name="UpdateNotes" serializeAs="Xml">
|
||||
<value>
|
||||
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<string>修复构件划分读取划分时崩溃的情况</string>
|
||||
<string>新增地质剖切工具</string>
|
||||
<string>管线线上标记功能</string>
|
||||
<string>移动模型功能优化</string>
|
||||
<string>界面控件压缩</string>
|
||||
<string>增加根据EAM编码表填写编码工具,在参数管理下拉菜单</string>
|
||||
<string>增加部分功能的弹窗提示,避免误操作</string>
|
||||
<string>修复轨道创建下拉框无法搜索并选择的问题</string>
|
||||
</ArrayOfString>
|
||||
</value>
|
||||
</setting>
|
||||
</Szmedi.RvKits.Properties.Settings>
|
||||
</applicationSettings>
|
||||
|
||||
</configuration>
|
||||
@@ -4,7 +4,7 @@
|
||||
; 定义应用程序的名称
|
||||
#define MyAppName "SzmediTools"
|
||||
; 定义应用程序的版本号
|
||||
#define MyAppVersion "2.2.3.73"
|
||||
#define MyAppVersion "2.2.3.75"
|
||||
; 定义应用程序的发布者
|
||||
#define MyAppPublisher "SZMEDI"
|
||||
; 定义应用程序的网址
|
||||
|
||||
234
WPFUI.Test/Web/LLMClient.cs
Normal file
234
WPFUI.Test/Web/LLMClient.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace WPFUI.Test.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO
|
||||
/// </summary>
|
||||
internal class LLMClient
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly List<ChatMessage> _conversationHistory;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// 创建LLM客户端实例
|
||||
/// </summary>
|
||||
/// <param name="apiKey">API密钥</param>
|
||||
/// <param name="endpoint">API端点地址</param>
|
||||
/// <param name="systemPrompt">可选的系统提示词</param>
|
||||
public LLMClient(string apiKey, string endpoint, string systemPrompt = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(apiKey))
|
||||
throw new ArgumentNullException(nameof(apiKey));
|
||||
|
||||
if (string.IsNullOrEmpty(endpoint))
|
||||
throw new ArgumentNullException(nameof(endpoint));
|
||||
|
||||
_httpClient = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(endpoint)
|
||||
};
|
||||
|
||||
_httpClient.DefaultRequestHeaders.Authorization =
|
||||
new AuthenticationHeaderValue("Bearer", apiKey);
|
||||
_httpClient.DefaultRequestHeaders.Accept.Add(
|
||||
new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
|
||||
// 初始化对话历史,可选添加系统提示
|
||||
_conversationHistory = new List<ChatMessage>();
|
||||
if (!string.IsNullOrEmpty(systemPrompt))
|
||||
{
|
||||
_conversationHistory.Add(new ChatMessage("system", systemPrompt));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前对话历史
|
||||
/// </summary>
|
||||
public IReadOnlyList<ChatMessage> ConversationHistory => _conversationHistory.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// 清除对话历史(保留系统提示)
|
||||
/// </summary>
|
||||
public void ClearHistory()
|
||||
{
|
||||
if (_conversationHistory.Count > 0 && _conversationHistory[0].Role == "system")
|
||||
{
|
||||
var systemMessage = _conversationHistory[0];
|
||||
_conversationHistory.Clear();
|
||||
_conversationHistory.Add(systemMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_conversationHistory.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送非流式请求获取完整响应
|
||||
/// </summary>
|
||||
public async Task<string> SendMessageAsync(string userMessage, string model = "qwen-max")
|
||||
{
|
||||
// 添加用户消息到历史
|
||||
_conversationHistory.Add(new ChatMessage("user", userMessage));
|
||||
|
||||
// 创建请求内容(包含完整对话历史)
|
||||
var request = CreateRequestContent(_conversationHistory, model);
|
||||
|
||||
HttpResponseMessage response = await _httpClient.PostAsync("", request);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 解析响应并添加到对话历史
|
||||
var responseObj = JsonConvert.DeserializeObject<dynamic>(jsonResponse);
|
||||
string assistantReply = responseObj?.output?.choices?[0]?.message?.content;
|
||||
|
||||
if (!string.IsNullOrEmpty(assistantReply))
|
||||
{
|
||||
_conversationHistory.Add(new ChatMessage("assistant", assistantReply));
|
||||
}
|
||||
|
||||
return assistantReply;
|
||||
}
|
||||
|
||||
// 修正关键:使用SendAsync替代PostAsync解决.NET Framework参数问题
|
||||
public async Task SendMessageStreamAsync(string userMessage,
|
||||
Action<string> onChunkReceived,
|
||||
string model = "qwen-max",
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
_conversationHistory.Add(new ChatMessage("user", userMessage));
|
||||
_conversationHistory.Add(new ChatMessage("assistant", "")); // 占位符
|
||||
|
||||
var request = CreateRequestContent(_conversationHistory, model, true);
|
||||
|
||||
// 创建HttpRequestMessage对象(.NET Framework兼容方式)
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, _httpClient.BaseAddress)
|
||||
{
|
||||
Content = request
|
||||
};
|
||||
|
||||
// 使用SendAsync并指定HttpCompletionOption(.NET Framework兼容)
|
||||
using (var response = await _httpClient.SendAsync(
|
||||
httpRequest,
|
||||
HttpCompletionOption.ResponseHeadersRead,
|
||||
cancellationToken))
|
||||
{
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
using (var stream = await response.Content.ReadAsStreamAsync())
|
||||
using (var reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
string fullResponse = "";
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
string line = await reader.ReadLineAsync();
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
// 修正:正确处理阿里云SSE格式(data: {...})
|
||||
if (line.StartsWith("data: "))
|
||||
{
|
||||
string jsonData = line.Substring(6);
|
||||
try
|
||||
{
|
||||
if (jsonData.Trim() == "[DONE]")
|
||||
continue;
|
||||
|
||||
var json = JsonConvert.DeserializeObject<dynamic>(jsonData);
|
||||
string content = json?.output?.choices?[0]?.delta?.content;
|
||||
|
||||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
fullResponse += content;
|
||||
onChunkReceived?.Invoke(content);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 忽略无法解析的数据
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新助手消息的实际内容
|
||||
if (_conversationHistory.Count > 0)
|
||||
{
|
||||
_conversationHistory[_conversationHistory.Count - 1] =
|
||||
new ChatMessage("assistant", fullResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private StringContent CreateRequestContent(List<ChatMessage> messages, string model, bool stream = false)
|
||||
{
|
||||
// 构建符合通义千问API的消息结构
|
||||
var requestBody = new
|
||||
{
|
||||
model,
|
||||
input = new
|
||||
{
|
||||
messages = messages.ConvertAll(m => new { role = m.Role, content = m.Content })
|
||||
},
|
||||
parameters = new
|
||||
{
|
||||
result_format = "message"
|
||||
},
|
||||
stream
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(requestBody);
|
||||
return new StringContent(json, Encoding.UTF8, "application/json");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_httpClient?.Dispose();
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 表示对话中的单条消息
|
||||
/// </summary>
|
||||
public class ChatMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息角色: user, assistant, system
|
||||
/// </summary>
|
||||
public string Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
public ChatMessage(string role, string content)
|
||||
{
|
||||
Role = role;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user