Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

124 rader
6.6 KiB

  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. <CheckBox x:Name="AddReceivedMessagesToList" IsChecked="True">Add received messages to list</CheckBox>
  72. <ListBox MinHeight="50" MaxHeight="250" x:Name="ReceivedMessages" Margin="0,0,0,10">
  73. <ListBox.ItemTemplate>
  74. <DataTemplate>
  75. <ContentPresenter Content="{Binding}" FontFamily="Consolas" FontSize="12"></ContentPresenter>
  76. </DataTemplate>
  77. </ListBox.ItemTemplate>
  78. </ListBox>
  79. <StackPanel Orientation="Horizontal">
  80. <Button Click="Subscribe" Width="120" Margin="0,0,10,0">Subscribe</Button>
  81. <Button Click="Unsubscribe" Width="120" Margin="0,0,10,0">Unsubscribe</Button>
  82. <Button Click="ClearReceivedMessages" Width="200">Clear received messages</Button>
  83. </StackPanel>
  84. </StackPanel>
  85. </PivotItem>
  86. <PivotItem Header="Server">
  87. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  88. <TextBlock>Port:</TextBlock>
  89. <TextBox x:Name="ServerPort" Text="1883"></TextBox>
  90. <CheckBox x:Name="ServerPersistRetainedMessages" IsChecked="True">Persist retained messages in JSON format</CheckBox>
  91. <CheckBox x:Name="ServerClearRetainedMessages">Clear previously retained messages on startup</CheckBox>
  92. <StackPanel Orientation="Horizontal">
  93. <Button Width="120" Margin="0,0,10,0" Click="StartServer">Start</Button>
  94. <Button Width="120" Margin="0,0,10,0" Click="StopServer">Stop</Button>
  95. </StackPanel>
  96. </StackPanel>
  97. </PivotItem>
  98. <PivotItem Header="Log">
  99. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  100. <Button Click="Clear" Width="120">Clear</Button>
  101. </StackPanel>
  102. </PivotItem>
  103. </Pivot>
  104. <ScrollViewer Grid.Row="1" Margin="12,10,12,0" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
  105. <TextBlock x:Name="Trace" FontSize="11"></TextBlock>
  106. </ScrollViewer>
  107. </Grid>
  108. </Page>