示例#1
0
        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);
            }
        }
示例#2
0
 public static DownloadManager GetInstance()
 {
     return(_instance ?? (_instance = new DownloadManager()));
 }
示例#3
0
 public QueueManager(QueueManagerViewModel viewModel)
 {
     DataContext      = viewModel;
     _downloadManager = DownloadManager.GetInstance();
     InitializeComponent();
 }