public ConflictViewModel(ConflictSet conflictSet, string folderName) { this.ConflictSet = conflictSet; this.FolderId = folderName; this.ConflictOptions = new BindableCollection <ConflictOptionViewModel>(this.ConflictSet.Conflicts.Select(x => new ConflictOptionViewModel(x))); // These bindings aren't called lazilly, so don't bother being lazy using (var icon = ShellTools.GetIcon(this.ConflictSet.File.FilePath, isFile: true)) { var bs = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); bs.Freeze(); this.Icon = bs; } }
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 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.Folder = this.FileTransfer.Folder; using (var icon = ShellTools.GetIcon(this.FileTransfer.Path, this.FileTransfer.ItemType != ItemChangedItemType.Dir)) { var bs = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); bs.Freeze(); this.Icon = bs; } this.WasDeleted = this.FileTransfer.ActionType == ItemChangedActionType.Delete; this.UpdateState(); }