2025-07-19 11:11:01 +08:00
|
|
|
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.ImportExcelDialog"
|
2025-07-04 13:41:50 +08:00
|
|
|
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"
|
|
|
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
2025-08-22 20:24:09 +08:00
|
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
2025-07-26 10:05:43 +08:00
|
|
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
2025-07-04 13:41:50 +08:00
|
|
|
Title="从Excel导入"
|
|
|
|
|
CloseButtonText="取消"
|
|
|
|
|
DefaultButton="Primary"
|
2025-08-22 20:24:09 +08:00
|
|
|
PrimaryButtonText="导入全部"
|
|
|
|
|
SecondaryButtonText="导入选择"
|
|
|
|
|
|
2025-07-04 13:41:50 +08:00
|
|
|
d:DataContext="{d:DesignInstance vmd:ImportExcelDialogViewModel}"
|
|
|
|
|
mc:Ignorable="d"
|
|
|
|
|
AllowDrop="True"
|
|
|
|
|
DragEnter="Dialog_DragEnter"
|
|
|
|
|
Drop="Dialog_Drop">
|
|
|
|
|
|
2025-08-22 20:24:09 +08:00
|
|
|
<i:Interaction.Triggers>
|
|
|
|
|
<i:EventTrigger EventName="PrimaryButtonClick">
|
|
|
|
|
<i:InvokeCommandAction Command="{Binding PrimaryButtonCommand}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
<i:EventTrigger EventName="SecondaryButtonClick">
|
|
|
|
|
<i:InvokeCommandAction Command="{Binding SecondaryButtonCommand}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
<i:EventTrigger EventName="CloseButtonClick">
|
|
|
|
|
<i:InvokeCommandAction Command="{Binding CancleButtonCommand}" />
|
|
|
|
|
</i:EventTrigger>
|
|
|
|
|
</i:Interaction.Triggers>
|
|
|
|
|
|
2025-07-04 13:41:50 +08:00
|
|
|
<Grid Margin="10">
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
|
|
<StackPanel Grid.Row="0">
|
|
|
|
|
<TextBlock HorizontalAlignment="Center"
|
|
|
|
|
Text="拖放Excel文件到此处或选择文件" />
|
|
|
|
|
<Grid Margin="0,10,0,0">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<TextBox Grid.Column="0"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Text="{Binding FilePath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
|
<Button Grid.Column="1"
|
|
|
|
|
Margin="5,0,0,0"
|
|
|
|
|
Click="SelectFile_Click"
|
|
|
|
|
Content="选择文件" />
|
|
|
|
|
</Grid>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<DataGrid Grid.Row="1"
|
|
|
|
|
Margin="0,10,0,0"
|
2025-07-17 20:13:21 +08:00
|
|
|
ItemsSource="{Binding Variables}"
|
2025-07-04 13:41:50 +08:00
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
CanUserAddRows="False">
|
2025-07-09 20:17:22 +08:00
|
|
|
<DataGrid.Style>
|
|
|
|
|
<Style BasedOn="{StaticResource {x:Type DataGrid}}"
|
|
|
|
|
TargetType="DataGrid">
|
|
|
|
|
<Style.Triggers>
|
2025-07-17 20:13:21 +08:00
|
|
|
<DataTrigger Binding="{Binding Variables.Count}"
|
2025-07-09 20:17:22 +08:00
|
|
|
Value="0">
|
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
|
Value="Collapsed" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</DataGrid.Style>
|
2025-07-04 13:41:50 +08:00
|
|
|
<DataGrid.Columns>
|
2025-07-09 20:17:22 +08:00
|
|
|
<DataGridTextColumn Header="名称"
|
|
|
|
|
Binding="{Binding Name}" />
|
|
|
|
|
<DataGridTextColumn Header="数据类型"
|
2025-07-27 21:08:58 +08:00
|
|
|
Binding="{Binding SignalType}" />
|
2025-07-09 20:17:22 +08:00
|
|
|
<DataGridTextColumn Header="S7地址"
|
|
|
|
|
Binding="{Binding S7Address}" />
|
2025-07-04 13:41:50 +08:00
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</ui:ContentDialog>
|