Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

MainPage.xaml 11 KiB

il y a 6 ans
il y a 7 ans
il y a 6 ans
il y a 6 ans
il y a 7 ans
il y a 6 ans
il y a 6 ans
il y a 6 ans
il y a 6 ans
il y a 6 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <Page
  2. x:Class="MQTTnet.TestApp.UniversalWindows.MainPage"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7. xmlns:server="using:MQTTnet.Server"
  8. xmlns:interop="using:Windows.UI.Xaml.Interop"
  9. d:DesignHeight="800"
  10. d:DesignWidth="800"
  11. mc:Ignorable="d">
  12. <Grid Margin="10">
  13. <Grid.RowDefinitions>
  14. <RowDefinition Height="Auto" />
  15. <RowDefinition Height="*" />
  16. </Grid.RowDefinitions>
  17. <Pivot Grid.Row="0">
  18. <PivotItem Header="Connection">
  19. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  20. <TextBlock>Server:</TextBlock>
  21. <TextBox x:Name="Server"></TextBox>
  22. <TextBlock>Port:</TextBlock>
  23. <TextBox x:Name="Port" Text="1883"></TextBox>
  24. <TextBlock>User:</TextBlock>
  25. <TextBox x:Name="User"></TextBox>
  26. <TextBlock>Password:</TextBlock>
  27. <TextBox x:Name="Password"></TextBox>
  28. <TextBlock>ClientId:</TextBlock>
  29. <TextBox x:Name="ClientId"></TextBox>
  30. <TextBlock>Clean session:</TextBlock>
  31. <CheckBox x:Name="CleanSession" IsChecked="True"></CheckBox>
  32. <TextBlock>Keep alive interval:</TextBlock>
  33. <TextBox x:Name="KeepAliveInterval" Text="5"></TextBox>
  34. <StackPanel Orientation="Horizontal">
  35. <RadioButton x:Name="UseTcp" IsChecked="True" GroupName="connection">TCP</RadioButton>
  36. <RadioButton x:Name="UseWs" GroupName="connection">WS</RadioButton>
  37. <CheckBox x:Name="UseTls">Use TLS</CheckBox>
  38. </StackPanel>
  39. <StackPanel Orientation="Horizontal">
  40. <Button Click="Connect" Width="120" Margin="0,0,10,0">Connect</Button>
  41. <Button Click="Disconnect" Width="120">Disconnect</Button>
  42. </StackPanel>
  43. </StackPanel>
  44. </PivotItem>
  45. <PivotItem Header="Publish">
  46. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  47. <TextBlock>Topic:</TextBlock>
  48. <TextBox x:Name="Topic"></TextBox>
  49. <TextBlock>Payload:</TextBlock>
  50. <TextBox x:Name="Payload"></TextBox>
  51. <StackPanel Orientation="Horizontal">
  52. <RadioButton x:Name="Text" IsChecked="True" GroupName="payload">Text</RadioButton>
  53. <RadioButton x:Name="Base64" GroupName="payload">Base64</RadioButton>
  54. </StackPanel>
  55. <TextBlock>Retain:</TextBlock>
  56. <CheckBox x:Name="Retain"></CheckBox>
  57. <TextBlock>QoS:</TextBlock>
  58. <StackPanel Orientation="Horizontal">
  59. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
  60. <RadioButton Margin="0,0,10,0" x:Name="QoS1" GroupName="qos">1 (At least once)</RadioButton>
  61. <RadioButton Margin="0,0,10,0" x:Name="QoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  62. </StackPanel>
  63. <Button Click="Publish" Width="120">Publish</Button>
  64. </StackPanel>
  65. </PivotItem>
  66. <PivotItem Header="Execute RPC">
  67. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  68. <TextBlock>Method:</TextBlock>
  69. <TextBox x:Name="RpcMethod"></TextBox>
  70. <TextBlock>Payload:</TextBlock>
  71. <TextBox x:Name="RpcPayload"></TextBox>
  72. <StackPanel Orientation="Horizontal">
  73. <RadioButton x:Name="RpcText" IsChecked="True" GroupName="payload">Text</RadioButton>
  74. <RadioButton x:Name="RpcBase64" GroupName="payload">Base64</RadioButton>
  75. </StackPanel>
  76. <TextBlock>QoS:</TextBlock>
  77. <StackPanel Orientation="Horizontal">
  78. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS0" GroupName="qos" IsChecked="True">0 (At most once)</RadioButton>
  79. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS1" GroupName="qos">1 (At least once)</RadioButton>
  80. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  81. </StackPanel>
  82. <TextBlock>Responses:</TextBlock>
  83. <ListBox MinHeight="50" MaxHeight="250" x:Name="RpcResponses" Margin="0,0,0,10">
  84. <ListBox.ItemTemplate>
  85. <DataTemplate>
  86. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  87. </DataTemplate>
  88. </ListBox.ItemTemplate>
  89. </ListBox>
  90. <StackPanel Orientation="Horizontal">
  91. <Button Click="ExecuteRpc" Width="120" Margin="0,0,10,0">Execute</Button>
  92. <Button Click="ClearRpcResponses" Width="200">Clear responses</Button>
  93. </StackPanel>
  94. </StackPanel>
  95. </PivotItem>
  96. <PivotItem Header="Subscribe">
  97. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  98. <TextBlock>Topic:</TextBlock>
  99. <TextBox x:Name="SubscribeTopic"></TextBox>
  100. <TextBlock>QoS:</TextBlock>
  101. <StackPanel Orientation="Horizontal">
  102. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
  103. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS1" GroupName="sqos">1 (At least once)</RadioButton>
  104. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS2" GroupName="sqos">2 (Exactly once)</RadioButton>
  105. </StackPanel>
  106. <TextBlock>Received messages:</TextBlock>
  107. <CheckBox x:Name="AddReceivedMessagesToList" IsChecked="True">Add received messages to list</CheckBox>
  108. <ListBox MinHeight="50" MaxHeight="250" x:Name="ReceivedMessages" Margin="0,0,0,10">
  109. <ListBox.ItemTemplate>
  110. <DataTemplate>
  111. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  112. </DataTemplate>
  113. </ListBox.ItemTemplate>
  114. </ListBox>
  115. <StackPanel Orientation="Horizontal">
  116. <Button Click="Subscribe" Width="120" Margin="0,0,10,0">Subscribe</Button>
  117. <Button Click="Unsubscribe" Width="120" Margin="0,0,10,0">Unsubscribe</Button>
  118. <Button Click="ClearReceivedMessages" Width="200">Clear received messages</Button>
  119. </StackPanel>
  120. </StackPanel>
  121. </PivotItem>
  122. <PivotItem Header="Server">
  123. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  124. <TextBlock>Port:</TextBlock>
  125. <TextBox x:Name="ServerPort" Text="1883"></TextBox>
  126. <CheckBox x:Name="ServerPersistRetainedMessages" IsChecked="True">Persist retained messages in JSON format</CheckBox>
  127. <CheckBox x:Name="ServerClearRetainedMessages">Clear previously retained messages on startup</CheckBox>
  128. <CheckBox x:Name="ServerAllowPersistentSessions">Allow persistent sessions</CheckBox>
  129. <StackPanel Orientation="Horizontal">
  130. <Button Width="120" Margin="0,0,10,0" Click="StartServer">Start</Button>
  131. <Button Width="120" Margin="0,0,10,0" Click="StopServer">Stop</Button>
  132. </StackPanel>
  133. </StackPanel>
  134. </PivotItem>
  135. <PivotItem Header="Sessions">
  136. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  137. <StackPanel Orientation="Horizontal">
  138. <Button Width="120" Margin="0,0,10,0" Click="RefreshSessions">Refresh</Button>
  139. <Button Width="120" Margin="0,0,10,0" Click="ClearSessions">Clear</Button>
  140. </StackPanel>
  141. <ListView ItemsSource="{Binding}" x:Name="ListViewSessions">
  142. <ListView.ItemTemplate>
  143. <DataTemplate x:DataType="server:IMqttClientSessionStatus">
  144. <StackPanel Orientation="Horizontal">
  145. <StackPanel.Resources>
  146. <Style TargetType="TextBlock">
  147. <Setter Property="Margin" Value="0,0,10,0"></Setter>
  148. </Style>
  149. </StackPanel.Resources>
  150. <TextBlock Text="{Binding ClientId}"></TextBlock>
  151. <TextBlock Text="{Binding Endpoint}"></TextBlock>
  152. <TextBlock Text="{Binding IsConnected}"></TextBlock>
  153. <TextBlock Text="{Binding LastPacketReceived}"></TextBlock>
  154. <TextBlock Text="{Binding LastNonKeepAlivePacketReceived}"></TextBlock>
  155. <TextBlock Text="{Binding ProtocolVersion}"></TextBlock>
  156. <TextBlock Text="{Binding PendingApplicationMessagesCount}"></TextBlock>
  157. </StackPanel>
  158. </DataTemplate>
  159. </ListView.ItemTemplate>
  160. </ListView>
  161. </StackPanel>
  162. </PivotItem>
  163. <PivotItem Header="Log">
  164. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  165. <Button Click="ClearLog" Width="120">Clear</Button>
  166. </StackPanel>
  167. </PivotItem>
  168. </Pivot>
  169. <ScrollViewer Grid.Row="1" Margin="12,10,12,0" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
  170. <TextBlock x:Name="Trace" FontSize="11"></TextBlock>
  171. </ScrollViewer>
  172. </Grid>
  173. </Page>