Ejemplo n.º 1
0
        public IDisposable Bind(
            DocumentMessageModel model)
        {
            model.ShowCommand = ReactiveCommand.Create(
                (DocumentMessageModel m) => Explore(m), null, RxApp.MainThreadScheduler);

            return(model.ShowCommand.Subscribe());
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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;
            }));
        }
Ejemplo n.º 4
0
        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);
        }