private Updater() { CheckCommand = new DelegateCommand(async() => { CheckCommand.CanExecute = false; bool result = await TryFindUpdateAsync(); Status = result ? UpdaterStatus.Download : UpdaterStatus.Check; if (result && isautoupdate) { DispatcherHelper.UIDispatcher.Invoke(() => { if (MessageBox.Show($"{StringTable.Update_Text_Download}{NewVersion}", StringTable.Update, MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK) { new AboutWindow { Owner = Application.Current.MainWindow } } .ShowDialog(); }); if (Config.Current.AutoDownloadUpdate) { DownloadCommand.Execute(null); } else { isautoupdate = false; } }
public void TestMethod1() { FTP myftp = new FTP("192.168.18.29", 21); DownloadCommand cmd = new DownloadCommand(myftp, "Game.dll", "G:\\"); cmd.Execute(); Thread.Sleep(10); DownloadContinue cmd2 = (DownloadContinue)cmd.Abort(); cmd2.Execute(); }
/// <summary> /// 下载文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void menu_download_Click(object sender, EventArgs e) { try { ToolStripMenuItem load = (ToolStripMenuItem)sender; string path = load.Tag.ToString(); string destination; FolderBrowserDialog Fbd = new FolderBrowserDialog(); if (Fbd.ShowDialog() == DialogResult.OK) { destination = Fbd.SelectedPath + "\\"; TransferCommand transfer = new DownloadCommand(myFTP, path, destination); transfer.Execute(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Downloads the content from Amazon S3 and writes it to the specified file. /// If the key is not specified in the request parameter, /// the file name will used as the key name. /// </summary> /// <param name="request"> /// Contains all the parameters required to download an Amazon S3 object. /// </param> public void Download(TransferUtilityDownloadRequest request) { BaseCommand command = new DownloadCommand(this._s3Client, request); command.Execute(); }