Skip to content

Commit

Permalink
Changed port hint
Browse files Browse the repository at this point in the history
  • Loading branch information
kilian-kier committed Jan 22, 2023
1 parent cacdb9d commit abc0b22
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions MQTT_GUI/MVVM/Controller/TopicsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 2 additions & 3 deletions MQTT_GUI/MVVM/Views/ConnectView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}" />
<TextBox Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
x:Name="BrokerPort"
Text="1883"
KeyUp="ButtonConnectEnter"
Style="{StaticResource PortInput}" />
</Grid>
Expand Down
21 changes: 21 additions & 0 deletions MQTT_GUI/MVVM/Views/ConnectView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
4 changes: 2 additions & 2 deletions MQTT_GUI/Theme/TextBoxTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<ControlTemplate TargetType="{x:Type TextBox}">
<Border CornerRadius="10"
Background="#353340"
Width="80"
Width="200"
Height="40">
<Grid>
<Rectangle StrokeThickness="1"/>
Expand All @@ -67,7 +67,7 @@
CaretBrush="White"
x:Name="BrokerPortBox"/>
<TextBlock IsHitTestVisible="False"
Text="Port"
Text="Port (1883, 8883 ...)"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="14"
Expand Down

0 comments on commit abc0b22

Please sign in to comment.