diff --git a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs index 68652e16..71e9429f 100644 --- a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs @@ -223,54 +223,6 @@ public partial class DashboardViewModel : ViewModelBase } } - [RelayCommand] - private async Task ShowSetupIfSingleChannelAsync() - { - // Wait for any in-progress channel loading to complete - if (IsBusy) - { - var tcs = new TaskCompletionSource(); - - void Handler(object? _, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == nameof(IsBusy) && !IsBusy) - tcs.TrySetResult(); - } - - PropertyChanged += Handler; - - // Re-check after subscribing to avoid missing the transition - if (!IsBusy) - { - PropertyChanged -= Handler; - } - else - { - try - { - await tcs.Task; - } - finally - { - PropertyChanged -= Handler; - } - } - } - - // Only auto-export when there is exactly one child-less (non-category) channel - if ( - AvailableChannels is not { Count: 1 } - || AvailableChannels[0].Children.Count != 0 - || AvailableChannels[0].Channel.IsCategory - ) - return; - - SelectedChannels.Clear(); - SelectedChannels.Add(AvailableChannels[0]); - - await ExportAsync(); - } - private bool CanExport() => !IsBusy && _discord is not null && SelectedGuild is not null && SelectedChannels.Any(); diff --git a/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml.cs b/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml.cs index 40286c6a..eec78fd0 100644 --- a/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml.cs +++ b/DiscordChatExporter.Gui/Views/Components/DashboardView.axaml.cs @@ -23,8 +23,20 @@ public partial class DashboardView : UserControl SelectionChangedEventArgs args ) => DataContext.PullChannelsCommand.Execute(null); - private void AvailableGuildsListBox_OnDoubleTapped(object? sender, TappedEventArgs args) => - DataContext.ShowSetupIfSingleChannelCommand.Execute(null); + private void AvailableGuildsListBox_OnDoubleTapped(object? sender, TappedEventArgs args) + { + // Only works when there is exactly one non-category, child-less channel + if ( + DataContext.AvailableChannels is not { Count: 1 } + || DataContext.AvailableChannels[0].Channel.IsCategory + || DataContext.AvailableChannels[0].Children.Count != 0 + ) + return; + + DataContext.SelectedChannels.Clear(); + DataContext.SelectedChannels.Add(DataContext.AvailableChannels[0]); + DataContext.ExportCommand.Execute(null); + } private void AvailableChannelsTreeView_OnSelectionChanged( object? sender,