Add Sync Reset button to clear mappings for a profile
Deletes all contact mappings and resets LastSync timestamp. Next sync will re-match all contacts fresh without creating duplicates (thanks to the duplicate detection in sync engine). No contacts are deleted on either side. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
39b30f9a80
commit
4359d3ad1a
|
|
@ -18,7 +18,7 @@ namespace StarfaceOutlookSync.UI
|
|||
private NotifyIcon _trayIcon;
|
||||
private ContextMenuStrip _trayMenu;
|
||||
private ListView _profileList;
|
||||
private Button _btnNew, _btnEdit, _btnDelete, _btnSync, _btnSettings, _btnInfo;
|
||||
private Button _btnNew, _btnEdit, _btnDelete, _btnSync, _btnReset, _btnSettings, _btnInfo;
|
||||
private StatusStrip _statusBar;
|
||||
private ToolStripStatusLabel _statusLabel;
|
||||
private Timer _autoSyncTimer;
|
||||
|
|
@ -97,16 +97,19 @@ namespace StarfaceOutlookSync.UI
|
|||
_btnDelete = new Button { Text = "Loeschen", Width = 80, Height = 30 };
|
||||
_btnDelete.Click += (s, e) => DeleteProfile();
|
||||
|
||||
_btnSync = new Button { Text = "Jetzt synchronisieren", Width = 150, Height = 30 };
|
||||
_btnSync = new Button { Text = "Synchronisieren", Width = 110, Height = 30 };
|
||||
_btnSync.Click += async (s, e) => await SyncSelectedProfile();
|
||||
|
||||
_btnSettings = new Button { Text = "Einstellungen", Width = 100, Height = 30 };
|
||||
_btnReset = new Button { Text = "Sync Reset", Width = 80, Height = 30 };
|
||||
_btnReset.Click += (s, e) => ResetSync();
|
||||
|
||||
_btnSettings = new Button { Text = "Einstellungen", Width = 95, Height = 30 };
|
||||
_btnSettings.Click += (s, e) => ShowSettings();
|
||||
|
||||
_btnInfo = new Button { Text = "Info", Width = 50, Height = 30 };
|
||||
_btnInfo.Click += (s, e) => ShowAbout();
|
||||
|
||||
buttonPanel.Controls.AddRange(new Control[] { _btnNew, _btnEdit, _btnDelete, _btnSync, _btnSettings, _btnInfo });
|
||||
buttonPanel.Controls.AddRange(new Control[] { _btnNew, _btnEdit, _btnDelete, _btnSync, _btnReset, _btnSettings, _btnInfo });
|
||||
|
||||
// Statusbar
|
||||
_statusBar = new StatusStrip();
|
||||
|
|
@ -255,6 +258,36 @@ namespace StarfaceOutlookSync.UI
|
|||
}
|
||||
}
|
||||
|
||||
private void ResetSync()
|
||||
{
|
||||
if (_profileList.SelectedItems.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Bitte ein Profil auswaehlen.", "Sync Reset",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var profile = _profileList.SelectedItems[0].Tag as SyncProfile;
|
||||
if (profile == null) return;
|
||||
|
||||
var msg = $"Sync-Zuordnungen fuer '{profile.Name}' zuruecksetzen?\n\n" +
|
||||
"Alle Kontakt-Verknuepfungen werden geloescht.\n" +
|
||||
"Beim naechsten Sync werden die Kontakte neu abgeglichen.\n" +
|
||||
"Es werden keine Kontakte geloescht.";
|
||||
|
||||
if (MessageBox.Show(msg, "Sync Reset",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
_profileManager.SaveMappings(profile.Id, new List<SyncMapping>());
|
||||
// LastSync auch zuruecksetzen
|
||||
profile.LastSync = "";
|
||||
_profileManager.UpdateProfile(profile);
|
||||
RefreshProfileList();
|
||||
MessageBox.Show("Sync-Zuordnungen wurden zurueckgesetzt.",
|
||||
"Sync Reset", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private Task SyncSelectedProfile()
|
||||
{
|
||||
if (_profileList.SelectedItems.Count == 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue