S7ReadlView.xaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <UserControl x:Class="S7NetModule.Views.S7ReadlView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:S7NetModule.Views"
  7. mc:Ignorable="d"
  8. xmlns:prism="http://prismlibrary.com/"
  9. prism:ViewModelLocator.AutoWireViewModel="True"
  10. d:DesignHeight="450"
  11. d:DesignWidth="300">
  12. <UserControl.Resources>
  13. <Style x:Key="TextBlackStyle"
  14. TargetType="TextBlock">
  15. <Setter Property="FontSize"
  16. Value="15" />
  17. <Setter Property="Foreground"
  18. Value="White" />
  19. <Setter Property="Margin"
  20. Value="0,0,15,0" />
  21. <Setter Property="TextAlignment"
  22. Value="Right" />
  23. <Setter Property="Width"
  24. Value="80" />
  25. </Style>
  26. </UserControl.Resources>
  27. <Border>
  28. <Grid>
  29. <Grid.RowDefinitions>
  30. <RowDefinition Height="50" />
  31. <RowDefinition Height="50" />
  32. <RowDefinition Height="50" />
  33. <RowDefinition Height="50" />
  34. <RowDefinition Height="50" />
  35. <RowDefinition Height="50" />
  36. <RowDefinition Height="50" />
  37. <RowDefinition />
  38. </Grid.RowDefinitions>
  39. <!-- DB号 -->
  40. <StackPanel Orientation="Horizontal"
  41. VerticalAlignment="Center"
  42. Grid.Row="0">
  43. <TextBlock Text="DB号:"
  44. Style="{ StaticResource TextBlackStyle}" />
  45. <TextBox Width="150"
  46. Name="ip"
  47. Text="{Binding Read_Model.Db}" />
  48. </StackPanel>
  49. <!-- 数据类型 -->
  50. <StackPanel Orientation="Horizontal"
  51. VerticalAlignment="Center"
  52. Grid.Row="1">
  53. <TextBlock Text="数据类型:"
  54. Style="{ StaticResource TextBlackStyle}" />
  55. <ComboBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  56. ItemsSource="{Binding DataTypes}"
  57. Text="{Binding Read_Model.VarType}" />
  58. </StackPanel>
  59. <!-- 起始地址 -->
  60. <StackPanel Orientation="Horizontal"
  61. VerticalAlignment="Center"
  62. Grid.Row="2">
  63. <TextBlock Text="起始地址:"
  64. Style="{ StaticResource TextBlackStyle}" />
  65. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  66. Text="{Binding Read_Model.StartByteAdr}" />
  67. </StackPanel>
  68. <!-- 数据个数 -->
  69. <StackPanel Orientation="Horizontal"
  70. VerticalAlignment="Center"
  71. Grid.Row="3">
  72. <TextBlock Text="数据个数:"
  73. Style="{ StaticResource TextBlackStyle}" />
  74. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  75. Text="{Binding Read_Model.VarCount}" />
  76. </StackPanel>
  77. <!-- bit位 -->
  78. <StackPanel Orientation="Horizontal"
  79. VerticalAlignment="Center"
  80. Grid.Row="4">
  81. <TextBlock Text="bit位:"
  82. Style="{ StaticResource TextBlackStyle}" />
  83. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  84. Text="{Binding Read_Model.BitAdr}" />
  85. </StackPanel>
  86. <!-- 数据类型 -->
  87. <StackPanel Orientation="Horizontal"
  88. VerticalAlignment="Center"
  89. Grid.Row="5">
  90. <TextBlock Text="结果比对:"
  91. Style="{ StaticResource TextBlackStyle}" />
  92. <ComboBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  93. ItemsSource="{Binding Res_Pass}"
  94. SelectedItem ="{Binding Read_Model.RefPass}" />
  95. </StackPanel>
  96. <StackPanel Orientation="Horizontal"
  97. Width="{Binding ElementName=ip,Path=ActualWidth}"
  98. VerticalAlignment="Center"
  99. HorizontalAlignment="Right"
  100. Grid.Row="6">
  101. <Button Content="读取"
  102. Width="100"
  103. Height="50"
  104. Command="{Binding S7Readcommand}"
  105. Style="{StaticResource HomeControlButtonStyle}" />
  106. </StackPanel>
  107. <StackPanel Orientation="Horizontal"
  108. VerticalAlignment="Center"
  109. HorizontalAlignment="Center"
  110. Grid.Row="7">
  111. <RichTextBox Width="{Binding ElementName=ip,Path=ActualWidth}">
  112. <FlowDocument>
  113. <Paragraph>
  114. <Run Text="{Binding OutMsg}" />
  115. </Paragraph>
  116. </FlowDocument>
  117. </RichTextBox>
  118. </StackPanel>
  119. </Grid>
  120. </Border>
  121. </UserControl>