This commit is contained in:
Tyrrrz 2023-08-21 01:05:57 +03:00
parent 60389ab002
commit ac1bd16439
2 changed files with 8 additions and 9 deletions

View file

@ -90,10 +90,9 @@ public class DashboardViewModel : PropertyChangedBase
public void ShowHelp() => ProcessEx.StartShellExecute(App.DocumentationUrl); public void ShowHelp() => ProcessEx.StartShellExecute(App.DocumentationUrl);
public bool CanPopulateGuildsAndChannels => public bool CanPopulate => !IsBusy && !string.IsNullOrWhiteSpace(Token);
!IsBusy && !string.IsNullOrWhiteSpace(Token);
public async void PopulateGuildsAndChannels() public async void Populate()
{ {
IsBusy = true; IsBusy = true;
var progress = _progressMuxer.CreateInput(); var progress = _progressMuxer.CreateInput();
@ -142,13 +141,13 @@ public class DashboardViewModel : PropertyChangedBase
} }
} }
public bool CanExportChannels => public bool CanExport =>
!IsBusy && !IsBusy &&
_discord is not null && _discord is not null &&
SelectedGuild is not null && SelectedGuild is not null &&
SelectedChannels?.Any() is true; SelectedChannels?.Any() is true;
public async void ExportChannels() public async void Export()
{ {
IsBusy = true; IsBusy = true;

View file

@ -104,7 +104,7 @@
Grid.Column="2" Grid.Column="2"
Margin="0,6,6,6" Margin="0,6,6,6"
Padding="4" Padding="4"
Command="{s:Action PopulateGuildsAndChannels}" Command="{s:Action Populate}"
IsDefault="True" IsDefault="True"
Style="{DynamicResource MaterialDesignFlatButton}" Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Pull available guilds and channels (Enter)"> ToolTip="Pull available guilds and channels (Enter)">
@ -348,7 +348,7 @@
<DataTemplate DataType="{x:Type data:Channel}"> <DataTemplate DataType="{x:Type data:Channel}">
<Grid Margin="-8" Background="Transparent"> <Grid Margin="-8" Background="Transparent">
<Grid.InputBindings> <Grid.InputBindings>
<MouseBinding Command="{s:Action ExportChannels}" MouseAction="LeftDoubleClick" /> <MouseBinding Command="{s:Action Export}" MouseAction="LeftDoubleClick" />
</Grid.InputBindings> </Grid.InputBindings>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@ -410,9 +410,9 @@
Margin="32,24" Margin="32,24"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Command="{s:Action ExportChannels}" Command="{s:Action Export}"
Style="{DynamicResource MaterialDesignFloatingActionAccentButton}" Style="{DynamicResource MaterialDesignFloatingActionAccentButton}"
Visibility="{Binding CanExportChannels, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"> Visibility="{Binding CanExport, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<materialDesign:PackIcon <materialDesign:PackIcon
Width="32" Width="32"
Height="32" Height="32"