添加S7后台服务和添加PLC所需要的属性
This commit is contained in:
@@ -97,7 +97,38 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<!-- 通讯协议-->
|
||||
|
||||
<!-- S7 Specific Properties -->
|
||||
<StackPanel x:Name="S7PropertiesPanel" Visibility="Visible" Background="LightGray">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="StackPanel">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Device.ProtocolType}"
|
||||
Value="{x:Static en:ProtocolType.S7}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<!-- CpuType -->
|
||||
<TextBlock Text="CPU 类型"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource TextBlockSubTitle}" />
|
||||
<ComboBox SelectedItem="{Binding Device.CpuType}"
|
||||
ItemsSource="{Binding CpuTypes}" />
|
||||
|
||||
<!-- Rack -->
|
||||
<TextBlock Text="机架号"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox Text="{Binding Device.Rack, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<!-- Slot -->
|
||||
<TextBlock Text="槽号"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource TextBlockSubTitle}" />
|
||||
<TextBox Text="{Binding Device.Slot, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox FontSize="16"
|
||||
Content="是否启用"
|
||||
|
||||
@@ -2,15 +2,28 @@
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using PMSWPF.Models;
|
||||
using PMSWPF.ViewModels.Dialogs;
|
||||
using NLog; // Add NLog using directive
|
||||
|
||||
namespace PMSWPF.Views.Dialogs;
|
||||
|
||||
public partial class DeviceDialog
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); // Add Logger
|
||||
|
||||
public DeviceDialog(DeviceDialogViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
|
||||
// Log the ProtocolType value
|
||||
if (viewModel.Device != null)
|
||||
{
|
||||
Logger.Info($"DeviceDialog opened. Device ProtocolType: {viewModel.Device.ProtocolType}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("DeviceDialog opened. Device is null.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user