private async void btnAddDict_Click(object sender, EventArgs e) { DictionaryInfo dictInfo; string path; using (var form = new AddDictForm(cbCategory)) { form.ShowDialog(this); if (form.DialogResult != DialogResult.OK) { return; } dictInfo = form.GetUploadData(); var mdbPath = form.GetFilePath(); try { AccessHelper.CheckExistPrimaryKey(AccessHelper.CreateMdbConnectionString(mdbPath)); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } path = ZipHelper.CreateZipDictionary(mdbPath, FileHelper.GetTemporaryDirectory()); } var id = StartTask(this, new TaskEventArgs() { Name = $"Добавление {dictInfo.FriendlyName}", Status = "Started" }); try { using (var client = new FileUploadClient()) { using (Stream file = new FileStream(path, FileMode.Open)) { await client.UploadAsync(dictInfo, file); } } RefreshTaskStatus(this, new TaskEventArgs() { Status = "Complete", Taskid = id }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { FileHelper.DeleteFolder(Path.GetDirectoryName(path)); } }