Only execute commands from code if allowed

This commit is contained in:
tyrrrz
2026-04-02 14:36:06 +03:00
parent f6166764e9
commit d467948d0b
3 changed files with 19 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ using Avalonia.Input;
using Avalonia.Interactivity;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Gui.Framework;
using DiscordChatExporter.Gui.Utils.Extensions;
using DiscordChatExporter.Gui.ViewModels.Components;
namespace DiscordChatExporter.Gui.Views.Components;
@@ -18,7 +19,7 @@ public partial class DashboardView : UserControl<DashboardViewModel>
private void AvailableGuildsListBox_OnSelectionChanged(
object? sender,
SelectionChangedEventArgs args
) => DataContext.PullChannelsCommand.Execute(null);
) => DataContext.PullChannelsCommand.ExecuteIfCan(null);
private void AvailableChannelsTreeView_OnSelectionChanged(
object? sender,
@@ -40,6 +41,6 @@ public partial class DashboardView : UserControl<DashboardViewModel>
if (DataContext.SelectedChannels.Count != 1)
return;
DataContext.ExportCommand.Execute(null);
DataContext.ExportCommand.ExecuteIfCan(null);
}
}