allow image conversion when multiple files are selected.

This commit is contained in:
morkt 2015-06-01 12:59:14 +04:00
parent 5ae98b4a0d
commit 629a062b71
2 changed files with 13 additions and 1 deletions

View File

@ -366,7 +366,7 @@
<CommandBinding Command="{x:Static local:Commands.DeleteItem}" Executed="DeleteItemExec" CanExecute="CanExecuteOnPhysicalFile" /> <CommandBinding Command="{x:Static local:Commands.DeleteItem}" Executed="DeleteItemExec" CanExecute="CanExecuteOnPhysicalFile" />
<CommandBinding Command="{x:Static local:Commands.RenameItem}" Executed="RenameItemExec" CanExecute="CanExecuteInDirectory" /> <CommandBinding Command="{x:Static local:Commands.RenameItem}" Executed="RenameItemExec" CanExecute="CanExecuteInDirectory" />
<CommandBinding Command="{x:Static local:Commands.ExploreItem}" Executed="ExploreItemExec" CanExecute="CanExecuteInDirectory" /> <CommandBinding Command="{x:Static local:Commands.ExploreItem}" Executed="ExploreItemExec" CanExecute="CanExecuteInDirectory" />
<CommandBinding Command="{x:Static local:Commands.ConvertImage}" Executed="ConvertImageExec" CanExecute="CanExecuteOnImage" /> <CommandBinding Command="{x:Static local:Commands.ConvertImage}" Executed="ConvertImageExec" CanExecute="CanExecuteConvertImage" />
<CommandBinding Command="{x:Static local:Commands.SortBy}" Executed="SortByExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.SortBy}" Executed="SortByExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.GoBack}" Executed="GoBackExec" CanExecute="CanExecuteGoBack"/> <CommandBinding Command="{x:Static local:Commands.GoBack}" Executed="GoBackExec" CanExecute="CanExecuteGoBack"/>
<CommandBinding Command="{x:Static local:Commands.GoForward}" Executed="GoForwardExec" CanExecute="CanExecuteGoForward"/> <CommandBinding Command="{x:Static local:Commands.GoForward}" Executed="GoForwardExec" CanExecute="CanExecuteGoForward"/>

View File

@ -1056,6 +1056,18 @@ namespace GARbro.GUI
e.CanExecute = CurrentDirectory.SelectedIndex != -1; e.CanExecute = CurrentDirectory.SelectedIndex != -1;
} }
private void CanExecuteConvertImage (object sender, CanExecuteRoutedEventArgs e)
{
if (CurrentDirectory.SelectedItems.Count > 1)
{
e.CanExecute = !ViewModel.IsArchive;
}
else
{
CanExecuteOnImage (sender, e);
}
}
private void CanExecuteOnImage (object sender, CanExecuteRoutedEventArgs e) private void CanExecuteOnImage (object sender, CanExecuteRoutedEventArgs e)
{ {
var entry = CurrentDirectory.SelectedItem as EntryViewModel; var entry = CurrentDirectory.SelectedItem as EntryViewModel;