Files
DMS/Views/DevicesView.xaml

96 lines
4.2 KiB
Plaintext
Raw Normal View History

2025-06-10 20:55:39 +08:00
<UserControl x:Class="PMSWPF.Views.DevicesView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:vm="clr-namespace:PMSWPF.ViewModels"
d:DataContext="{d:DesignInstance vm:DevicesViewModel}"
2025-06-10 20:55:39 +08:00
mc:Ignorable="d"
2025-07-01 21:34:20 +08:00
d:DesignHeight="300"
d:DesignWidth="300">
2025-06-22 21:00:06 +08:00
<UserControl.Resources>
<DataTemplate x:Key="DeviceItemTemplate">
2025-07-01 21:34:20 +08:00
<Border Background="#eee"
CornerRadius="10"
Margin="3"
Padding="10">
<ikw:SimpleStackPanel Spacing="10"
Width="300"
Height="200">
<DockPanel>
2025-07-01 21:34:20 +08:00
<ui:ToggleSwitch DockPanel.Dock="Right"
Margin="20 0 0 0 "
IsOn="{Binding IsFirstLoad}"
2025-07-01 21:34:20 +08:00
OffContent="停止"
OnContent="启动" />
<TextBlock FontSize="24"
FontWeight="Bold"
Text="{Binding Name }" />
2025-06-22 21:00:06 +08:00
</DockPanel>
2025-06-22 21:00:06 +08:00
<TextBlock Text="{Binding Description }" />
<TextBlock Text="{Binding Ip }" />
<ListBox ItemsSource="{Binding VariableTables }">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
2025-06-22 21:00:06 +08:00
</ListBox>
</ikw:SimpleStackPanel>
</Border>
2025-06-22 21:00:06 +08:00
</DataTemplate>
</UserControl.Resources>
<StackPanel>
2025-07-01 21:34:20 +08:00
<!-- 操作菜单栏 -->
<ui:CommandBar DefaultLabelPosition="Right"
IsOpen="False">
<!-- 添加设备 -->
<ui:AppBarButton Command="{Binding AddDeviceCommand}"
Label="添加设备">
2025-06-22 21:00:06 +08:00
<ui:AppBarButton.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
2025-06-22 21:00:06 +08:00
</ui:AppBarButton.Icon>
</ui:AppBarButton>
2025-07-01 21:34:20 +08:00
<!-- 编辑设备 -->
<ui:AppBarButton Command="{Binding EditDeviceCommand}"
Label="编辑设备">
2025-06-22 21:00:06 +08:00
<ui:AppBarButton.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
2025-06-22 21:00:06 +08:00
</ui:AppBarButton.Icon>
2025-07-01 21:34:20 +08:00
</ui:AppBarButton>
<!-- 编辑设备 -->
<ui:AppBarButton Command="{Binding DeleteDeviceCommand}"
Label="删除设备">
<ui:AppBarButton.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Delete}" />
</ui:AppBarButton.Icon>
2025-06-22 21:00:06 +08:00
</ui:AppBarButton>
<ui:AppBarButton x:Name="ShareButton"
Label="Share">
2025-06-22 21:00:06 +08:00
<ui:AppBarButton.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
2025-06-22 21:00:06 +08:00
</ui:AppBarButton.Icon>
</ui:AppBarButton>
<ui:CommandBar.SecondaryCommands>
<ui:AppBarButton x:Name="SettingsButton"
2025-07-01 21:34:20 +08:00
Icon="Setting"
Label="Settings" />
2025-06-22 21:00:06 +08:00
</ui:CommandBar.SecondaryCommands>
</ui:CommandBar>
<ui:GridView x:Name="BasicGridView"
Margin="20"
IsItemClickEnabled="True"
2025-07-01 21:34:20 +08:00
SelectedItem="{Binding SelectedDevice }"
ItemsSource="{Binding Devices}"
ItemTemplate="{StaticResource DeviceItemTemplate}"
SelectionMode="Single" />
2025-06-10 22:13:06 +08:00
</StackPanel>
</UserControl>