public MainWindowViewModel(Window mainWindow) { _webScraper = new WebScraper(); _albumDownloader = new AlbumDownloader(true); _mainWindow = mainWindow; _destinationInput = _mainWindow.Find <TextBox>("DestinationInput"); _albumTitle = _mainWindow.Find <Label>("AlbumTitle"); _downloadLog = _mainWindow.Find <TextBlock>("DownloadLog"); _urlInput = _mainWindow.Find <TextBox>("UrlInput"); _titleBar = _mainWindow.Find <DockPanel>("TitleBar"); _applicationTitle = _mainWindow.Find <Label>("ApplicationTitle"); _downloadProgess = _mainWindow.Find <Label>("DownloadProgress"); ExitCommand = ReactiveCommand.Create(Exit); MinimizeCommand = ReactiveCommand.Create(Minimize); OpenFolderCommand = ReactiveCommand.Create(OpenFolder); ReleasesCommand = ReactiveCommand.Create(OpenReleases); IssuesCommand = ReactiveCommand.Create(OpenIssues); DownloadCommand = ReactiveCommand.Create(Download); _albumDownloader.FileDownloaded += AlbumDownloader_FileDownloaded; _albumDownloader.FileDownloading += AlbumDownloader_FileDownloading; _albumDownloader.FileExists += AlbumDownloader_FileExists; _albumDownloader.FileFailed += AlbumDownloader_FileFailed; _albumDownloader.ProgressChanged += AlbumDownloader_ProgressChanged; _titleBar.PointerPressed += TitleBar_PointerPressed; _destinationInput.PointerReleased += DestinationInput_PointerReleased; _applicationTitle.Content = $"cy client - v{Assembly.GetExecutingAssembly().GetName().Version}"; _destinationInput.Text = Environment.CurrentDirectory; _cancellationTokenSource = new CancellationTokenSource(); }
public void OneTimeSetUp() => _downloader = new AlbumDownloader(true);