private void DoCloneChannels() { var SelectedChannels = ReturnSelectedChannels(); CopyAsset form = new CopyAsset(_context, 1, CopyAssetBoxMode.CloneChannel); if (form.ShowDialog() == DialogResult.OK) { if (!form.SingleDestinationAsset) // standard mode: 1:1 asset copy { foreach (IChannel channel in SelectedChannels) { // Start a worker thread that does asset copy. Task.Factory.StartNew(() => ProcessCloneChannelToAnotherAMSAccount(form.DestinationLoginCredentials, form.DestinationStorageAccount, channel)); } } } }
private async void DoCopyAssetToAnotherAMSAccount() { List<IAsset> SelectedAssets = ReturnSelectedAssets(); CopyAsset form = new CopyAsset(_context, SelectedAssets.Count, CopyAssetBoxMode.CopyAsset) { CopyAssetName = string.Format("Copy of {0}", Constants.NameconvAsset), EnableSingleDestinationAsset = SelectedAssets.Count > 1 }; if (form.ShowDialog() == DialogResult.OK) { bool usercanceled = false; var storagekeys = BuildStorageKeyDictionary(SelectedAssets, form.DestinationLoginCredentials, ref usercanceled, _context.DefaultStorageAccount.Name, _credentials.StorageKey, form.DestinationStorageAccount); if (!usercanceled) { if (!form.SingleDestinationAsset) // standard mode: 1:1 asset copy { foreach (IAsset asset in SelectedAssets) { int index = DoGridTransferAddItem(string.Format("Copy asset '{0}' to account '{1}'", asset.Name, form.DestinationLoginCredentials.AccountName), TransferType.ExportToOtherAMSAccount, Properties.Settings.Default.useTransferQueue); // Start a worker thread that does asset copy. Task.Factory.StartNew(() => ProcessExportAssetToAnotherAMSAccount(form.DestinationLoginCredentials, form.DestinationStorageAccount, storagekeys, new List<IAsset>() { asset }, form.CopyAssetName.Replace(Constants.NameconvAsset, asset.Name), index, form.DeleteSourceAsset, form.CopyDynEnc, form.RewriteLAURL, form.CloneAssetFilters)); } } else // merge all assets into a single asset { if (SelectedAssets.Any(a => a.Options != AssetCreationOptions.None)) { MessageBox.Show("Assets cannot be merged as at least one asset is encrypted.", "Asset encrypted", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { int index = DoGridTransferAddItem(string.Format("Copy several assets to account '{0}'", form.DestinationLoginCredentials.AccountName), TransferType.ExportToOtherAMSAccount, Properties.Settings.Default.useTransferQueue); // Start a worker thread that does asset copy. Task.Factory.StartNew(() => ProcessExportAssetToAnotherAMSAccount(form.DestinationLoginCredentials, form.DestinationStorageAccount, storagekeys, SelectedAssets, form.CopyAssetName.Replace(Constants.NameconvAsset, SelectedAssets.FirstOrDefault().Name), index, form.DeleteSourceAsset)); } } DotabControlMainSwitch(Constants.TabTransfers); } } }
private void DoClonePrograms() { var SelectedPrograms = ReturnSelectedPrograms(); CopyAsset form = new CopyAsset(_context, 1, CopyAssetBoxMode.CloneProgram); if (form.ShowDialog() == DialogResult.OK) { if (!form.SingleDestinationAsset) // standard mode: 1:1 asset copy { foreach (IProgram program in SelectedPrograms) { // Start a worker thread that does asset copy. Task.Factory.StartNew(() => ProcessCloneProgramToAnotherAMSAccount(form.DestinationLoginCredentials, form.DestinationStorageAccount, program, form.CopyDynEnc, form.RewriteLAURL, form.CloneLocators, form.CloneAssetFilters)); } } } }
private void DoCloneChannels() { var SelectedChannels = ReturnSelectedChannels(); CopyAsset form = new CopyAsset(_context, 1, CopyAssetBoxMode.CloneChannel); if (form.ShowDialog() == DialogResult.OK) { if (!form.SingleDestinationAsset) // standard mode: 1:1 asset copy { foreach (IChannel channel in SelectedChannels) { //int index = DoGridTransferAddItem(string.Format("Copy asset '{0}' to account '{1}'", asset.Name, form.DestinationLoginCredentials.AccountName), TransferType.ExportToOtherAMSAccount, Properties.Settings.Default.useTransferQueue); // Start a worker thread that does asset copy. Task.Factory.StartNew(() => ProcessCloneChannelToAnotherAMSAccount(form.DestinationLoginCredentials, form.DestinationStorageAccount, channel)); } } } }