示例#1
0
        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);
            }
        }
 public void RemoveSyncableMember(ISyncableMedia item)
 {
     throw new NotImplementedException();
 }
 public void RemoveSyncableMember(ISyncableMedia item)
 {
     throw new NotImplementedException();
 }