private async void DoBatchUpload()
        {
            BatchUploadFrame1 form = new BatchUploadFrame1();
            if (form.ShowDialog() == DialogResult.OK)
            {
                BatchUploadFrame2 form2 = new BatchUploadFrame2(form.BatchFolder, form.BatchProcessFiles, form.BatchProcessSubFolders, _context) { Left = form.Left, Top = form.Top };
                if (form2.ShowDialog() == DialogResult.OK)
                {
                    DotabControlMainSwitch(Constants.TabTransfers);

                    Task.Run(async () =>
                    {
                        List<Task> MyTasks = new List<Task>();
                        foreach (string folder in form2.BatchSelectedFolders)
                        {
                            int index = DoGridTransferAddItem(string.Format("Upload of folder '{0}'", Path.GetFileName(folder)), TransferType.UploadFromFolder, Properties.Settings.Default.useTransferQueue);
                            MyTasks.Add(Task.Factory.StartNew(() => ProcessUploadFromFolder(folder, index, form.EncryptionOption, form2.StorageSelected)));
                        }

                        foreach (string file in form2.BatchSelectedFiles)
                        {
                            int index = DoGridTransferAddItem("Upload of file '" + Path.GetFileName(file) + "'", TransferType.UploadFromFile, Properties.Settings.Default.useTransferQueue);
                            MyTasks.Add(Task.Factory.StartNew(() => ProcessUploadFileAndMore(
                                file,
                                index,
                                Properties.Settings.Default.useStorageEncryption ? AssetCreationOptions.StorageEncrypted : AssetCreationOptions.None,
                                null,
                                form2.StorageSelected)));
                        }
                        await Task.WhenAll(MyTasks);

                        // DoRefreshGridAssetV(false);
                    }
                       );
                }
            }
        }
 private void DoBatchUpload()
 {
     BatchUploadFrame1 form = new BatchUploadFrame1();
     if (form.ShowDialog() == DialogResult.OK)
     {
         BatchUploadFrame2 form2 = new BatchUploadFrame2(form.BatchFolder, form.BatchProcessFiles, form.BatchProcessSubFolders, _context);
         if (form2.ShowDialog() == DialogResult.OK)
         {
             int index;
             foreach (string folder in form2.BatchSelectedFolders)
             {
                 index = DoGridTransferAddItem(string.Format("Upload of folder '{0}'", Path.GetFileName(folder)), TransferType.UploadFromFolder, Properties.Settings.Default.useTransferQueue);
                 Task.Factory.StartNew(() => ProcessUploadFromFolder(folder, index, form2.StorageSelected));
             }
             foreach (string file in form2.BatchSelectedFiles)
             {
                 index = DoGridTransferAddItem("Upload of file '" + Path.GetFileName(file) + "'", TransferType.UploadFromFile, Properties.Settings.Default.useTransferQueue);
                 Task.Factory.StartNew(() => ProcessUploadFileAndMore(file, index, null, form2.StorageSelected));
             }
             DotabControlMainSwitch(Constants.TabTransfers);
             DoRefreshGridAssetV(false);
         }
     }
 }