Keep UI responsive during sync (run engine off the UI thread)
Beim Tray-/Auto-Sync lief die Engine auf dem UI-Thread -> Fenster und Tray-Kontextmenue froren ein (Menuepunkte reagierten nicht). - MainForm.RunSync fuehrt die Engine jetzt via Task.Run im Hintergrund aus (wie schon der manuelle Fenster-Sync). - Balloon() marshalled Tray-Meldungen thread-sicher per BeginInvoke auf den UI-Thread (die Fortsetzung kann nach Task.Run aus einem Pool-Thread kommen). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,11 @@ Versionsschema ist `x.x.x.x` (siehe `release.sh`).
|
||||
|
||||
### Behoben
|
||||
|
||||
- **Oberflaeche friert waehrend des Syncs nicht mehr ein.** Beim Tray-/Auto-Sync
|
||||
lief die Sync-Engine auf dem UI-Thread, wodurch Fenster und Tray-Kontextmenue
|
||||
blockierten (Menuepunkte reagierten nicht). Die Engine laeuft jetzt im
|
||||
Hintergrund (`Task.Run`), die Tray-Meldungen werden thread-sicher auf den
|
||||
UI-Thread marshalled.
|
||||
- **Dubletten bei Firmen-/Service-Eintraegen (nur Nummer + Firma).** Solche
|
||||
Eintraege wurden bei jedem Sync neu angelegt statt verknuepft, weil der
|
||||
Nummern-Abgleich feldgenau (geschaeftlich↔geschaeftlich) und formatabhaengig
|
||||
|
||||
@@ -358,9 +358,11 @@ namespace StarfaceOutlookSync.UI
|
||||
{
|
||||
// Lokaler Guard, Lock-Datei, Konflikt-Notizen und Protokoll laufen
|
||||
// zentral im Coordinator (gemeinsam mit dem manuellen Sync-Pfad).
|
||||
// WICHTIG: die Engine im Hintergrund laufen lassen, damit das
|
||||
// Fenster und das Tray-Kontextmenue waehrend des Syncs reagieren.
|
||||
var outcome = await _coordinator.RunAsync(
|
||||
profile,
|
||||
runEngine: () => _syncEngine.SyncProfileAsync(profile),
|
||||
runEngine: () => Task.Run(() => _syncEngine.SyncProfileAsync(profile)),
|
||||
status: SetStatus);
|
||||
|
||||
if (outcome.Skipped)
|
||||
@@ -426,7 +428,13 @@ namespace StarfaceOutlookSync.UI
|
||||
private void Balloon(int ms, string title, string text, ToolTipIcon icon, bool warn)
|
||||
{
|
||||
bool allow = warn ? _notifyWarn : _notifyGeneral;
|
||||
if (allow) _trayIcon.ShowBalloonTip(ms, title, text, icon);
|
||||
if (!allow) return;
|
||||
if (InvokeRequired)
|
||||
{
|
||||
BeginInvoke(new Action(() => _trayIcon.ShowBalloonTip(ms, title, text, icon)));
|
||||
return;
|
||||
}
|
||||
_trayIcon.ShowBalloonTip(ms, title, text, icon);
|
||||
}
|
||||
|
||||
private void SetStatus(string text)
|
||||
|
||||
Reference in New Issue
Block a user