public FileSystemSync(IFileSystemBrowser browser, ISyncResolver syncResolver, ISyncOperationRunner operationRunner) { if (browser == null) { throw new ArgumentNullException("browser", "Browser is null."); } else if (syncResolver == null) { throw new ArgumentNullException("syncResolver", "SyncResolver is null."); } else if (operationRunner == null) { throw new ArgumentNullException("operationRunner", "OperationRunner is null."); } Filters = new List <string>(); _browser = browser; _browser.ActionChanged += OnActionChanged; _browser.ErrorOccured += OnErrorOccured; _browser.ProgressChanged += BrowserProgressChanged; _syncResolver = syncResolver; _syncResolver.ActionChanged += OnActionChanged; _syncResolver.ProgressChanged += SyncResolverProgressChanged; _operationRunner = operationRunner; _operationRunner.ActionChanged += OnActionChanged; _operationRunner.ProgressChanged += OpeationRunnerProgressChanged; _operationRunner.ErrorOccured += OnErrorOccured; StopPending = false; }
public TrackViewModel(Track model, IFileSystemBrowser fileSystemBrowser, IWebAccessProxy webAccessProxy) { this.Model = model; FileSystemBrowser = fileSystemBrowser; WebAccessProxy = webAccessProxy; var noOngoingDownloadObservable = WebAccessProxy.FileLocationObservable.Select(x => x != FileLocation.Downloading); _TrackLocation = WebAccessProxy.FileLocationObservable .Select(x => x.ToString()).ToProperty(this, x => x.TrackLocation); Download = new ReactiveAsyncCommand(noOngoingDownloadObservable, 1); Download.Subscribe(_ => { string fileName = GetFileName(); string destinationPath = FileSystemBrowser.GetSaveAsLocation(fileName); if (String.IsNullOrEmpty(destinationPath)) { log.Info("Download cancelled - " + Model.Uri); return; } log.Info(String.Format("Download started. From {0} to {1}", Model.Uri, destinationPath)); SaveTo(destinationPath); }); _Duration = Model.DurationObservable.Select(DurationToString).ToProperty(this, x => x.Duration); }
private Node(ICamera camera, Uri address, IFileSystemBrowser browser) : this(camera, address, NodeType.Root, string.Empty, browser) { Type = address.AbsolutePath == "/" ? NodeType.Root : _browser.IsFile(address) ? NodeType.File : NodeType.Folder; }
internal Node(ICamera camera, Uri address, NodeType type, string size, IFileSystemBrowser browser) { _browser = browser; Camera = camera; Path = address; Type = type; Size = size; var segments = Path.AbsolutePath.Split('/'); Name = string.IsNullOrEmpty(segments.Last()) ? segments[segments.Length - 2] : segments.Last(); }
public ValidateModsViewModel(IComponentContext components) { _viewController = components.Resolve <IViewController>(); _validate = components.Resolve <IValidate>(); _fileSystemBrowser = components.Resolve <IFileSystemBrowser>(); _nxmHandle = components.Resolve <INxmHandle>(); _apiEndpoints = components.Resolve <IApiEndpoints>(); _downloadClient = components.Resolve <IDownloadClient>(); _apiBase = components.Resolve <IApiBase>(); _installBase = components.Resolve <IInstallBase>(); _viewController.ViewIndexChangedEvent += ViewControllerOnViewIndexChangedEvent; _nxmHandle.RecievedPipedDataEvent += QueueDownload; _downloadClient.DownloadUpdate += DownloadUpdate; }
public ValidateModsViewModel(IComponentContext components) { _viewController = components.Resolve <IViewController>(); _validate = components.Resolve <IValidate>(); _fileSystemBrowser = components.Resolve <IFileSystemBrowser>(); _nxmHandle = components.Resolve <INxmHandle>(); _apiEndpoints = components.Resolve <IApiEndpoints>(); _downloadClient = components.Resolve <IDownloadClient>(); _apiBase = components.Resolve <IApiBase>(); _installBase = components.Resolve <IInstallBase>(); _dialogController = components.Resolve <IDialogController>(); _logger = components.Resolve <ILogger>(); _viewController.ViewIndexChangedEvent += ViewControllerOnViewIndexChangedEvent; _nxmHandle.RecievedPipedDataEvent += QueueDownload; _downloadClient.DownloadUpdate += DownloadUpdate; BindingOperations.EnableCollectionSynchronization(MissingMods, _missingModsLocked); }
public static Node Create(IFileSystemBrowser browser) { var node = new Node(browser.Camera, browser.Address, browser); return(node); }
public override void InitializeComponent(ICore core) { this.FileSystemBrowser = core.Components.FileSystemBrowser; base.InitializeComponent(core); }