No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

MainPage.xaml 8.8 KiB

hace 7 años
hace 7 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. d:DesignHeight="800"
  8. d:DesignWidth="800"
  9. mc:Ignorable="d">
  10. <Grid Margin="10">
  11. <Grid.RowDefinitions>
  12. <RowDefinition Height="Auto" />
  13. <RowDefinition Height="*" />
  14. </Grid.RowDefinitions>
  15. <Pivot Grid.Row="0">
  16. <PivotItem Header="Connection">
  17. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  18. <TextBlock>Server:</TextBlock>
  19. <TextBox x:Name="Server"></TextBox>
  20. <TextBlock>Port:</TextBlock>
  21. <TextBox x:Name="Port" Text="1883"></TextBox>
  22. <TextBlock>User:</TextBlock>
  23. <TextBox x:Name="User"></TextBox>
  24. <TextBlock>Password:</TextBlock>
  25. <TextBox x:Name="Password"></TextBox>
  26. <TextBlock>ClientId:</TextBlock>
  27. <TextBox x:Name="ClientId"></TextBox>
  28. <TextBlock>Clean session:</TextBlock>
  29. <CheckBox x:Name="CleanSession" IsChecked="True"></CheckBox>
  30. <TextBlock>Keep alive interval:</TextBlock>
  31. <TextBox x:Name="KeepAliveInterval" Text="5"></TextBox>
  32. <StackPanel Orientation="Horizontal">
  33. <RadioButton x:Name="UseTcp" IsChecked="True" GroupName="connection">TCP</RadioButton>
  34. <RadioButton x:Name="UseWs" GroupName="connection">WS</RadioButton>
  35. <CheckBox x:Name="UseTls">Use TLS</CheckBox>
  36. </StackPanel>
  37. <StackPanel Orientation="Horizontal">
  38. <Button Click="Connect" Width="120" Margin="0,0,10,0">Connect</Button>
  39. <Button Click="Disconnect" Width="120">Disconnect</Button>
  40. </StackPanel>
  41. </StackPanel>
  42. </PivotItem>
  43. <PivotItem Header="Publish">
  44. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  45. <TextBlock>Topic:</TextBlock>
  46. <TextBox x:Name="Topic"></TextBox>
  47. <TextBlock>Payload:</TextBlock>
  48. <TextBox x:Name="Payload"></TextBox>
  49. <StackPanel Orientation="Horizontal">
  50. <RadioButton x:Name="Text" IsChecked="True" GroupName="payload">Text</RadioButton>
  51. <RadioButton x:Name="Base64" GroupName="payload">Base64</RadioButton>
  52. </StackPanel>
  53. <TextBlock>Retain:</TextBlock>
  54. <CheckBox x:Name="Retain"></CheckBox>
  55. <TextBlock>QoS:</TextBlock>
  56. <StackPanel Orientation="Horizontal">
  57. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
  58. <RadioButton Margin="0,0,10,0" x:Name="QoS1" GroupName="qos">1 (At least once)</RadioButton>
  59. <RadioButton Margin="0,0,10,0" x:Name="QoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  60. </StackPanel>
  61. <Button Click="Publish" Width="120">Publish</Button>
  62. </StackPanel>
  63. </PivotItem>
  64. <PivotItem Header="Execute RPC">
  65. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  66. <TextBlock>Method:</TextBlock>
  67. <TextBox x:Name="RpcMethod"></TextBox>
  68. <TextBlock>Payload:</TextBlock>
  69. <TextBox x:Name="RpcPayload"></TextBox>
  70. <StackPanel Orientation="Horizontal">
  71. <RadioButton x:Name="RpcText" IsChecked="True" GroupName="payload">Text</RadioButton>
  72. <RadioButton x:Name="RpcBase64" GroupName="payload">Base64</RadioButton>
  73. </StackPanel>
  74. <TextBlock>QoS:</TextBlock>
  75. <StackPanel Orientation="Horizontal">
  76. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS0" GroupName="qos" IsChecked="True">0 (At most once)</RadioButton>
  77. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS1" GroupName="qos">1 (At least once)</RadioButton>
  78. <RadioButton Margin="0,0,10,0" x:Name="RpcQoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  79. </StackPanel>
  80. <TextBlock>Responses:</TextBlock>
  81. <ListBox MinHeight="50" MaxHeight="250" x:Name="RpcResponses" Margin="0,0,0,10">
  82. <ListBox.ItemTemplate>
  83. <DataTemplate>
  84. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  85. </DataTemplate>
  86. </ListBox.ItemTemplate>
  87. </ListBox>
  88. <StackPanel Orientation="Horizontal">
  89. <Button Click="ExecuteRpc" Width="120" Margin="0,0,10,0">Execute</Button>
  90. <Button Click="ClearRpcResponses" Width="200">Clear responses</Button>
  91. </StackPanel>
  92. </StackPanel>
  93. </PivotItem>
  94. <PivotItem Header="Subscribe">
  95. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  96. <TextBlock>Topic:</TextBlock>
  97. <TextBox x:Name="SubscribeTopic"></TextBox>
  98. <TextBlock>QoS:</TextBlock>
  99. <StackPanel Orientation="Horizontal">
  100. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
  101. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS1" GroupName="sqos">1 (At least once)</RadioButton>
  102. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS2" GroupName="sqos">2 (Exactly once)</RadioButton>
  103. </StackPanel>
  104. <TextBlock>Received messages:</TextBlock>
  105. <CheckBox x:Name="AddReceivedMessagesToList" IsChecked="True">Add received messages to list</CheckBox>
  106. <ListBox MinHeight="50" MaxHeight="250" x:Name="ReceivedMessages" Margin="0,0,0,10">
  107. <ListBox.ItemTemplate>
  108. <DataTemplate>
  109. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  110. </DataTemplate>
  111. </ListBox.ItemTemplate>
  112. </ListBox>
  113. <StackPanel Orientation="Horizontal">
  114. <Button Click="Subscribe" Width="120" Margin="0,0,10,0">Subscribe</Button>
  115. <Button Click="Unsubscribe" Width="120" Margin="0,0,10,0">Unsubscribe</Button>
  116. <Button Click="ClearReceivedMessages" Width="200">Clear received messages</Button>
  117. </StackPanel>
  118. </StackPanel>
  119. </PivotItem>
  120. <PivotItem Header="Server">
  121. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  122. <TextBlock>Port:</TextBlock>
  123. <TextBox x:Name="ServerPort" Text="1883"></TextBox>
  124. <CheckBox x:Name="ServerPersistRetainedMessages" IsChecked="True">Persist retained messages in JSON format</CheckBox>
  125. <CheckBox x:Name="ServerClearRetainedMessages">Clear previously retained messages on startup</CheckBox>
  126. <StackPanel Orientation="Horizontal">
  127. <Button Width="120" Margin="0,0,10,0" Click="StartServer">Start</Button>
  128. <Button Width="120" Margin="0,0,10,0" Click="StopServer">Stop</Button>
  129. </StackPanel>
  130. </StackPanel>
  131. </PivotItem>
  132. <PivotItem Header="Log">
  133. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  134. <Button Click="ClearLog" Width="120">Clear</Button>
  135. </StackPanel>
  136. </PivotItem>
  137. </Pivot>
  138. <ScrollViewer Grid.Row="1" Margin="12,10,12,0" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
  139. <TextBlock x:Name="Trace" FontSize="11"></TextBlock>
  140. </ScrollViewer>
  141. </Grid>
  142. </Page>