Beispiel #1
0
 /// <summary>
 /// Called when synchronization should be performed.
 /// </summary>
 /// <param name="syncPreview">The sync preview.</param>
 protected virtual void OnSynchronize(SyncPreview syncPreview)
 {
     if (this.Synchronize != null)
     {
         this.Synchronize(syncPreview);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Called when the synchronization preview should be displayed.
 /// </summary>
 /// <param name="syncPreview">The sync preview.</param>
 protected virtual void OnPreview(SyncPreview syncPreview)
 {
     if (this.Preview != null)
     {
         this.Preview(syncPreview);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Determines which command should be performed based on the scan result.
        /// </summary>
        /// <param name="syncPreview">The sync preview.</param>
        private void ProcessResult(SyncPreview syncPreview)
        {
            if (Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.IsPlatformSupported)
            {
                var taskbarManager = Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance;
                taskbarManager.SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState.NoProgress);
            }

            if (this.canceled)
            {
                return;
            }

            if (syncPreview.SyncTaskPreviewBySyncTask.Count == 0)
            {
                this.OnPreviewNoFiles();
            }
            else
            {
                this.OnPreview(syncPreview);
            }
        }
        /// <summary>
        /// Performs the synchronization and shows the view.
        /// </summary>
        /// <param name="syncPreview">The sync preview.</param>
        public void Process(SyncPreview syncPreview)
        {
            this.totalCompletedOperations = 0;
            this.totalExpectedOperations  =
                syncPreview.CountOfActiveCopyFiles
                + syncPreview.CountOfActiveCreateDirectories
                + syncPreview.CountOfActiveDeleteDirectories
                + syncPreview.CountOfActiveDeleteFiles;

            if (Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.IsPlatformSupported)
            {
                var taskbarManager = Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance;
                taskbarManager.SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState.Normal);
            }

            var syncReportTask = Task <SyncReport> .Factory.StartNew(
                () => this.synchronizer.Synchronize(syncPreview));

            syncReportTask.ContinueWith(
                syncReport => this.OnResult(syncReport.Result),
                TaskScheduler.FromCurrentSynchronizationContext());

            this.MainViewModel.CurrentSyncView = this.synchronizeViewModel;
        }
Beispiel #5
0
 /// <summary>
 /// Displays the given <see cref="SyncPreview"/>.
 /// </summary>
 /// <param name="syncPreview">The <see cref="SyncPreview"/>.</param>
 public void Process(SyncPreview syncPreview)
 {
     this.previewViewModel.SyncPreview      = syncPreview;
     this.previewViewModel.SelectedFileList = 0;
     this.MainViewModel.CurrentSyncView     = this.previewViewModel;
 }
 public void MyTestInitialize()
 {
     this.target = new SyncPreview();
 }