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 6.5 KiB

il y a 7 ans
il y a 7 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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>User:</TextBlock>
  21. <TextBox x:Name="User"></TextBox>
  22. <TextBlock>Password:</TextBlock>
  23. <TextBox x:Name="Password"></TextBox>
  24. <TextBlock>ClientId:</TextBlock>
  25. <TextBox x:Name="ClientId"></TextBox>
  26. <TextBlock>Clean session:</TextBlock>
  27. <CheckBox x:Name="CleanSession" IsChecked="True"></CheckBox>
  28. <StackPanel Orientation="Horizontal">
  29. <RadioButton x:Name="UseTcp" IsChecked="True" GroupName="connection">TCP</RadioButton>
  30. <RadioButton x:Name="UseWs" GroupName="connection">WS</RadioButton>
  31. <CheckBox x:Name="UseTls">Use TLS</CheckBox>
  32. </StackPanel>
  33. <StackPanel Orientation="Horizontal">
  34. <Button Click="Connect" Width="120" Margin="0,0,10,0">Connect</Button>
  35. <Button Click="Disconnect" Width="120">Disconnect</Button>
  36. </StackPanel>
  37. </StackPanel>
  38. </PivotItem>
  39. <PivotItem Header="Publish">
  40. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  41. <TextBlock>Topic:</TextBlock>
  42. <TextBox x:Name="Topic"></TextBox>
  43. <TextBlock>Payload:</TextBlock>
  44. <TextBox x:Name="Payload"></TextBox>
  45. <StackPanel Orientation="Horizontal">
  46. <RadioButton x:Name="Text" IsChecked="True" GroupName="payload">Text</RadioButton>
  47. <RadioButton x:Name="Base64" GroupName="payload">Base64</RadioButton>
  48. </StackPanel>
  49. <TextBlock>Retain:</TextBlock>
  50. <CheckBox x:Name="Retain"></CheckBox>
  51. <TextBlock>QoS:</TextBlock>
  52. <StackPanel Orientation="Horizontal">
  53. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
  54. <RadioButton Margin="0,0,10,0" x:Name="QoS1" GroupName="qos">1 (At least once)</RadioButton>
  55. <RadioButton Margin="0,0,10,0" x:Name="QoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  56. </StackPanel>
  57. <Button Click="Publish" Width="120">Publish</Button>
  58. </StackPanel>
  59. </PivotItem>
  60. <PivotItem Header="Subscribe">
  61. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  62. <TextBlock>Topic:</TextBlock>
  63. <TextBox x:Name="SubscribeTopic"></TextBox>
  64. <TextBlock>QoS:</TextBlock>
  65. <StackPanel Orientation="Horizontal">
  66. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
  67. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS1" GroupName="sqos">1 (At least once)</RadioButton>
  68. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS2" GroupName="sqos">2 (Exactly once)</RadioButton>
  69. </StackPanel>
  70. <TextBlock>Received messages:</TextBlock>
  71. <ListBox MinHeight="50" MaxHeight="250" x:Name="ReceivedMessages" Margin="0,0,0,10">
  72. <ListBox.ItemTemplate>
  73. <DataTemplate>
  74. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  75. </DataTemplate>
  76. </ListBox.ItemTemplate>
  77. </ListBox>
  78. <StackPanel Orientation="Horizontal">
  79. <Button Click="Subscribe" Width="120" Margin="0,0,10,0">Subscribe</Button>
  80. <Button Click="Unsubscribe" Width="120" Margin="0,0,10,0">Unsubscribe</Button>
  81. <Button Click="ClearReceivedMessages" Width="200">Clear received messages</Button>
  82. </StackPanel>
  83. </StackPanel>
  84. </PivotItem>
  85. <PivotItem Header="Server">
  86. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  87. <TextBlock>Port:</TextBlock>
  88. <TextBox x:Name="ServerPort" Text="1883"></TextBox>
  89. <CheckBox x:Name="ServerPersistRetainedMessages" IsChecked="True">Persist retained messages in JSON format</CheckBox>
  90. <CheckBox x:Name="ServerClearRetainedMessages">Clear previously retained messages on startup</CheckBox>
  91. <StackPanel Orientation="Horizontal">
  92. <Button Width="120" Margin="0,0,10,0" Click="StartServer">Start</Button>
  93. <Button Width="120" Margin="0,0,10,0" Click="StopServer">Stop</Button>
  94. </StackPanel>
  95. </StackPanel>
  96. </PivotItem>
  97. <PivotItem Header="Log">
  98. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  99. <Button Click="Clear" Width="120">Clear</Button>
  100. </StackPanel>
  101. </PivotItem>
  102. </Pivot>
  103. <ScrollViewer Grid.Row="1" Margin="12,10,12,0" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
  104. <TextBlock x:Name="Trace" FontSize="11"></TextBlock>
  105. </ScrollViewer>
  106. </Grid>
  107. </Page>