fix(jobs): announce every finished render once and open every target
A finished render's toast is claimed once (JobsViewModel.ClaimRenderToast): the editor that followed the render to its end says it with its output, also when the sequence cannot be read again (then without Show in folder) or the editor closed meanwhile; any other render is said by the Jobs screen. Before, the Jobs screen stayed silent whenever an editor had the sequence open, so a failed reload or a render the editor did not follow ended without a completion toast. Open on a job over several sequences (toast, Windows notification, Jobs row) shows the Library with every one of them selected, clearing a search or filter that hides one and reading pages until each is listed, instead of opening the first in the editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
5 files changed
+174
-31
No files matched your search
@@ -937,7 +937,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
else OnServerJobChanged();
|
||||
LearnAnalysisSpeed(job);
|
||||
if (!wasActive) return;
|
||||
if (job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render ? job : null);
|
||||
// A render this editor followed to its end is said here, with its output, unless the Jobs screen said it first.
|
||||
if (job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render && Shell.Jobs.ClaimRenderToast(job.Id) ? job : null);
|
||||
else if (IsRemote && job.State is JobState.Failed or JobState.Cancelled) ReportServerJobEnded(job);
|
||||
});
|
||||
}
|
||||
@@ -1010,23 +1011,37 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
if (job is { Kind: JobKind.DeepAnalyse, State: JobState.Done, ItemsPerSecond: > 0 and var speed }) _analysisSecondsPerFrame = 1 / speed;
|
||||
}
|
||||
|
||||
/// <summary>Reads the sequence again after a job; a finished render offers its follow-ups (BRIEF §11.5).</summary>
|
||||
/// <summary>
|
||||
/// Reads the sequence again after a job. A finished render whose toast this editor took (<see cref="Sections.JobsViewModel.ClaimRenderToast"/>)
|
||||
/// is said in any case, also when the editor closed meanwhile: with its output and follow-ups (BRIEF §11.5) once the
|
||||
/// sequence is read again, without them when that failed.
|
||||
/// </summary>
|
||||
private async Task ReloadAsync(Job? render)
|
||||
{
|
||||
var reloaded = false;
|
||||
try
|
||||
{
|
||||
await Session.ReloadAsync();
|
||||
reloaded = true;
|
||||
}
|
||||
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or UnauthorizedAccessException
|
||||
or System.Net.Http.HttpRequestException or Protocol.Client.TitanoApiException or OperationCanceledException)
|
||||
or System.Net.Http.HttpRequestException or Protocol.Client.TitanoApiException or OperationCanceledException
|
||||
or Data.DatabaseException)
|
||||
{
|
||||
// A server that does not answer in time cancels the request (OperationCanceledException).
|
||||
Shell.ReportError(ex);
|
||||
return;
|
||||
}
|
||||
if (render is null || _disposed) return;
|
||||
// A server's render stays on the server: nothing to show in Explorer.
|
||||
var output = Session.Content.Renders.FirstOrDefault(r => render.Started is not { } started || r.Created >= started)?.OutputPath is { Length: > 0 } path
|
||||
finally
|
||||
{
|
||||
if (render is not null) AnnounceRender(render, reloaded);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"Render finished" with the output file and Show in folder; <paramref name="read"/>: the sequence was read again after the render.</summary>
|
||||
private void AnnounceRender(Job render, bool read)
|
||||
{
|
||||
// A server's render stays on the server: nothing to show in Explorer. Before a read the renders are the old ones.
|
||||
var output = read && Session.Content.Renders.FirstOrDefault(r => render.Started is not { } started || r.Created >= started)?.OutputPath is { Length: > 0 } path
|
||||
? path
|
||||
: null;
|
||||
Shell.ShowToast(new Toast
|
||||
|
||||
Reference in new issue
Block a user