diff --git a/MQTT_GUI/MVVM/Controller/TopicsController.cs b/MQTT_GUI/MVVM/Controller/TopicsController.cs index 1ad99c1..4bf2687 100644 --- a/MQTT_GUI/MVVM/Controller/TopicsController.cs +++ b/MQTT_GUI/MVVM/Controller/TopicsController.cs @@ -57,8 +57,8 @@ public static void AddTopics(Dispatcher dispatcher) var ms = 0; - // searching for 20 seconds - while (ms < 20000) + // searching for 30 seconds + while (ms < 30000) { while (topicsClient.Receiver.SubQueue.Count == 0) { diff --git a/MQTT_GUI/MVVM/Views/ConnectView.xaml b/MQTT_GUI/MVVM/Views/ConnectView.xaml index 049d406..f387169 100644 --- a/MQTT_GUI/MVVM/Views/ConnectView.xaml +++ b/MQTT_GUI/MVVM/Views/ConnectView.xaml @@ -64,14 +64,13 @@ HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="BrokerIp" - Text="10.10.30.46" - KeyUp="ButtonConnectEnter" + KeyUp="IpKeyboard" + Loaded="IpSetFocus" Style="{StaticResource IpInput}" /> diff --git a/MQTT_GUI/MVVM/Views/ConnectView.xaml.cs b/MQTT_GUI/MVVM/Views/ConnectView.xaml.cs index 790bf7f..bcd19de 100644 --- a/MQTT_GUI/MVVM/Views/ConnectView.xaml.cs +++ b/MQTT_GUI/MVVM/Views/ConnectView.xaml.cs @@ -110,5 +110,26 @@ private void ButtonDisconnect(object sender, RoutedEventArgs e) mainWindow.SubscriptionsMenuButton.Visibility = Visibility.Hidden; } } + + private void IpKeyboard(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter || e.Key == Key.Tab) + { + Dispatcher.BeginInvoke((ThreadStart) delegate + { + BrokerPort.Focus(); + FocusManager.SetFocusedElement(this, BrokerPort); + Keyboard.Focus(BrokerPort); + }); + } + } + + private void IpSetFocus(object sender, RoutedEventArgs e) + { + var tb = sender as TextBox; + if (tb == null) return; + tb.Focusable = true; + Keyboard.Focus(tb); + } } } \ No newline at end of file diff --git a/MQTT_GUI/Theme/TextBoxTheme.xaml b/MQTT_GUI/Theme/TextBoxTheme.xaml index 28b2f03..d26ece5 100644 --- a/MQTT_GUI/Theme/TextBoxTheme.xaml +++ b/MQTT_GUI/Theme/TextBoxTheme.xaml @@ -52,7 +52,7 @@ @@ -67,7 +67,7 @@ CaretBrush="White" x:Name="BrokerPortBox"/>