Esempio n. 1
0
        public async Task Synchronize()
        {
            await _locker.LockAsync();

            try
            {
                syncStatistics           = new SyncStatistics();
                syncStatistics.StartTime = DateTime.Now;


                this.OnSyncProgress(new SyncProgressEventArgs("Synchronization started..."));
                await UploadLocalChanges();
                await DownloadChanges();

                this.OnSyncProgress(new SyncProgressEventArgs("Synchronization finshed!"));
                syncStatistics.EndTime = DateTime.Now;
                this.OnSyncCompleted(new SyncCompletedEventArgs(null, syncStatistics));
            }
            catch (Exception ex)
            {
                syncStatistics.EndTime = DateTime.Now;
                this.OnSyncCompleted(new SyncCompletedEventArgs(ex, syncStatistics));
            }
            finally
            {
                _locker.Release();
            }
        }
Esempio n. 2
0
 public SyncCompletedEventArgs(Exception error, SyncStatistics statistics)
 {
     this.Error      = error;
     this.Statistics = statistics;
 }