/// <summary>
 /// Called by sync manager when a record is synced
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnUpdateStatus(object sender, SyncEngine.Events.ProgressEventArgs e)
 {
     Console.WriteLine(e.Status);
 }
        private void OnSyncProgress(ISyncable item, SyncEngine.ProgressType type, int filesTransferred, int totalItems)
        {
            using (new OperationLogger())
            {
                string displayName = null;
                string format = null;
                if (item != null)
                {
                    displayName = item.Properties.ObjectForKey("Name") as string;
                    if (string.IsNullOrEmpty(displayName))
                    {
                        ISyncableMedia media = item as ISyncableMedia;
                        if (media != null)
                        {
                            displayName = media.DisplayName;
                        }
                        if (string.IsNullOrEmpty(displayName) && (item.Location != null))
                        {
                            displayName = item.Location.LocalPath;
                        }
                    }
                }
                switch (type)
                {
                    case SyncEngine.ProgressType.Add:
                    case SyncEngine.ProgressType.Update:
                        format = Resources.TransferProgressCopyText;
                        break;

                    case SyncEngine.ProgressType.Delete:
                        format = Resources.TransferProgressDeleteText;
                        break;

                    case SyncEngine.ProgressType.WaitingForDeferred:
                        format = Resources.TranferProgressTranscoding;
                        break;

                    case SyncEngine.ProgressType.Retrying:
                        format = Resources.TransferProgressRetryText;
                        break;

                    default:
                        throw new ArgumentException("invalid value", "type");
                }
                string caption = string.Format(CultureInfo.CurrentCulture, format, new object[] { string.IsNullOrEmpty(displayName) ? Resources.UnknownFileNameText : displayName });
                string subHeader = string.Format(CultureInfo.CurrentCulture, Resources.SyncProgressRemainingItems, new object[] { totalItems - filesTransferred });
                this.UpdateProgressBar(null, subHeader, caption, (float) (filesTransferred * 100), (float) (totalItems * 100), false);
            }
        }
 /// <summary>
 /// Called by sync manager when starting a new table
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnSyncStart(object sender, SyncEngine.Events.SyncStartedArgs e)
 {
     Console.WriteLine("\nSyncing... " + e.Status);
 }
 /// <summary>
 /// Called by sync when a table/entity failes to sync
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnSyncFailure(object sender, SyncEngine.Events.SyncFailedEventArgs e)
 {
     Console.Clear();
     Console.WriteLine("\n" + e.Status);
     Console.WriteLine("Error: " + e.ExceptionObject.Message);
 }
 /// <summary>
 /// Called by sync when all tables have been sync successfully
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnSyncComplete(object sender, SyncEngine.Events.SyncCompleteArgs e)
 {
     Console.WriteLine("\n" + e.Status);
     Console.Write("\nPress any key to continue...");
     Console.ReadKey();
 }
 /// <summary>
 /// Called by sync manager when cleaning up SyncRecords
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnCleanUp(object sender, SyncEngine.Events.SyncCleanupArgs e)
 {
     Console.WriteLine("\nCleaning up - " + e.Status);
 }
 /// <summary>
 /// Called by sync when a table/entity failes to sync
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Sync_OnSyncFailure(object sender, SyncEngine.Events.SyncFailedEventArgs e)
 {
     Console.Clear();
     Console.WriteLine("\n" + e.Status);
     Console.WriteLine("Error: " + (e.ExceptionObject.InnerException?.Message ?? e.ExceptionObject.Message));
     Console.Write("\nPress any key to continue...");
     Console.ReadKey();
 }