127 lines
7.1 KiB
XML
127 lines
7.1 KiB
XML
<mah:MetroWindow x:Class="BDU.Windows.DeviceSettingWindow"
|
|
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
|
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:local="clr-namespace:BDU.Windows"
|
|
mc:Ignorable="d"
|
|
d:DataContext="{d:DesignInstance Type=local:DeviceSettingWindow}"
|
|
WindowStyle="None"
|
|
WindowStartupLocation="CenterScreen"
|
|
ShowTitleBar="False"
|
|
Title="ParameterSettingWindow"
|
|
Height="500"
|
|
Width="450">
|
|
<Grid>
|
|
<GroupBox Header="设备编辑界面"
|
|
Padding="10,15,10,0"
|
|
MouseLeftButtonDown="GroupBox_MouseLeftButtonDown">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition />
|
|
<RowDefinition Height="auto" />
|
|
</Grid.RowDefinitions>
|
|
<ScrollViewer>
|
|
<StackPanel>
|
|
<StackPanel Height="30"
|
|
Visibility="{Binding Device.ErrorMessage, Converter={StaticResource StringToVisibilityConverter}}"
|
|
Orientation="Horizontal"
|
|
Margin="7,7,0,7">
|
|
<TextBlock Text="{Binding Device.ErrorMessage}"
|
|
Padding="0,11"
|
|
Height="30"
|
|
Foreground="Red" />
|
|
</StackPanel>
|
|
<StackPanel Height="30"
|
|
Orientation="Horizontal"
|
|
Margin="7">
|
|
<Label Content="设备名称"
|
|
VerticalAlignment="Bottom"
|
|
Width="85" />
|
|
<TextBox Text="{Binding Device.Name}"
|
|
Visibility="{Binding IsInputMode}"
|
|
VerticalAlignment="Bottom"
|
|
Width="120" />
|
|
<ComboBox ItemsSource="{Binding PreSelectDevices}"
|
|
SelectedItem="{Binding SelectedPreDefineDevice}"
|
|
DisplayMemberPath="Name"
|
|
Visibility="{Binding ShowComboBox}"
|
|
VerticalAlignment="Bottom"
|
|
Width="120" />
|
|
<CheckBox IsChecked="{Binding IsSelectMode}"
|
|
Margin="10,0,0,0"
|
|
VerticalAlignment="Center" />
|
|
<Label Content="从预设中选择"
|
|
VerticalAlignment="Bottom"
|
|
Width="85" />
|
|
</StackPanel>
|
|
<StackPanel Height="30"
|
|
Orientation="Horizontal"
|
|
Margin="7">
|
|
<Label Content="通讯协议类型"
|
|
VerticalAlignment="Bottom"
|
|
Width="85" />
|
|
<ComboBox ItemsSource="{Binding Types}"
|
|
SelectedItem="{Binding Device.Type}"
|
|
VerticalAlignment="Bottom"
|
|
Width="120"
|
|
SelectionChanged="ComboBox_SelectionChanged"
|
|
IsEnabled="{Binding IsAdd}" />
|
|
</StackPanel>
|
|
<StackPanel Height="30"
|
|
Orientation="Horizontal"
|
|
Margin="7">
|
|
<Label Content="设备描述"
|
|
Width="85"
|
|
VerticalAlignment="Bottom" />
|
|
<TextBox Text="{Binding Device.Description}"
|
|
VerticalAlignment="Bottom"
|
|
Width="120" />
|
|
</StackPanel>
|
|
<Label Content="连接参数"
|
|
Height="30"
|
|
Margin="7"
|
|
VerticalContentAlignment="Bottom" />
|
|
<ItemsControl ItemsSource="{Binding DeviceConnectSettings}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal"
|
|
Height="30"
|
|
Margin="0,7">
|
|
<Label Content="{Binding Name}"
|
|
Width="50"
|
|
Margin="40,0,4,0"
|
|
VerticalContentAlignment="Bottom" />
|
|
<TextBox VerticalAlignment="Bottom"
|
|
Visibility="{Binding Name, Converter={StaticResource DeviceNameConverter}}"
|
|
Text="{Binding Value}"
|
|
Width="120" />
|
|
<ComboBox VerticalAlignment="Bottom"
|
|
Visibility="{Binding Name, Converter={StaticResource DeviceNameConverter}, ConverterParameter=Inverse}"
|
|
ItemsSource="{Binding Name, Converter={StaticResource DeviceNameConverter}, ConverterParameter=Items}"
|
|
SelectedItem="{Binding Value}"
|
|
Width="120" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
<StackPanel Grid.Row="1"
|
|
Orientation="Horizontal"
|
|
FlowDirection="RightToLeft"
|
|
Margin="5,10,5,15">
|
|
<Button Content="取消"
|
|
Width="70"
|
|
Click="Cancel_Click" />
|
|
<Button Content="保存"
|
|
Width="70"
|
|
Margin="20,0"
|
|
Click="Save_Click" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</GroupBox>
|
|
</Grid>
|
|
</mah:MetroWindow>
|