public static async Task <Thumbnail> GetThumbnailsAsync( SyncRelationshipViewModel syncRelationship, string adapterEntryId, int sourceAdapterId, string relativePath) { string key = string.Format( "{0}_{1}", syncRelationship.GetSyncRelationship().Configuration.RelationshipId, adapterEntryId); if (!ThumbnailCache.Cache.ContainsKey(key)) { byte[] result1 = await syncRelationship .GetThumbnailAsync(sourceAdapterId, adapterEntryId, relativePath) .ConfigureAwait(false); if (result1 == null || result1.Length == 0) { ThumbnailCache.Cache[key] = null; } else { ThumbnailCache.Cache[key] = new Thumbnail(FromByteArray(result1)); } } return(ThumbnailCache.Cache[key]); }
public RelationshipEditorViewModel(SyncRelationshipViewModel relationship, bool isEditMode) : base(true) { this.Relationship = relationship; this.IsEditMode = isEditMode; this.MovePreviousCommand = new DelegatedCommand(this.MovePrevious, this.CanMovePrevious); this.MoveNextCommand = new DelegatedCommand(this.MoveNext, this.CanMoveNext); this.OKCommand = new DelegatedCommand(this.OK); this.CancelCommand = new DelegatedCommand(this.Cancel); this.CloseWindowCommand = new DelegatedCommand(this.CloseWindow); this.SyncSourcePageViewModel = new SyncSourcePageViewModel(this); this.TabPages.Add(this.SyncSourcePageViewModel); this.SyncDestinationPageViewModel = new SyncDestinationPageViewModel(this); this.TabPages.Add(this.SyncDestinationPageViewModel); this.SyncOptionsPageViewModel = new SyncOptionsPageViewModel(this); this.TabPages.Add(this.SyncOptionsPageViewModel); this.SyncPerformancePageViewModel = new SyncPerformancePageViewModel(this); this.TabPages.Add(this.SyncPerformancePageViewModel); this.SyncTriggeringPageViewModel = new SyncTriggeringPageViewModel(this); this.TabPages.Add(this.SyncTriggeringPageViewModel); this.SyncNamePageViewModel = new SyncNamePageViewModel(this); this.TabPages.Add(this.SyncNamePageViewModel); this.ErrorsChanged += (sender, args) => { Logger.Warning("RelationshipEditor: HasErrors is now " + this.HasErrors); }; foreach (TabPageViewModelBase tabPage in this.TabPages) { tabPage.LoadContext(); tabPage.LoadingComplete = true; } this.CurrentTabPage = this.TabPages.First(); }
public SyncJobViewModel(SyncJob syncJob, SyncRelationshipViewModel relationshipViewModel, bool loadFromHistory) : base(syncJob, relationshipViewModel) { this.loadFromHistory = loadFromHistory; this.SyncJob.Started += this.SyncJobOnSyncStarted; this.SyncJob.Finished += this.SyncJobOnSyncFinished; this.SyncJob.ProgressChanged += this.SyncJobOnProgressChanged; this.SyncJob.TriggerType = SyncTriggerType.Manual; this.BeginSyncJobCommand = new DelegatedCommand(o => this.BeginSyncJob()); this.ChangeMetricsList = new List <ChangeMetrics>() { new ChangeMetrics("Files"), new ChangeMetrics("Folders"), new ChangeMetrics("Bytes", true) }; if (syncJob.HasStarted) { this.StartTime = syncJob.StartTime; } if (syncJob.HasFinished) { this.EndTime = syncJob.EndTime ?? DateTime.MinValue; this.ItemsCopiedDisplayString = String.Format( "{0} files / {1}", this.SyncJob.FilesTotal, FileSizeConverter.Convert(this.SyncJob.BytesTotal, 1)); this.Duration = this.EndTime - this.StartTime; this.SetStatusDescription(); } if (this.SyncRelationship.State == SyncRelationshipState.Running) { this.SyncJobOnSyncStarted(this, new EventArgs()); } }
public RestoreJobViewModel(RestoreJob job, SyncRelationshipViewModel relationshipViewModel, bool loadFromHistory) : base(job, relationshipViewModel) { this.RestoreJob.ProgressChanged += this.RestoreJobOnProgressChanged; }