Sessione salvata: copia alla chiusura della finestra e alla fine della guida, «Serve «Ho finito»», scelta per la copia incompleta e stato in Collegamento (#36, S4b)
Risposte 1, 5, 6, 9 e 10 di Alberto a S4. I valori __spin_r, __spin_b e __spin_t si copiano dalla pagina come gli altri (su Instagram da SiteData, ipotesi H23, operazioni ancora non configurate; nel sito di prova dal modulo GiroProva). La sessione si copia anche quando si chiude la finestra del browser su Windows e quando il permesso di guida finisce, sempre prima che la pagina torni al motore e con le garanzie di «Ho finito». Con «richieste» «Collegato» vuole una sessione salvata leggibile, altrimenti lo stato è «Serve «Ho finito»» e il motore aspetta. Nuova impostazione sessione.copia-incompleta (sostituisci, predefinita, o tieni-completa) e riquadro della sessione salvata nella pagina Collegamento, con soli conteggi e nomi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9958745e53
commit
883ea4683c
41 files changed
+1349
-101
No files matched your search
@@ -23,7 +23,11 @@ namespace Febe.Desktop.Browser;
|
||||
/// What «Pagina iniziale» does (issue #52): the connection opens the site's home when connected, the login page otherwise,
|
||||
/// once the engine's session ended and with the page's turn. Null: the button does nothing.
|
||||
/// </param>
|
||||
internal sealed record WebView2HostOptions(BrowserHosting Hosting, string AdditionalBrowserArguments, ImageSource? Icon, Action MarkUsed, Func<CancellationToken, Task>? OpenStartPage = null);
|
||||
/// <param name="CopyOnClose">
|
||||
/// What closing the window does before the page goes back to the engine (issue #36, S4b): the connection copies the
|
||||
/// session, when it keeps a saved one. The window keeps the engine still until the task ends. Null: nothing.
|
||||
/// </param>
|
||||
internal sealed record WebView2HostOptions(BrowserHosting Hosting, string AdditionalBrowserArguments, ImageSource? Icon, Action MarkUsed, Func<CancellationToken, Task>? OpenStartPage = null, Func<CancellationToken, Task>? CopyOnClose = null);
|
||||
|
||||
/// <summary>What the host does when a process of WebView2 fails (issue #52).</summary>
|
||||
internal enum ProcessFailureResponse
|
||||
@@ -554,12 +558,42 @@ internal sealed class WebView2Host : IBrowserHost
|
||||
TakeLease();
|
||||
}
|
||||
|
||||
/// <summary>Alberto closed the window (or left it minimised too long): done, out of view.</summary>
|
||||
/// <summary>
|
||||
/// Alberto closed the window (or left it minimised too long): done, out of view at once. With a saved session
|
||||
/// (S4b) the session is copied first: a hold of the driving gate keeps the page his until the copy is over, and only
|
||||
/// then does it go back to the engine (rule 7).
|
||||
/// </summary>
|
||||
private void Done()
|
||||
{
|
||||
_window?.MoveOffScreen();
|
||||
ReleaseLease();
|
||||
NotifyPositionChanged();
|
||||
if (_lease is null || _closing || _settings.CopyOnClose is not { } copy)
|
||||
{
|
||||
ReleaseLease();
|
||||
return;
|
||||
}
|
||||
|
||||
var hold = UserDriving.Begin();
|
||||
ReleaseLease();
|
||||
_ = CopyThenLetGoAsync(copy, hold);
|
||||
}
|
||||
|
||||
private async Task CopyThenLetGoAsync(Func<CancellationToken, Task> copy, IDisposable hold)
|
||||
{
|
||||
try
|
||||
{
|
||||
await copy(CancellationToken.None).ConfigureAwait(true);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
// The kind of error only: the page and the browser may hold what the session holds.
|
||||
_log.Warn("browser", $"Copia della sessione alla chiusura della finestra non riuscita ({ex.GetType().Name}).");
|
||||
}
|
||||
finally
|
||||
{
|
||||
hold.Dispose();
|
||||
_settings.MarkUsed();
|
||||
}
|
||||
}
|
||||
|
||||
private void UserNavigation(Action<CoreWebView2> action, Func<CoreWebView2, bool> allowed)
|
||||
|
||||
Reference in new issue
Block a user