private async Task DownloadfileAsync() { if (!Directory.Exists(destnationfolder)) { System.IO.Directory.CreateDirectory(destnationfolder); } filenames = new List<string>(); string url = ServiceConfig.BaseURL + string.Format(ServiceConfig.filenamelistFormat, "YN", "ACHE", "46"); filenames = await CommonRepo.Getappendixnames(url); foreach (string filename in filenames) { string completename = destnationfolder + "\\" + filename; if (File.Exists(completename)) { continue; } string result = await FileService.DownLoad(destnationfolder, "YN", filename); } if (filenames.Count == 0) { System.Windows.Forms.MessageBox.Show("无相关附件!"); return; } Process.Start(destnationfolder); System.Windows.Forms.MessageBox.Show("已为您打开附件文件夹!"); return; }
public async void Downloadfile(object sender, RoutedEventArgs e) { filenames = new List <string>(); string url = ServiceConfig.BaseURL + string.Format(ServiceConfig.filenamelistFormat, "YN", objectname, objectid.ToString()); filenames = await CommonRepo.Getappendixnames(url); DownloadList downloadfilewindow = new DownloadList(this); downloadfilewindow.Show(); //await DownloadfileAsync(); }