添加项目文件。
This commit is contained in:
150
MSDevTool/Views/ElementInfoView.xaml
Normal file
150
MSDevTool/Views/ElementInfoView.xaml
Normal file
@@ -0,0 +1,150 @@
|
||||
<Window
|
||||
x:Class="MSDevTool.Views.ElementInfoView"
|
||||
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:MSDevTool"
|
||||
xmlns:attach="clr-namespace:MSDevTool.Attached"
|
||||
xmlns:vm="clr-namespace:MSDevTool.ViewModels"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:conv="clr-namespace:MSDevTool.Converters"
|
||||
Title="查询"
|
||||
Width="500"
|
||||
Height="800"
|
||||
MaxHeight="800"
|
||||
d:DataContext="{d:DesignInstance Type=vm:ElementInfoViewModel}"
|
||||
Topmost="True"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<conv:TypeValueConverter x:Key="TypeValueConverter" />
|
||||
<conv:TypeConverter x:Key="TypeConverter" />
|
||||
<conv:NullToStringConverter x:Key="NullToStringConverter" />
|
||||
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander Header="{Binding Name}" IsExpanded="False">
|
||||
<ItemsPresenter />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<!-- 当值为整数类型时 -->
|
||||
<!-- ClassPropValue -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:Int32}">
|
||||
<Setter Property="Foreground" Value="OrangeRed" />
|
||||
</DataTrigger>
|
||||
<!-- 当值为字符串类型时 -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:String}">
|
||||
<Setter Property="Foreground" Value="DarkGreen" />
|
||||
</DataTrigger>
|
||||
<!-- 当值为布尔类型时 -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:Boolean}">
|
||||
<Setter Property="Foreground" Value="DarkBlue" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ClassPropValues}"
|
||||
SelectionUnit="FullRow">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="MouseDoubleClick">
|
||||
<b:InvokeCommandAction Command="{Binding ShowObjectCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />
|
||||
</b:EventTrigger>
|
||||
</b:Interaction.Triggers>
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="attach:ObjectType.IsMatchObject">
|
||||
<Setter.Value>
|
||||
<!-- Self=DataGridRow -->
|
||||
<Binding Converter="{StaticResource TypeValueConverter}" RelativeSource="{RelativeSource Self}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="attach:ObjectType.IsMatchObject" Value="True">
|
||||
<!--<Setter Property="Foreground" Value="LightGreen" />-->
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
|
||||
<GroupStyle.Panel>
|
||||
<ItemsPanelTemplate>
|
||||
<DataGridRowsPresenter />
|
||||
</ItemsPanelTemplate>
|
||||
</GroupStyle.Panel>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="Auto"
|
||||
Binding="{Binding PropName}"
|
||||
Header="类属性名" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding PropValue, Converter={StaticResource NullToStringConverter}}"
|
||||
CellStyle="{StaticResource CellStyle}"
|
||||
Header="属性值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding DataType}"
|
||||
Header="数据类型" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ECPropValues}"
|
||||
SelectionUnit="Cell">
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
|
||||
<GroupStyle.Panel>
|
||||
<ItemsPanelTemplate>
|
||||
<DataGridRowsPresenter />
|
||||
</ItemsPanelTemplate>
|
||||
</GroupStyle.Panel>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding LabelName}" Header="EC属性标签名" />
|
||||
<DataGridTextColumn
|
||||
Width="Auto"
|
||||
Binding="{Binding PropName}"
|
||||
Header="EC属性名" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding PropValue, Converter={StaticResource NullToStringConverter}}"
|
||||
CellStyle="{StaticResource CellStyle}"
|
||||
Header="EC值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding DataType}"
|
||||
Header="数据类型" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
17
MSDevTool/Views/ElementInfoView.xaml.cs
Normal file
17
MSDevTool/Views/ElementInfoView.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Windows;
|
||||
|
||||
|
||||
namespace MSDevTool.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ElementInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ElementInfoView : Window
|
||||
{
|
||||
public ElementInfoView(ElementInfoViewModel vm)
|
||||
{
|
||||
DataContext = vm;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
102
MSDevTool/Views/ObjectView.xaml
Normal file
102
MSDevTool/Views/ObjectView.xaml
Normal file
@@ -0,0 +1,102 @@
|
||||
<Window
|
||||
x:Class="MSDevTool.Views.ObjectView"
|
||||
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:MSDevTool"
|
||||
xmlns:vm="clr-namespace:MSDevTool.ViewModels"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:conv="clr-namespace:MSDevTool.Converters"
|
||||
xmlns:attach="clr-namespace:MSDevTool.Attached"
|
||||
Title="对象窗口"
|
||||
Width="400"
|
||||
Height="800"
|
||||
MaxHeight="800"
|
||||
d:DataContext="{d:DesignInstance Type=vm:ObjectViewModel}"
|
||||
SizeToContent="Height"
|
||||
Topmost="True"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<conv:TypeValueConverter x:Key="TypeValueConverter" />
|
||||
<conv:TypeConverter x:Key="TypeConverter" />
|
||||
<conv:NullToStringConverter x:Key="NullToStringConverter" />
|
||||
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander Header="{Binding Name}" IsExpanded="False">
|
||||
<ItemsPresenter />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="CellStyle" TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<!-- 当值为整数类型时 -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:Int32}">
|
||||
<Setter Property="Foreground" Value="OrangeRed" />
|
||||
</DataTrigger>
|
||||
<!-- 当值为字符串类型时 -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:String}">
|
||||
<Setter Property="Foreground" Value="DarkGreen" />
|
||||
</DataTrigger>
|
||||
<!-- 当值为布尔类型时 -->
|
||||
<DataTrigger Binding="{Binding Converter={StaticResource TypeConverter}}" Value="{x:Type sys:Boolean}">
|
||||
<Setter Property="Foreground" Value="DarkBlue" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<DataGrid
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding PropValues}"
|
||||
SelectionUnit="FullRow">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="MouseDoubleClick">
|
||||
<b:InvokeCommandAction Command="{Binding ShowObjectCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />
|
||||
</b:EventTrigger>
|
||||
</b:Interaction.Triggers>
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="attach:ObjectType.IsMatchObject">
|
||||
<Setter.Value>
|
||||
<!-- Self=单元格 Path="Content.Text" Content是TextBlock -->
|
||||
<Binding Converter="{StaticResource TypeValueConverter}" RelativeSource="{RelativeSource Self}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="attach:ObjectType.IsMatchObject" Value="True">
|
||||
<!--<Setter Property="Foreground" Value="LightGreen" />-->
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="Auto"
|
||||
Binding="{Binding PropName}"
|
||||
Header="类属性名" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding PropValue, Converter={StaticResource NullToStringConverter}}"
|
||||
CellStyle="{StaticResource CellStyle}"
|
||||
Header="属性值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding DataType}"
|
||||
Header="数据类型" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
17
MSDevTool/Views/ObjectView.xaml.cs
Normal file
17
MSDevTool/Views/ObjectView.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Windows;
|
||||
|
||||
|
||||
namespace MSDevTool.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ObjectView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ObjectView : Window
|
||||
{
|
||||
public ObjectView(ObjectViewModel viewModel)
|
||||
{
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
MSDevTool/Views/SelectByElementId.xaml
Normal file
24
MSDevTool/Views/SelectByElementId.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<Window x:Class="MSDevTool.Views.SelectByElementId"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
SizeToContent="Height"
|
||||
Title="按Id选择元素" Width="300">
|
||||
<Grid >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="5" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="元素ID:" Grid.Column="0"/>
|
||||
<TextBox x:Name="TbElementId" Grid.Column="1" ToolTip="多个id请使用英文逗号分隔"/>
|
||||
</Grid>
|
||||
<Button Margin="5" Content="选择" Grid.Row="1" Click="Button_Click" />
|
||||
</Grid>
|
||||
</Window>
|
||||
55
MSDevTool/Views/SelectByElementId.xaml.cs
Normal file
55
MSDevTool/Views/SelectByElementId.xaml.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
using Bentley.DgnPlatformNET;
|
||||
using Bentley.MstnPlatformNET;
|
||||
|
||||
namespace MSDevTool.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SelectByElementId.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SelectByElementId : Window
|
||||
{
|
||||
public SelectByElementId()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dgnModel = Session.Instance.GetActiveDgnModel();
|
||||
var splitStrs = TbElementId.Text.Split(',', ' ', ',', ';', ';');
|
||||
if (splitStrs.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//ElementAgenda agenda = new ElementAgenda();//声明元素容器
|
||||
//agenda.Empty(true);
|
||||
SelectionSetManager.EmptyAll();
|
||||
foreach (var item in splitStrs)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
var elementId = long.Parse(item);
|
||||
var element = dgnModel.FindElementById(new ElementId(ref elementId));
|
||||
//if (element != null)
|
||||
//{
|
||||
// agenda.Insert(element, true);//将元素插入容器
|
||||
//}
|
||||
SelectionSetManager.AddElement(element, dgnModel);//将元素容器添加到选择集
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//SelectionSetManager.BuildAgenda(ref agenda);//从当前选择集中获得元素
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user