Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MainPage.xaml 5.4 KiB

há 7 anos
há 7 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <RowDefinition Height="Auto" />
  15. </Grid.RowDefinitions>
  16. <Pivot Grid.Row="0" >
  17. <PivotItem Header="Connection">
  18. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  19. <TextBlock>Server:</TextBlock>
  20. <TextBox x:Name="Server"></TextBox>
  21. <TextBlock>User:</TextBlock>
  22. <TextBox x:Name="User"></TextBox>
  23. <TextBlock>Password:</TextBlock>
  24. <TextBox x:Name="Password"></TextBox>
  25. <TextBlock>ClientId:</TextBlock>
  26. <TextBox x:Name="ClientId"></TextBox>
  27. <StackPanel Orientation="Horizontal">
  28. <RadioButton x:Name="UseTcp" IsChecked="True" GroupName="connection">TCP</RadioButton>
  29. <RadioButton x:Name="UseWs" GroupName="connection">WS</RadioButton>
  30. <CheckBox x:Name="UseTls">Use TLS</CheckBox>
  31. </StackPanel>
  32. <StackPanel Orientation="Horizontal">
  33. <Button Click="Connect" Width="120" Margin="0,0,10,0">Connect</Button>
  34. <Button Click="Disconnect" Width="120">Disconnect</Button>
  35. </StackPanel>
  36. </StackPanel>
  37. </PivotItem>
  38. <PivotItem Header="Publish">
  39. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  40. <TextBlock>Topic:</TextBlock>
  41. <TextBox x:Name="Topic"></TextBox>
  42. <TextBlock>Payload:</TextBlock>
  43. <TextBox x:Name="Payload"></TextBox>
  44. <StackPanel Orientation="Horizontal">
  45. <RadioButton x:Name="Text" IsChecked="True" GroupName="payload">Text</RadioButton>
  46. <RadioButton x:Name="Base64" GroupName="payload">Base64</RadioButton>
  47. </StackPanel>
  48. <TextBlock>Retain:</TextBlock>
  49. <CheckBox x:Name="Retain"></CheckBox>
  50. <TextBlock>QoS:</TextBlock>
  51. <StackPanel Orientation="Horizontal">
  52. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
  53. <RadioButton Margin="0,0,10,0" x:Name="QoS1" GroupName="qos">1 (At least once)</RadioButton>
  54. <RadioButton Margin="0,0,10,0" x:Name="QoS2" GroupName="qos">2 (Exactly once)</RadioButton>
  55. </StackPanel>
  56. <Button Click="Publish" Width="120">Publish</Button>
  57. </StackPanel>
  58. </PivotItem>
  59. <PivotItem Header="Subscribe">
  60. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  61. <TextBlock>Topic:</TextBlock>
  62. <TextBox x:Name="SubscribeTopic"></TextBox>
  63. <TextBlock>QoS:</TextBlock>
  64. <StackPanel Orientation="Horizontal">
  65. <RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
  66. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS1" GroupName="sqos">1 (At least once)</RadioButton>
  67. <RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS2" GroupName="sqos">2 (Exactly once)</RadioButton>
  68. </StackPanel>
  69. <StackPanel Orientation="Horizontal">
  70. <Button Click="Subscribe" Width="120" Margin="0,0,10,0">Subscribe</Button>
  71. <Button Click="Unsubscribe" Width="120">Unsubscribe</Button>
  72. </StackPanel>
  73. </StackPanel>
  74. </PivotItem>
  75. <PivotItem Header="Server">
  76. <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  77. <TextBlock>Port:</TextBlock>
  78. <TextBox x:Name="ServerPort" Text="1883"></TextBox>
  79. <StackPanel Orientation="Horizontal">
  80. <Button Width="120" Margin="0,0,10,0" Click="StartServer">Start</Button>
  81. <Button Width="120" Margin="0,0,10,0" Click="StopServer">Stop</Button>
  82. </StackPanel>
  83. </StackPanel>
  84. </PivotItem>
  85. </Pivot>
  86. <ScrollViewer Margin="12,10,12,0" Grid.Row="1" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
  87. <TextBlock x:Name="Trace" FontSize="11"></TextBlock>
  88. </ScrollViewer>
  89. <StackPanel Margin="12,0,12,10" Grid.Row="2">
  90. <Button Click="Clear" Width="120">Clear</Button>
  91. </StackPanel>
  92. </Grid>
  93. </Page>