public DummyFileTransfersTrayViewModel() { this.CompletedTransfers = new BindableCollection<FileTransferViewModel>(); this.InProgressTransfers = new BindableCollection<FileTransferViewModel>(); var completedFileTransfer1 = new FileTransfer("folder", "path.pdf", ItemChangedItemType.File, ItemChangedActionType.Update); completedFileTransfer1.SetComplete(null, false); var completedFileTransfer2 = new FileTransfer("folder", "a really very long path that's far too long to sit on the page.h", ItemChangedItemType.File, ItemChangedActionType.Delete); completedFileTransfer2.SetComplete("Something went very wrong", true); //this.CompletedTransfers.Add(new FileTransferViewModel(completedFileTransfer1)); this.CompletedTransfers.Add(new FileTransferViewModel(completedFileTransfer2)); var inProgressTransfer1 = new FileTransfer("folder", "path.txt", ItemChangedItemType.File, ItemChangedActionType.Update); inProgressTransfer1.SetDownloadProgress(5*1024*1024, 100*1024*1024); var inProgressTransfer2 = new FileTransfer("folder", "path", ItemChangedItemType.Folder, ItemChangedActionType.Update); this.InProgressTransfers.Add(new FileTransferViewModel(inProgressTransfer1)); this.InProgressTransfers.Add(new FileTransferViewModel(inProgressTransfer2)); this.InConnectionRate = "1.2MB"; this.OutConnectionRate = "0.0MB"; this.AnyTransfers = true; }
public FileTransferViewModel(FileTransfer fileTransfer) { this.completedTimeAgoUpdateTimer = new DispatcherTimer() { Interval = TimeSpan.FromMinutes(1), }; this.completedTimeAgoUpdateTimer.Tick += (o, e) => this.NotifyOfPropertyChange(() => this.CompletedTimeAgo); this.completedTimeAgoUpdateTimer.Start(); this.FileTransfer = fileTransfer; this.Path = Pri.LongPath.Path.GetFileName(this.FileTransfer.Path); this.FullPath = this.FileTransfer.Path; this.FolderId = this.FileTransfer.FolderId; this.Icon = ShellTools.GetIcon(this.FileTransfer.Path, this.FileTransfer.ItemType != ItemChangedItemType.Folder); this.WasDeleted = this.FileTransfer.ActionType == ItemChangedActionType.Delete; this.UpdateState(); }
public FileTransferChangedEventArgs(FileTransfer fileTransfer) { this.FileTransfer = fileTransfer; }
private void OnTransferCompleted(FileTransfer fileTransfer) { this.eventDispatcher.Raise(this.TransferCompleted, new FileTransferChangedEventArgs(fileTransfer)); }