EquipmentAddOrEditView.xaml 5.36 KB
<Window
    x:Class="HHECS.RobotTool.View.EquipmentView.EquipmentAddOrEditView"
    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.ViewModel.EquipmentVM"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:HHECS.RobotTool.ViewModel.EquipmentVM"
    Title="新增设备"
    Width="290"
    Height="380"
    d:DataContext="{d:DesignInstance Type=viewmodel:EquipmentAddOrEditVM}"
    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 Equipment.Code, UpdateSourceTrigger=PropertyChanged}" />

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

            <ComboBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="设备类型"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                DisplayMemberPath="Value"
                IsEnabled="{Binding CbxIsEnable}"
                ItemsSource="{Binding EquipmentTypes}"
                SelectedValue="{Binding Equipment.EquipmentTypeId}"
                SelectedValuePath="Key"
                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 Equipment.IP, UpdateSourceTrigger=PropertyChanged}" />

            <TextBox
                hc:InfoElement.Title="连接名称"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding Equipment.ConnectName, UpdateSourceTrigger=PropertyChanged}" />
            <ComboBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="默认参数"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                DisplayMemberPath="Value"
                ItemsSource="{Binding RobotConfigs}"
                SelectedValue="{Binding Equipment.RobotConfigId, UpdateSourceTrigger=PropertyChanged}"
                SelectedValuePath="Key"
                Style="{StaticResource ComboBoxExtend}" />
            <ComboBox
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="是否启用"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                SelectedValue="{Binding Equipment.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 Equipment.DestinationArea, UpdateSourceTrigger=PropertyChanged}" />

            <TextBox
                hc:InfoElement.Title="描述"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding Equipment.Description, UpdateSourceTrigger=PropertyChanged}" />
        </hc:UniformSpacingPanel>

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