diff --git a/src/PlanViewer.App/Dialogs/ConnectionDialog.axaml b/src/PlanViewer.App/Dialogs/ConnectionDialog.axaml index 3b80a42..818c016 100644 --- a/src/PlanViewer.App/Dialogs/ConnectionDialog.axaml +++ b/src/PlanViewer.App/Dialogs/ConnectionDialog.axaml @@ -13,11 +13,33 @@ - + + + + + + + + + s.ServerName).Distinct().ToList(); - ServerNameBox.ItemsSource = serverNames; + var serverNames = _savedConnections + .OrderByDescending(s => s.LastConnected) + .Select(s => s.ServerName) + .Distinct() + .ToList(); + ServerList.ItemsSource = serverNames; // Pre-fill the most recently used connection var mostRecent = _savedConnections @@ -84,12 +88,14 @@ private void ApplySavedConnection(ServerConnection saved) } } - // When the user picks a saved server from the autocomplete dropdown - private void ServerName_SelectionChanged(object? sender, SelectionChangedEventArgs e) + private void ServerList_SelectionChanged(object? sender, SelectionChangedEventArgs e) { - var serverName = ServerNameBox.SelectedItem?.ToString(); + var serverName = ServerList.SelectedItem?.ToString(); if (string.IsNullOrEmpty(serverName)) return; + ServerNameBox.Text = serverName; + ServerDropdown.IsOpen = false; + var saved = _savedConnections.FirstOrDefault(s => s.ServerName.Equals(serverName, StringComparison.OrdinalIgnoreCase)); @@ -190,6 +196,12 @@ private void Connect_Click(object? sender, RoutedEventArgs e) Close(true); } + private void DropdownButton_Click(object? sender, RoutedEventArgs e) + { + ServerDropdown.MinWidth = ServerNameGrid.Bounds.Width; + ServerDropdown.IsOpen = !ServerDropdown.IsOpen; + } + private void Cancel_Click(object? sender, RoutedEventArgs e) { Close(false); diff --git a/src/PlanViewer.App/PlanViewer.App.csproj b/src/PlanViewer.App/PlanViewer.App.csproj index 1ab55a9..f59bb64 100644 --- a/src/PlanViewer.App/PlanViewer.App.csproj +++ b/src/PlanViewer.App/PlanViewer.App.csproj @@ -6,7 +6,7 @@ app.manifest EDD.ico true - 1.4.2 + 1.4.3 Erik Darling Darling Data LLC Performance Studio