private void Synchronize(SynchronizeInfo syncInfo) { syncInfo.syncControl.Initialize(syncInfo.Source, syncInfo.Destination, syncInfo.FileName); if (syncInfo.syncControl.CanSynchronize()) { syncInfo.syncControl.Save(); syncInfo.Action(); syncInfo.syncControl.Restore(); } else { syncInfo.syncControl.Reset(); } }
private void OnRemoved(object sender, StorageChangedEventArgs e) { lock (removingLocker) { IStorage destination = Destination(e.Source); SynchronizeInfo syncInfo = new SynchronizeInfo { Source = e.Source, Destination = destination, FileName = Path.GetFileName(e.FullName), Action = () => { destination.Remove(Path.GetFileName(e.FullName)); }, syncControl = removingSyncControl }; Synchronize(syncInfo); } }