mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
Change the way to preview binary in CommitViewer
This commit is contained in:
parent
261b4d635c
commit
689b02cd61
3 changed files with 34 additions and 17 deletions
|
@ -345,13 +345,20 @@ namespace SourceGit.UI {
|
|||
|
||||
private async void FileTreeItemSelected(object sender, RoutedPropertyChangedEventArgs<object> e) {
|
||||
filePreview.Text = "";
|
||||
maskPreviewNotSupported.Visibility = Visibility.Collapsed;
|
||||
|
||||
var node = e.NewValue as Node;
|
||||
if (node == null || !node.IsFile) return;
|
||||
|
||||
await Task.Run(() => {
|
||||
var data = commit.GetTextFileContent(repo, node.FilePath);
|
||||
Dispatcher.Invoke(() => filePreview.Text = data);
|
||||
var isBinary = false;
|
||||
var data = commit.GetTextFileContent(repo, node.FilePath, out isBinary);
|
||||
|
||||
if (isBinary) {
|
||||
Dispatcher.Invoke(() => maskPreviewNotSupported.Visibility = Visibility.Visible);
|
||||
} else {
|
||||
Dispatcher.Invoke(() => filePreview.Text = data);
|
||||
}
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue