public IDisposable Bind( DocumentMessageModel model) { model.ShowCommand = ReactiveCommand.Create( (DocumentMessageModel m) => Explore(m), null, RxApp.MainThreadScheduler); return(model.ShowCommand.Subscribe()); }
private IObservable <bool> Download( DocumentMessageModel model) { var file = model.Document.Document_; return(_fileLoader.LoadFile(file, LoadPriority.Mid) .FirstAsync(f => f.Local != null && f.Local.IsDownloadingCompleted) .SubscribeOn(RxApp.TaskpoolScheduler) .ObserveOn(RxApp.MainThreadScheduler) .Select(f => f.Local.IsDownloadingCompleted)); }
public IDisposable Bind( DocumentMessageModel model) { model.DownloadCommand = ReactiveCommand.CreateFromObservable( (DocumentMessageModel m) => Download(m), null, RxApp.MainThreadScheduler); var file = model.Document.Document_; model.IsDownloaded = (file.Local?.IsDownloadingCompleted ?? false) && File.Exists(file.Local?.Path); return(model.DownloadCommand.Subscribe(isDownloaded => { model.IsDownloaded = isDownloaded; })); }
private bool Explore( DocumentMessageModel model) { var localFile = model.Document.Document_?.Local; if (localFile?.Path != null) { var fileInfo = new FileInfo(localFile.Path); if (fileInfo.Exists) { _fileExplorer.OpenDirectory(fileInfo); } } return(false); }