Log what changed; add notification on/off settings
Protokoll: - SyncResult.Changes erfasst jede tatsaechliche Aenderung (erstellt/aktualisiert/ geloescht/verknuepft/zusammengefuehrt je Kontakt) per Action()-Helfer. - Beide Sync-Pfade (Auto/Tray via RunSync UND manueller Sync via SyncProgressForm) schreiben Start, Ergebnis, Aenderungen, Konflikte und Fehler ins persistente Protokoll. Benachrichtigungen: - UserSettings: NotificationsEnabled (allgemein) + NotifyWarningsErrors (Konflikte/Fehler), beide in der Einstellungen-Maske als Haken. - MainForm.Balloon() zeigt Tray-Meldungen nur, wenn der passende Haken aktiv ist; Zusammenfassung gilt als Warnung, wenn Fehler/Konflikte auftraten. - Protokoll wird unabhaengig von den Benachrichtigungs-Einstellungen geschrieben. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,15 @@ Versionsschema ist `x.x.x.x` (siehe `release.sh`).
|
|||||||
|
|
||||||
### Hinzugefuegt
|
### Hinzugefuegt
|
||||||
|
|
||||||
|
- **Protokoll zeigt jetzt, WAS geaendert wurde.** Pro Sync werden die einzelnen
|
||||||
|
Aktionen (erstellt / aktualisiert / geloescht / verknuepft / zusammengefuehrt je
|
||||||
|
Kontakt) ins Protokoll geschrieben - sowohl beim manuellen Sync (Fenster) als
|
||||||
|
auch bei Auto-/Tray-Sync.
|
||||||
|
- **Benachrichtigungen schaltbar (Einstellungen).** Zwei unabhaengige Haken:
|
||||||
|
"Tray-Benachrichtigungen (allgemein)" fuer Info-Meldungen (Sync laeuft/fertig)
|
||||||
|
und "Benachrichtigungen bei Warnungen/Fehlern" fuer Konflikte und Fehler. So
|
||||||
|
kann man z.B. nur noch bei Konflikten/Fehlern benachrichtigt werden - oder gar
|
||||||
|
nicht. Das Protokoll wird unabhaengig davon immer geschrieben.
|
||||||
- **Protokoll (Logdatei) + "Protokoll"-Button.** Syncs, Ergebnisse, Konflikte
|
- **Protokoll (Logdatei) + "Protokoll"-Button.** Syncs, Ergebnisse, Konflikte
|
||||||
(lokal und von anderen Arbeitsplaetzen) und Fehler werden dauerhaft in
|
(lokal und von anderen Arbeitsplaetzen) und Fehler werden dauerhaft in
|
||||||
`%AppData%\StarfaceOutlookSync\sync.log` festgehalten - so ist auch nach dem
|
`%AppData%\StarfaceOutlookSync\sync.log` festgehalten - so ist auch nach dem
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ namespace StarfaceOutlookSync.Models
|
|||||||
public int Errors { get; set; }
|
public int Errors { get; set; }
|
||||||
public System.Collections.Generic.List<string> ErrorMessages { get; set; } = new System.Collections.Generic.List<string>();
|
public System.Collections.Generic.List<string> ErrorMessages { get; set; } = new System.Collections.Generic.List<string>();
|
||||||
|
|
||||||
|
// Was konkret veraendert wurde (erstellt/aktualisiert/geloescht je Kontakt),
|
||||||
|
// fuer das Protokoll.
|
||||||
|
public System.Collections.Generic.List<string> Changes { get; set; } = new System.Collections.Generic.List<string>();
|
||||||
|
|
||||||
// Echte Feld-Konflikte (dasselbe Feld auf beiden Seiten geaendert), die
|
// Echte Feld-Konflikte (dasselbe Feld auf beiden Seiten geaendert), die
|
||||||
// ueber die Vorrang-Regel aufgeloest wurden. Fuer Benutzer-Hinweise.
|
// ueber die Vorrang-Regel aufgeloest wurden. Fuer Benutzer-Hinweise.
|
||||||
public System.Collections.Generic.List<FieldConflict> Conflicts { get; set; } = new System.Collections.Generic.List<FieldConflict>();
|
public System.Collections.Generic.List<FieldConflict> Conflicts { get; set; } = new System.Collections.Generic.List<FieldConflict>();
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ namespace StarfaceOutlookSync.Models
|
|||||||
public bool SyncOnStart { get; set; } = false;
|
public bool SyncOnStart { get; set; } = false;
|
||||||
public bool AutoAcceptOutlookPrompt { get; set; } = false;
|
public bool AutoAcceptOutlookPrompt { get; set; } = false;
|
||||||
|
|
||||||
|
// Tray-Benachrichtigungen. Allgemein = Info-Meldungen (Sync laeuft/fertig).
|
||||||
|
// WarnungenFehler = nur Konflikte und Fehler. Beide unabhaengig schaltbar.
|
||||||
|
public bool NotificationsEnabled { get; set; } = true;
|
||||||
|
public bool NotifyWarningsErrors { get; set; } = true;
|
||||||
|
|
||||||
// Gemeinsames Verzeichnis (Netzlaufwerk/UNC) fuer die clientuebergreifende
|
// Gemeinsames Verzeichnis (Netzlaufwerk/UNC) fuer die clientuebergreifende
|
||||||
// Sync-Sperre. Leer = keine Sperre (nur lokaler Schutz). Verhindert, dass
|
// Sync-Sperre. Leer = keine Sperre (nur lokaler Schutz). Verhindert, dass
|
||||||
// mehrere Arbeitsplaetze gleichzeitig dasselbe Adressbuch synchronisieren.
|
// mehrere Arbeitsplaetze gleichzeitig dasselbe Adressbuch synchronisieren.
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ namespace StarfaceOutlookSync.Services
|
|||||||
|
|
||||||
private void Log(string message) => OnProgress?.Invoke(message);
|
private void Log(string message) => OnProgress?.Invoke(message);
|
||||||
|
|
||||||
|
/// <summary>Protokolliert eine tatsaechliche Aenderung (fuer Live-Log UND SyncResult.Changes).</summary>
|
||||||
|
private void Action(SyncResult result, string message)
|
||||||
|
{
|
||||||
|
Log(" " + message);
|
||||||
|
result?.Changes.Add(message);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setzt die Baseline eines Mappings auf den uebergebenen Stand beider
|
/// Setzt die Baseline eines Mappings auf den uebergebenen Stand beider
|
||||||
/// Seiten (Snapshot + Hash). Der Snapshot wird fuer das Feld-Merge bei
|
/// Seiten (Snapshot + Hash). Der Snapshot wird fuer das Feld-Merge bei
|
||||||
@@ -184,7 +191,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (OL->SF): {sc.DisplayName}");
|
Action(result, $"Geloescht (OL->SF): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -202,7 +209,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (OL->SF): {sc.DisplayName}");
|
Action(result, $"Geloescht (OL->SF): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -245,7 +252,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (SF->OL): {oc.DisplayName}");
|
Action(result, $"Geloescht (SF->OL): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -263,7 +270,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (SF->OL): {oc.DisplayName}");
|
Action(result, $"Geloescht (SF->OL): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -322,7 +329,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
{
|
{
|
||||||
SetBaseline(mapping, oc, updated);
|
SetBaseline(mapping, oc, updated);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Aktualisiert (OL->SF): {oc.DisplayName}");
|
Action(result, $"Aktualisiert (OL->SF): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sfChanged && !olChanged && (profile.SyncDirection == SyncDirection.Both || profile.SyncDirection == SyncDirection.StarfaceToOutlook))
|
else if (sfChanged && !olChanged && (profile.SyncDirection == SyncDirection.Both || profile.SyncDirection == SyncDirection.StarfaceToOutlook))
|
||||||
@@ -333,7 +340,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
{
|
{
|
||||||
SetBaseline(mapping, updated, sc);
|
SetBaseline(mapping, updated, sc);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Aktualisiert (SF->OL): {sc.DisplayName}");
|
Action(result, $"Aktualisiert (SF->OL): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (olChanged && sfChanged)
|
else if (olChanged && sfChanged)
|
||||||
@@ -366,9 +373,9 @@ namespace StarfaceOutlookSync.Services
|
|||||||
mapping.LastSyncHash = "";
|
mapping.LastSyncHash = "";
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
foreach (var cf in conflicts) result.Conflicts.Add(cf);
|
foreach (var cf in conflicts) result.Conflicts.Add(cf);
|
||||||
Log(conflicts.Count > 0
|
Action(result, conflicts.Count > 0
|
||||||
? $" Beidseitig geaendert, zusammengefuehrt ({conflicts.Count} Feld-Konflikt(e), Outlook gewinnt): {oc.DisplayName}"
|
? $"Beidseitig geaendert, zusammengefuehrt ({conflicts.Count} Feld-Konflikt(e), Outlook gewinnt): {oc.DisplayName}"
|
||||||
: $" Beidseitig geaendert, zusammengefuehrt: {oc.DisplayName}");
|
: $"Beidseitig geaendert, zusammengefuehrt: {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (profile.SyncDirection != SyncDirection.StarfaceToOutlook)
|
else if (profile.SyncDirection != SyncDirection.StarfaceToOutlook)
|
||||||
@@ -380,7 +387,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
{
|
{
|
||||||
SetBaseline(mapping, oc, updated);
|
SetBaseline(mapping, oc, updated);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Konflikt (OL gewinnt): {oc.DisplayName}");
|
Action(result, $"Konflikt (OL gewinnt): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -390,7 +397,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
{
|
{
|
||||||
SetBaseline(mapping, updated, sc);
|
SetBaseline(mapping, updated, sc);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Konflikt (SF gewinnt): {sc.DisplayName}");
|
Action(result, $"Konflikt (SF gewinnt): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -441,7 +448,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
processedStarfaceIds.Add(match.StarfaceId);
|
processedStarfaceIds.Add(match.StarfaceId);
|
||||||
unmappedStarface.Remove(match);
|
unmappedStarface.Remove(match);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Verknuepft (OL->SF): {oc.DisplayName}");
|
Action(result, $"Verknuepft (OL->SF): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -462,7 +469,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
LastStarfaceHash = created.GetHash()
|
LastStarfaceHash = created.GetHash()
|
||||||
});
|
});
|
||||||
result.Created++;
|
result.Created++;
|
||||||
Log($" Erstellt (OL->SF): {oc.DisplayName}");
|
Action(result, $"Erstellt (OL->SF): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -521,7 +528,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
processedOutlookIds.Add(match.OutlookEntryId);
|
processedOutlookIds.Add(match.OutlookEntryId);
|
||||||
unmappedOutlook.Remove(match);
|
unmappedOutlook.Remove(match);
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Verknuepft (SF->OL): {sc.DisplayName}");
|
Action(result, $"Verknuepft (SF->OL): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -541,7 +548,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
LastOutlookHash = created.GetHash()
|
LastOutlookHash = created.GetHash()
|
||||||
});
|
});
|
||||||
result.Created++;
|
result.Created++;
|
||||||
Log($" Erstellt (SF->OL): {sc.DisplayName}");
|
Action(result, $"Erstellt (SF->OL): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -581,7 +588,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (await starface.DeleteContactAsync(sc.StarfaceId))
|
if (await starface.DeleteContactAsync(sc.StarfaceId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (nur in Starface): {sc.DisplayName}");
|
Action(result, $"Geloescht (nur in Starface): {sc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -612,7 +619,7 @@ namespace StarfaceOutlookSync.Services
|
|||||||
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
if (_outlookService.DeleteContact(oc.OutlookEntryId))
|
||||||
{
|
{
|
||||||
result.Updated++;
|
result.Updated++;
|
||||||
Log($" Geloescht (nur in Outlook): {oc.DisplayName}");
|
Action(result, $"Geloescht (nur in Outlook): {oc.DisplayName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ namespace StarfaceOutlookSync.UI
|
|||||||
// ein manueller Sync und der Auto-Sync-Timer nicht gleichzeitig starten.
|
// ein manueller Sync und der Auto-Sync-Timer nicht gleichzeitig starten.
|
||||||
private int _syncRunning = 0;
|
private int _syncRunning = 0;
|
||||||
|
|
||||||
|
// Aktive Benachrichtigungs-Einstellung (pro Sync-Lauf gesetzt).
|
||||||
|
private bool _notifyGeneral = true;
|
||||||
|
private bool _notifyWarn = true;
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -353,7 +357,10 @@ namespace StarfaceOutlookSync.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
SyncLock crossLock = null;
|
SyncLock crossLock = null;
|
||||||
var sharedDir = UserSettings.Load().SharedDirectory;
|
var settings = UserSettings.Load();
|
||||||
|
var sharedDir = settings.SharedDirectory;
|
||||||
|
_notifyGeneral = settings.NotificationsEnabled;
|
||||||
|
_notifyWarn = settings.NotifyWarningsErrors;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Clientuebergreifende Sperre (falls gemeinsames Verzeichnis konfiguriert).
|
// Clientuebergreifende Sperre (falls gemeinsames Verzeichnis konfiguriert).
|
||||||
@@ -373,8 +380,7 @@ namespace StarfaceOutlookSync.UI
|
|||||||
ShowRemoteConflictNotices(sharedDir);
|
ShowRemoteConflictNotices(sharedDir);
|
||||||
|
|
||||||
SetStatus($"Synchronisiere '{profile.Name}'...");
|
SetStatus($"Synchronisiere '{profile.Name}'...");
|
||||||
_trayIcon.ShowBalloonTip(2000, "Starface Sync",
|
Balloon(2000, "Starface Sync", $"Synchronisiere '{profile.Name}'...", ToolTipIcon.Info, warn: false);
|
||||||
$"Synchronisiere '{profile.Name}'...", ToolTipIcon.Info);
|
|
||||||
|
|
||||||
var result = await _syncEngine.SyncProfileAsync(profile);
|
var result = await _syncEngine.SyncProfileAsync(profile);
|
||||||
|
|
||||||
@@ -382,10 +388,15 @@ namespace StarfaceOutlookSync.UI
|
|||||||
if (result.Errors > 0) msg += $", {result.Errors} Fehler";
|
if (result.Errors > 0) msg += $", {result.Errors} Fehler";
|
||||||
if (result.Conflicts.Count > 0) msg += $", {result.Conflicts.Count} Konflikt(e)";
|
if (result.Conflicts.Count > 0) msg += $", {result.Conflicts.Count} Konflikt(e)";
|
||||||
|
|
||||||
_trayIcon.ShowBalloonTip(3000, "Starface Sync", msg,
|
// Zusammenfassung als Warnung werten, wenn Fehler/Konflikte auftraten.
|
||||||
result.Errors > 0 ? ToolTipIcon.Warning : ToolTipIcon.Info);
|
bool noteworthy = result.Errors > 0 || result.Conflicts.Count > 0;
|
||||||
|
Balloon(3000, "Starface Sync", msg,
|
||||||
|
result.Errors > 0 ? ToolTipIcon.Warning : ToolTipIcon.Info, warn: noteworthy);
|
||||||
|
|
||||||
|
// Protokoll (immer, unabhaengig von Benachrichtigungs-Einstellung).
|
||||||
Logger.Log($"Sync fertig: {msg}");
|
Logger.Log($"Sync fertig: {msg}");
|
||||||
|
foreach (var ch in result.Changes)
|
||||||
|
Logger.Log($" {ch}");
|
||||||
foreach (var em in result.ErrorMessages)
|
foreach (var em in result.ErrorMessages)
|
||||||
Logger.Log($" Fehler: {em}");
|
Logger.Log($" Fehler: {em}");
|
||||||
|
|
||||||
@@ -396,8 +407,7 @@ namespace StarfaceOutlookSync.UI
|
|||||||
var detail = string.Join("\n", result.Conflicts.Take(5).Select(c => c.ToString()));
|
var detail = string.Join("\n", result.Conflicts.Take(5).Select(c => c.ToString()));
|
||||||
if (result.Conflicts.Count > 5)
|
if (result.Conflicts.Count > 5)
|
||||||
detail += $"\n... und {result.Conflicts.Count - 5} weitere";
|
detail += $"\n... und {result.Conflicts.Count - 5} weitere";
|
||||||
_trayIcon.ShowBalloonTip(10000,
|
Balloon(10000, $"Konflikt bei {result.Conflicts.Count} Kontakt(en)", detail, ToolTipIcon.Warning, warn: true);
|
||||||
$"Konflikt bei {result.Conflicts.Count} Kontakt(en)", detail, ToolTipIcon.Warning);
|
|
||||||
|
|
||||||
foreach (var c in result.Conflicts)
|
foreach (var c in result.Conflicts)
|
||||||
Logger.Log($" KONFLIKT: {c}");
|
Logger.Log($" KONFLIKT: {c}");
|
||||||
@@ -410,8 +420,7 @@ namespace StarfaceOutlookSync.UI
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_trayIcon.ShowBalloonTip(3000, "Starface Sync Fehler",
|
Balloon(3000, "Starface Sync Fehler", ex.Message, ToolTipIcon.Error, warn: true);
|
||||||
ex.Message, ToolTipIcon.Error);
|
|
||||||
SetStatus($"Fehler: {ex.Message}");
|
SetStatus($"Fehler: {ex.Message}");
|
||||||
Logger.Log($"Sync FEHLER '{profile.Name}': {ex.Message}");
|
Logger.Log($"Sync FEHLER '{profile.Name}': {ex.Message}");
|
||||||
}
|
}
|
||||||
@@ -481,8 +490,8 @@ namespace StarfaceOutlookSync.UI
|
|||||||
var detail = string.Join("\n", pending.Take(5).Select(p => p.ToString()));
|
var detail = string.Join("\n", pending.Take(5).Select(p => p.ToString()));
|
||||||
if (pending.Count > 5)
|
if (pending.Count > 5)
|
||||||
detail += $"\n... und {pending.Count - 5} weitere";
|
detail += $"\n... und {pending.Count - 5} weitere";
|
||||||
_trayIcon.ShowBalloonTip(10000,
|
Balloon(10000,
|
||||||
$"Konflikt an anderem Arbeitsplatz ({pending.Count})", detail, ToolTipIcon.Warning);
|
$"Konflikt an anderem Arbeitsplatz ({pending.Count})", detail, ToolTipIcon.Warning, warn: true);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
@@ -506,6 +515,17 @@ namespace StarfaceOutlookSync.UI
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Zeigt eine Tray-Meldung - aber nur, wenn die passende Benachrichtigungs-
|
||||||
|
/// Einstellung aktiv ist. warn=true -> Warnungen/Fehler (Konflikte, Fehler),
|
||||||
|
/// warn=false -> allgemeine Info-Meldungen.
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
private void SetStatus(string text)
|
private void SetStatus(string text)
|
||||||
{
|
{
|
||||||
if (InvokeRequired)
|
if (InvokeRequired)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace StarfaceOutlookSync.UI
|
|||||||
public class SettingsForm : Form
|
public class SettingsForm : Form
|
||||||
{
|
{
|
||||||
private CheckBox _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook;
|
private CheckBox _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook;
|
||||||
|
private CheckBox _chkNotifGeneral, _chkNotifWarn;
|
||||||
private TextBox _txtSharedDir;
|
private TextBox _txtSharedDir;
|
||||||
private Button _btnBrowseShared;
|
private Button _btnBrowseShared;
|
||||||
private Button _btnSave, _btnCancel;
|
private Button _btnSave, _btnCancel;
|
||||||
@@ -61,21 +62,35 @@ namespace StarfaceOutlookSync.UI
|
|||||||
Font = new Font("Segoe UI", 8)
|
Font = new Font("Segoe UI", 8)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_chkNotifGeneral = new CheckBox
|
||||||
|
{
|
||||||
|
Text = "Tray-Benachrichtigungen (allgemein)",
|
||||||
|
Left = 20, Top = 144, AutoSize = true,
|
||||||
|
Checked = _settings.NotificationsEnabled
|
||||||
|
};
|
||||||
|
|
||||||
|
_chkNotifWarn = new CheckBox
|
||||||
|
{
|
||||||
|
Text = "Benachrichtigungen bei Warnungen/Fehlern (Konflikte, Fehler)",
|
||||||
|
Left = 20, Top = 170, AutoSize = true,
|
||||||
|
Checked = _settings.NotifyWarningsErrors
|
||||||
|
};
|
||||||
|
|
||||||
var lblShared = new Label
|
var lblShared = new Label
|
||||||
{
|
{
|
||||||
Text = "Gemeinsames Verzeichnis fuer Sync-Sperre (Mehrplatz, optional):",
|
Text = "Gemeinsames Verzeichnis fuer Sync-Sperre (Mehrplatz, optional):",
|
||||||
Left = 20, Top = 150, AutoSize = true
|
Left = 20, Top = 206, AutoSize = true
|
||||||
};
|
};
|
||||||
|
|
||||||
_txtSharedDir = new TextBox
|
_txtSharedDir = new TextBox
|
||||||
{
|
{
|
||||||
Left = 20, Top = 172, Width = 250,
|
Left = 20, Top = 228, Width = 250,
|
||||||
Text = _settings.SharedDirectory
|
Text = _settings.SharedDirectory
|
||||||
};
|
};
|
||||||
|
|
||||||
_btnBrowseShared = new Button
|
_btnBrowseShared = new Button
|
||||||
{
|
{
|
||||||
Text = "...", Left = 274, Top = 171, Width = 36, Height = 24
|
Text = "...", Left = 274, Top = 227, Width = 36, Height = 24
|
||||||
};
|
};
|
||||||
_btnBrowseShared.Click += (s, e) => BrowseSharedDir();
|
_btnBrowseShared.Click += (s, e) => BrowseSharedDir();
|
||||||
|
|
||||||
@@ -83,25 +98,26 @@ namespace StarfaceOutlookSync.UI
|
|||||||
{
|
{
|
||||||
Text = "Netzlaufwerk/UNC, das alle Arbeitsplaetze erreichen. Leer = keine\n" +
|
Text = "Netzlaufwerk/UNC, das alle Arbeitsplaetze erreichen. Leer = keine\n" +
|
||||||
"clientuebergreifende Sperre (nur Schutz auf diesem PC).",
|
"clientuebergreifende Sperre (nur Schutz auf diesem PC).",
|
||||||
Left = 20, Top = 198, Width = 330, Height = 32,
|
Left = 20, Top = 254, Width = 330, Height = 32,
|
||||||
ForeColor = Color.Gray, Font = new Font("Segoe UI", 8)
|
ForeColor = Color.Gray, Font = new Font("Segoe UI", 8)
|
||||||
};
|
};
|
||||||
|
|
||||||
_btnSave = new Button
|
_btnSave = new Button
|
||||||
{
|
{
|
||||||
Text = "Speichern", Left = 95, Top = 240, Width = 85, Height = 28,
|
Text = "Speichern", Left = 95, Top = 300, Width = 85, Height = 28,
|
||||||
DialogResult = DialogResult.None
|
DialogResult = DialogResult.None
|
||||||
};
|
};
|
||||||
_btnSave.Click += (s, e) => Save();
|
_btnSave.Click += (s, e) => Save();
|
||||||
|
|
||||||
_btnCancel = new Button
|
_btnCancel = new Button
|
||||||
{
|
{
|
||||||
Text = "Abbrechen", Left = 189, Top = 240, Width = 85, Height = 28,
|
Text = "Abbrechen", Left = 189, Top = 300, Width = 85, Height = 28,
|
||||||
DialogResult = DialogResult.Cancel
|
DialogResult = DialogResult.Cancel
|
||||||
};
|
};
|
||||||
|
|
||||||
Size = new Size(380, 330);
|
Size = new Size(380, 390);
|
||||||
Controls.AddRange(new Control[] { _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook, lblHint,
|
Controls.AddRange(new Control[] { _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook, lblHint,
|
||||||
|
_chkNotifGeneral, _chkNotifWarn,
|
||||||
lblShared, _txtSharedDir, _btnBrowseShared, lblSharedHint, _btnSave, _btnCancel });
|
lblShared, _txtSharedDir, _btnBrowseShared, lblSharedHint, _btnSave, _btnCancel });
|
||||||
AcceptButton = _btnSave;
|
AcceptButton = _btnSave;
|
||||||
CancelButton = _btnCancel;
|
CancelButton = _btnCancel;
|
||||||
@@ -126,6 +142,8 @@ namespace StarfaceOutlookSync.UI
|
|||||||
_settings.StartMinimized = _chkStartMinimized.Checked;
|
_settings.StartMinimized = _chkStartMinimized.Checked;
|
||||||
_settings.SyncOnStart = _chkSyncOnStart.Checked;
|
_settings.SyncOnStart = _chkSyncOnStart.Checked;
|
||||||
_settings.AutoAcceptOutlookPrompt = _chkAutoAcceptOutlook.Checked;
|
_settings.AutoAcceptOutlookPrompt = _chkAutoAcceptOutlook.Checked;
|
||||||
|
_settings.NotificationsEnabled = _chkNotifGeneral.Checked;
|
||||||
|
_settings.NotifyWarningsErrors = _chkNotifWarn.Checked;
|
||||||
_settings.SharedDirectory = _txtSharedDir.Text.Trim();
|
_settings.SharedDirectory = _txtSharedDir.Text.Trim();
|
||||||
_settings.Save();
|
_settings.Save();
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ namespace StarfaceOutlookSync.UI
|
|||||||
|
|
||||||
_engine.OnProgress += AppendLog;
|
_engine.OnProgress += AppendLog;
|
||||||
|
|
||||||
|
Logger.Log($"Sync gestartet (manuell): '{_profile.Name}' (Richtung: {_profile.SyncDirection})");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await Task.Run(() => _engine.SyncProfileAsync(_profile));
|
var result = await Task.Run(() => _engine.SyncProfileAsync(_profile));
|
||||||
@@ -105,11 +107,23 @@ namespace StarfaceOutlookSync.UI
|
|||||||
_lblResult.Text = resultText;
|
_lblResult.Text = resultText;
|
||||||
_lblResult.ForeColor = result.Errors > 0 ? Color.OrangeRed : Color.Green;
|
_lblResult.ForeColor = result.Errors > 0 ? Color.OrangeRed : Color.Green;
|
||||||
|
|
||||||
|
// Persistentes Protokoll (was wurde geaendert).
|
||||||
|
Logger.Log($"Sync fertig: {_profile.Name}: {result.Created} erstellt, {result.Updated} aktualisiert"
|
||||||
|
+ (result.Errors > 0 ? $", {result.Errors} Fehler" : "")
|
||||||
|
+ (result.Conflicts.Count > 0 ? $", {result.Conflicts.Count} Konflikt(e)" : ""));
|
||||||
|
foreach (var ch in result.Changes)
|
||||||
|
Logger.Log($" {ch}");
|
||||||
|
foreach (var c in result.Conflicts)
|
||||||
|
Logger.Log($" KONFLIKT: {c}");
|
||||||
|
|
||||||
if (result.ErrorMessages.Count > 0)
|
if (result.ErrorMessages.Count > 0)
|
||||||
{
|
{
|
||||||
AppendLog("--- Fehler ---");
|
AppendLog("--- Fehler ---");
|
||||||
foreach (var err in result.ErrorMessages)
|
foreach (var err in result.ErrorMessages)
|
||||||
|
{
|
||||||
AppendLog(err);
|
AppendLog(err);
|
||||||
|
Logger.Log($" Fehler: {err}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -117,6 +131,7 @@ namespace StarfaceOutlookSync.UI
|
|||||||
_lblResult.Text = $"Fehler: {ex.Message}";
|
_lblResult.Text = $"Fehler: {ex.Message}";
|
||||||
_lblResult.ForeColor = Color.Red;
|
_lblResult.ForeColor = Color.Red;
|
||||||
AppendLog($"FEHLER: {ex.Message}");
|
AppendLog($"FEHLER: {ex.Message}");
|
||||||
|
Logger.Log($"Sync FEHLER '{_profile.Name}': {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
_engine.OnProgress -= AppendLog;
|
_engine.OnProgress -= AppendLog;
|
||||||
|
|||||||
Reference in New Issue
Block a user