private void BathUploadFrame2_Load(object sender, EventArgs e) { if (ErrorConnect) { Close(); } _client.RefreshTokenIfNeeded(); foreach (StorageAccount storage in _client.AMSclient.Mediaservices.Get(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName).StorageAccounts) { string sname = AMSClientV3.GetStorageName(storage.Id); bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", sname, primary ? "(primary)" : ""), sname)); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } // comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", storage.Name, storage.IsDefault ? AMSExplorer.Properties.Resources.BatchUploadFrame2_BathUploadFrame2_Load_Default : ""), storage.Name)); // if (storage.Name == _context.DefaultStorageAccount.Name) comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } List <int> listInt = new List <int>() { 1, 2, 4, 8, 16, 32, 64 }; comboBoxBlockSize.Items.Clear(); listInt.ForEach(l => comboBoxBlockSize.Items.Add(l.ToString())); comboBoxBlockSize.SelectedIndex = 3; }
private async void BathUploadFrame2_LoadAsync(object sender, EventArgs e) { DpiUtils.InitPerMonitorDpi(this); // to scale the bitmap in the buttons HighDpiHelper.AdjustControlImagesDpiScale(panel1); if (ErrorConnect) { Close(); } await _client.RefreshTokenIfNeededAsync(); foreach (StorageAccount storage in (await _client.AMSclient.Mediaservices.GetAsync(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName)).StorageAccounts) { string sname = AMSClientV3.GetStorageName(storage.Id); bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", sname, primary ? "(primary)" : ""), sname)); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } } List <int> listInt = new List <int>() { 1, 2, 4, 8, 16, 32, 64 }; comboBoxBlockSize.Items.Clear(); listInt.ForEach(l => comboBoxBlockSize.Items.Add(l.ToString())); comboBoxBlockSize.SelectedIndex = 3; }
private void ImportHttp_Load(object sender, EventArgs e) { labelURLFileNameWarning.Text = string.Empty; textBoxAssetName.Text = "import-" + _uniqueness; _amsClientV3.RefreshTokenIfNeeded(); if (_AzureStorageContainerSASListMode) { labelExamples.Visible = false; labelSASListExample.Visible = true; labelTitle.Text = this.Text = AMSExplorer.Properties.Resources.ImportHttp_ImportHttp_Load_ImportFromSASContainerPath; } var storAccounts = _amsClientV3.AMSclient.Mediaservices.Get(_amsClientV3.credentialsEntry.ResourceGroup, _amsClientV3.credentialsEntry.AccountName).StorageAccounts; comboBoxStorage.Items.Clear(); foreach (var storage in storAccounts) { string sname = AMSClientV3.GetStorageName(storage.Id); bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", sname, primary ? "(primary)" : string.Empty), sname)); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } } }
private void ControlsResetToDefault() { _amsClientV3.RefreshTokenIfNeeded(); var storAccounts = Task.Run(() => _amsClientV3.AMSclient.Mediaservices.GetAsync(_amsClientV3.credentialsEntry.ResourceGroup, _amsClientV3.credentialsEntry.AccountName)).GetAwaiter().GetResult().StorageAccounts; comboBoxStorage.Items.Clear(); foreach (Microsoft.Azure.Management.Media.Models.StorageAccount storage in storAccounts) { string sname = AMSClientV3.GetStorageName(storage.Id); bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", sname, primary ? "(primary)" : string.Empty), sname)); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } } }
private async Task <StorageAccount> ReturnSelectedStorageAsync() { StorageAccount SelectedStorage = null; if (dataGridViewStorage.SelectedRows.Count == 1) { await _amsClient.RefreshTokenIfNeededAsync(); DataGridViewRow row = dataGridViewStorage.SelectedRows[0]; int index = dataGridViewStorage.Columns["Id"].Index; string storagename = AMSClientV3.GetStorageName(row.Cells[index].Value.ToString()); SelectedStorage = (await _amsClient.AMSclient.Mediaservices.GetAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName)) .StorageAccounts.Where(s => AMSClientV3.GetStorageName(s.Id) == storagename).FirstOrDefault(); } return(SelectedStorage); }
private void ControlsResetToDefault() { _amsClientV3.RefreshTokenIfNeeded(); IList <StorageAccount> storAccounts = _amsClientV3.AMSclient.Mediaservices.Get(_amsClientV3.credentialsEntry.ResourceGroup, _amsClientV3.credentialsEntry.AccountName).StorageAccounts; comboBoxStorage.Items.Clear(); foreach (StorageAccount storage in storAccounts) { string sname = AMSClientV3.GetStorageName(storage.Id); bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(string.Format("{0} {1}", sname, primary ? "(primary)" : string.Empty), sname)); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } } }
private void LiveOutputCreation_Load(object sender, EventArgs e) { this.Text = string.Format(this.Text, LiveEventName); checkBoxCreateLocator.Text = string.Format(checkBoxCreateLocator.Text, Properties.Settings.Default.DefaultLocatorDurationDaysNew); _client.RefreshTokenIfNeeded(); var storages = _client.AMSclient.Mediaservices.Get(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName).StorageAccounts; foreach (var storage in storages) { bool primary = (storage.Type == StorageAccountType.Primary); comboBoxStorage.Items.Add(new Item(AMSClientV3.GetStorageName(storage.Id) + (primary ? " (primary)" : string.Empty), AMSClientV3.GetStorageName(storage.Id))); if (primary) { comboBoxStorage.SelectedIndex = comboBoxStorage.Items.Count - 1; } } checkProgramName(); }
private async void listViewAccounts_SelectedIndexChanged(object sender, EventArgs e) { ErrorConnectingAMS = false; ErrorConnectingStorage = false; listBoxStorage.Items.Clear(); if (listViewAccounts.SelectedIndices.Count != 1) { return; } // code when used from pick-up DestinationLoginInfo = CredentialList.MediaServicesAccounts[listViewAccounts.SelectedIndices[0]]; if (DestinationLoginInfo == null) { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //MessageBox.Show(string.Format("The {0} cannot be empty.", labelE1.Text), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } this.Cursor = Cursors.WaitCursor; DestinationAmsClient = new AMSClientV3(DestinationLoginInfo.Environment, DestinationLoginInfo.AzureSubscriptionId, DestinationLoginInfo); AzureMediaServicesClient response = null; try { response = await DestinationAmsClient.ConnectAndGetNewClientV3Async(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Cursor = Cursors.Default; ErrorConnectingAMS = true; return; } if (response == null) { Cursor = Cursors.Default; ErrorConnectingAMS = true; return; } // let's save the credentials (SP) They may be updated by the user when connecting CredentialList.MediaServicesAccounts[listViewAccounts.SelectedIndices[0]] = DestinationAmsClient.credentialsEntry; //SaveCredentialsToSettings(); try { // let's refresh storage accounts DestinationAmsClient.credentialsEntry.MediaService.StorageAccounts = (await DestinationAmsClient.AMSclient.Mediaservices.GetAsync(DestinationAmsClient.credentialsEntry.ResourceGroup, DestinationAmsClient.credentialsEntry.AccountName)).StorageAccounts; foreach (var storage in DestinationAmsClient.credentialsEntry.MediaService.StorageAccounts) { string storageName = AMSClientV3.GetStorageName(storage.Id); int index = listBoxStorage.Items.Add(new Item(storageName + ((storage.Type == StorageAccountType.Primary) ? AMSExplorer.Properties.Resources.CopyAsset_listBoxAcounts_SelectedIndexChanged_Default : string.Empty), storageName)); if (storage.Type == StorageAccountType.Primary) { listBoxStorage.SelectedIndex = index; } } Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(Program.GetErrorMessage(ex), "Login error", MessageBoxButtons.OK, MessageBoxIcon.Error); Cursor = Cursors.Default; ErrorConnectingAMS = true; return; } // DialogResult = DialogResult.OK; // form will close with OK result // else --> form won't close... UpdateStatusButtonOk(); }