Console Binary file preview
This commit is contained in:
@@ -22,7 +22,6 @@ public class CommandPaletteViewModel : FuzzyPanelViewModel<ICommandPaletteEntryV
|
||||
IUserCommandHandlerService userCommandHandlerService,
|
||||
ICommandKeysHelperService commandKeysHelperService,
|
||||
ILogger<CommandPaletteViewModel> logger)
|
||||
: base((a, b) => a.Identifier == b.Identifier)
|
||||
{
|
||||
_commandPaletteService = commandPaletteService;
|
||||
_identifiableUserCommandService = identifiableUserCommandService;
|
||||
|
||||
@@ -6,5 +6,6 @@ public interface IElementPreviewViewModel : IItemPreviewViewModel
|
||||
{
|
||||
ItemPreviewMode Mode { get; }
|
||||
string TextContent { get; }
|
||||
byte[] BinaryContent { get; }
|
||||
string TextEncoding { get; }
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public partial class ElementPreviewViewModel : IElementPreviewViewModel, IAsyncI
|
||||
public ItemPreviewMode Mode { get; private set; }
|
||||
|
||||
[Property] private string? _textContent;
|
||||
[Property] private byte[]? _binaryContent;
|
||||
[Property] private string? _textEncoding;
|
||||
|
||||
public string Name => PreviewName;
|
||||
@@ -35,6 +36,7 @@ public partial class ElementPreviewViewModel : IElementPreviewViewModel, IAsyncI
|
||||
try
|
||||
{
|
||||
var content = await element.Provider.GetContentAsync(element, MaxTextPreviewSize);
|
||||
BinaryContent = content;
|
||||
|
||||
if (content is null)
|
||||
{
|
||||
|
||||
@@ -29,13 +29,20 @@ public abstract partial class FuzzyPanelViewModel<TItem> : IFuzzyPanelViewModel<
|
||||
_searchText = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(SearchText)));
|
||||
|
||||
UpdateFilteredMatchesInternal();
|
||||
UpdateFilteredMatches();
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
SelectedItem = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateSelectedItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFilteredMatchesInternal()
|
||||
private void UpdateSelectedItem()
|
||||
{
|
||||
UpdateFilteredMatches();
|
||||
if (SelectedItem != null && FilteredMatches.Contains(SelectedItem)) return;
|
||||
|
||||
SelectedItem = FilteredMatches.Count > 0
|
||||
|
||||
Reference in New Issue
Block a user