private void NewDownloadCommand_OnClick(object sender, RoutedEventArgs e) { var newDownloadWindow = new NewDownload(_downloadViewModel); if (newDownloadWindow.ShowDialog() == true) { var download = DownloadManager.CreateDownload( newDownloadWindow.FilePath.Text, newDownloadWindow.DestinationPath.Text, _downloadViewModel.SelectedQueue.Model); if (download.HasError) { Dispatcher.BeginInvoke((Action) delegate { MessageBox.Show(download.ErrorMessage, "Download error", MessageBoxButton.OK, MessageBoxImage.Error); }); return; } _downloadManager.AddDownload(download); } }
public static DownloadManager GetInstance() { return(_instance ?? (_instance = new DownloadManager())); }
public QueueManager(QueueManagerViewModel viewModel) { DataContext = viewModel; _downloadManager = DownloadManager.GetInstance(); InitializeComponent(); }