CommunicationAddOrEditView.xaml 4.43 KB
<Window
    x:Class="HHECS.RobotTool.View.CommunicationView.CommunicationAddOrEditView"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:HHECS.RobotTool.View.CommunicationView"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:HHECS.RobotTool.ViewModel.CommunicationVM"
    Title="新增通讯配置"
    Width="290"
    Height="315"
    d:DataContext="{d:DesignInstance Type=viewmodel:CommunicationAddOrEditVM}"
    ResizeMode="NoResize"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <hc:UniformSpacingPanel
            Grid.Row="0"
            Margin="5"
            HorizontalAlignment="Center"
            Orientation="Vertical"
            Spacing="5">

            <TextBox
                MinWidth="260"
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="编号"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding CommunicationConfig.Code, UpdateSourceTrigger=PropertyChanged}" />

            <TextBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="名称"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding CommunicationConfig.Name, UpdateSourceTrigger=PropertyChanged}" />

            <ComboBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="通讯方式"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                DisplayMemberPath="Key"
                ItemsSource="{Binding CommunicationTypes}"
                SelectedValue="{Binding CommunicationConfig.CommunicationType}"
                SelectedValuePath="Value"
                Style="{StaticResource ComboBoxExtend}" />

            <TextBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="IP地址"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding CommunicationConfig.IpAddress, UpdateSourceTrigger=PropertyChanged}" />

            <TextBox
                hc:InfoElement.Title="端口号"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding CommunicationConfig.Port, UpdateSourceTrigger=PropertyChanged}" />

            <ComboBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="是否启用"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                SelectedValue="{Binding CommunicationConfig.Disable, UpdateSourceTrigger=PropertyChanged}"
                SelectedValuePath="Tag"
                Style="{StaticResource ComboBoxExtend}">
                <ComboBoxItem Content="启用" Tag="False" />
                <ComboBoxItem Content="禁用" Tag="True" />
            </ComboBox>
            <TextBox
                hc:InfoElement.Title="备注"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding CommunicationConfig.Remark, UpdateSourceTrigger=PropertyChanged}" />
        </hc:UniformSpacingPanel>

        <hc:UniformSpacingPanel
            Grid.Row="1"
            HorizontalAlignment="Center"
            Spacing="60">
            <Button
                Command="{Binding SaveCommand}"
                Content="保存"
                Style="{StaticResource ButtonPrimary}" />
            <Button
                Command="{Binding CancelCommand}"
                Content="取消"
                Style="{StaticResource ButtonDefault}" />
        </hc:UniformSpacingPanel>
    </Grid>
</Window>