mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
Refactoring
This commit is contained in:
@@ -1,35 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace MQTTnet.TestApp.UniversalWindows
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
sealed partial class App
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
InitializeComponent();
|
||||
Suspending += OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,11 +22,9 @@ namespace MQTTnet.TestApp.UniversalWindows
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == null)
|
||||
if (!(Window.Current.Content is Frame rootFrame))
|
||||
{
|
||||
// Create a Frame to act as the navigation context and navigate to the first page
|
||||
rootFrame = new Frame();
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
<TextBlock>QoS:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RadioButton Margin="0,0,10,0" x:Name="QoS0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="qos">0 (At most once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" x:Name="QoS1" GroupName="qos">1 (At least once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" x:Name="QoS2" GroupName="qos">2 (Exactly once)</RadioButton>
|
||||
</StackPanel>
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
<TextBlock>QoS:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" IsChecked="True" GroupName="sqos">0 (At most once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS1" GroupName="sqos">1 (At least once)</RadioButton>
|
||||
<RadioButton Margin="0,0,10,0" x:Name="SubscribeQoS2" GroupName="sqos">2 (Exactly once)</RadioButton>
|
||||
</StackPanel>
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace MQTTnet.TestApp.UniversalWindows
|
||||
|
||||
private async void Connect(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MqttClientOptions options = null;
|
||||
BaseMqttClientOptions options = null;
|
||||
if (UseTcp.IsChecked == true)
|
||||
{
|
||||
options = new MqttClientTcpOptions
|
||||
@@ -195,6 +195,8 @@ namespace MQTTnet.TestApp.UniversalWindows
|
||||
}
|
||||
}
|
||||
|
||||
// This code is for the Wiki at GitHub!
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private async Task WikiCode()
|
||||
{
|
||||
var mqttClient = new MqttClientFactory().CreateMqttClient();
|
||||
|
||||
Reference in New Issue
Block a user