From 9da3377aa77ecb8c0225994764a8f214691c7ec4 Mon Sep 17 00:00:00 2001 From: Christian Kratky Date: Wed, 24 Apr 2019 20:19:55 +0200 Subject: [PATCH] Fix credential generation. --- .../MainPage.xaml.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs index 4623f66e..b2494c4d 100644 --- a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs +++ b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs @@ -119,12 +119,15 @@ namespace MQTTnet.TestApp.UniversalWindows throw new InvalidOperationException(); } - options.Credentials = new MqttClientCredentials + if (!string.IsNullOrEmpty(User.Text)) { - Username = User.Text, - Password = Password.Text - }; - + options.Credentials = new MqttClientCredentials + { + Username = User.Text, + Password = Password.Text + }; + } + options.CleanSession = CleanSession.IsChecked == true; options.KeepAlivePeriod = TimeSpan.FromSeconds(double.Parse(KeepAliveInterval.Text));