From 4e748aa78e4835c76633ba23307ec8475a1eff72 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 27 Apr 2026 20:49:20 +0200 Subject: [PATCH] Wait adorner over the decompiler view during decompile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors ILSpy/TextView/DecompilerTextView.xaml's wait-adorner shape: a translucent overlay above the editor with a centred "Decompiling…" title, an indeterminate ProgressBar, and a Cancel button. Visibility is driven by a new IsDecompiling flag on DecompilerTabPageModel, set around the Task.Run that runs the decompile. The Cancel button is wired to a [RelayCommand] CancelDecompilation that triggers the existing CancellationTokenSource. Assisted-by: Claude:claude-opus-4-7:Claude Code --- ILSpy/TextView/DecompilerTabPageModel.cs | 21 ++++++++++-- ILSpy/TextView/DecompilerTextView.axaml | 42 ++++++++++++++++++++---- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/ILSpy/TextView/DecompilerTabPageModel.cs b/ILSpy/TextView/DecompilerTabPageModel.cs index c992cdf72..f321ac469 100644 --- a/ILSpy/TextView/DecompilerTabPageModel.cs +++ b/ILSpy/TextView/DecompilerTabPageModel.cs @@ -27,6 +27,7 @@ using AvaloniaEdit.Folding; using AvaloniaEdit.Highlighting; using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; using ICSharpCode.Decompiler; @@ -68,8 +69,21 @@ namespace ILSpy.TextView [ObservableProperty] private IReadOnlyList? foldings; + /// + /// True while a decompilation is in flight. The view shows an indeterminate progress bar + /// in the header while this is set. + /// + [ObservableProperty] + private bool isDecompiling; + ILSpyTreeNode? currentNode; + [RelayCommand] + void CancelDecompilation() + { + activeCts?.Cancel(); + } + public ILSpyTreeNode? CurrentNode { get => currentNode; set { @@ -96,12 +110,14 @@ namespace ILSpy.TextView if (node == null || language == null) { Text = string.Empty; + IsDecompiling = false; return; } - Title = node.Text?.ToString() ?? "(unnamed)"; - Text = "Decompiling…"; + var nodeTitle = node.Text?.ToString() ?? "(unnamed)"; + Title = nodeTitle; SyntaxExtension = language.FileExtension; + IsDecompiling = true; try { @@ -136,6 +152,7 @@ namespace ILSpy.TextView HighlightingModel = model; Foldings = collectedFoldings; Text = rendered; + IsDecompiling = false; }); } catch (OperationCanceledException) diff --git a/ILSpy/TextView/DecompilerTextView.axaml b/ILSpy/TextView/DecompilerTextView.axaml index 0628f4624..e58e40674 100644 --- a/ILSpy/TextView/DecompilerTextView.axaml +++ b/ILSpy/TextView/DecompilerTextView.axaml @@ -5,13 +5,43 @@ xmlns:ae="using:AvaloniaEdit" xmlns:textView="using:ILSpy.TextView" mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="400" + Name="self" x:Class="ILSpy.TextView.DecompilerTextView" x:DataType="textView:DecompilerTabPageModel"> - + + + + + + + + +