Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses a resizable panel for Topics/Queue #84

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions PurpleExplorer/Views/ConnectionStringWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Avalonia.Controls;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using PurpleExplorer.Helpers;
using PurpleExplorer.ViewModels;
using System.Linq;
using Avalonia;

namespace PurpleExplorer.Views;

Expand Down Expand Up @@ -37,7 +37,7 @@ public async void btnSendClick(object sender, RoutedEventArgs e)
public async void btnSaveConnectionString(object sender, RoutedEventArgs e)
{
var dataContext = DataContext as ConnectionStringWindowViewModel;

if (dataContext.SavedConnectionStrings.FirstOrDefault(x => x.ConnectionString == dataContext.ConnectionString && x.UseManagedIdentity == dataContext.UseManagedIdentity) != null)
await MessageBoxHelper.ShowMessage("Duplicate connection string", "This connection string is already saved.");
else
Expand All @@ -50,11 +50,13 @@ public async void btnSaveConnectionString(object sender, RoutedEventArgs e)

private void lsbConnectionStringSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var box = sender as ListBox;
var dataContext = DataContext as ConnectionStringWindowViewModel;
var serviceBusConnectionString = box.SelectedItem as Models.ServiceBusConnectionString;
dataContext.ConnectionString = serviceBusConnectionString.ConnectionString;
dataContext.UseManagedIdentity = serviceBusConnectionString.UseManagedIdentity;
// sender can be Button when we arrive here from the remove button
if (sender is ListBox box && box.SelectedItem is Models.ServiceBusConnectionString serviceBusConnectionString)
{
var dataContext = DataContext as ConnectionStringWindowViewModel;
dataContext.ConnectionString = serviceBusConnectionString.ConnectionString;
dataContext.UseManagedIdentity = serviceBusConnectionString.UseManagedIdentity;
}
}

public void btnDeleteConnectionString(object sender, RoutedEventArgs e)
Expand Down
8 changes: 6 additions & 2 deletions PurpleExplorer/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
</DockPanel>

<DockPanel Grid.Column="0" Grid.Row="1" Dock="Left">
<TabControl Width="300">
<Grid ColumnDefinitions="300, 5, *">
<TabControl Grid.Column="0">
<TabItem Header="{Binding TopicTabHeader}">
<TreeView SelectionChanged="TreeView_SelectionChanged" Items="{Binding ConnectedServiceBuses}" Name="tvTopics">
<TreeView.DataTemplates>
Expand Down Expand Up @@ -155,7 +156,9 @@
</TabItem>
</TabControl>

<TabControl>
<GridSplitter Grid.Column="1" ResizeBehavior="PreviousAndNext" VerticalAlignment="Stretch" Width="4" />

<TabControl Grid.Column="2">
<TabItem Header="{Binding MessagesTabHeader}" VerticalContentAlignment="Center">
<DataGrid Items="{Binding Messages}" Tapped="MessagesGrid_Tapped"
DoubleTapped="MessagesGrid_DoubleTapped"
Expand Down Expand Up @@ -187,6 +190,7 @@
</DataGrid>
</TabItem>
</TabControl>
</Grid>
</DockPanel>

<DockPanel Grid.Column="0" Grid.Row="2" Dock="Bottom">
Expand Down