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; }
public async Task InitAsync(AMSClientV3 client, SynchronizationContext context) { _amsClient = client; _context = context; var transformsList = await _amsClient.AMSclient.Transforms.ListAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName); IEnumerable <Task <TransformEntryV3> > transforms = transformsList.Select(async a => new TransformEntryV3(_context) { Name = a.Name, Description = a.Description, Jobs = (await _amsClient.AMSclient.Jobs.ListAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, a.Name)).Count(), LastModified = a.LastModified.ToLocalTime().ToString("G") } ); TransformEntryV3[] mappedItems = await Task.WhenAll(transforms); BindingList <TransformEntryV3> MyObservTransformthisPageV3 = new BindingList <TransformEntryV3>(mappedItems); DataSource = MyObservTransformthisPageV3; Task myTask = Task.Factory.StartNew(() => { BeginInvoke(new Action(() => { Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; Columns["Name"].Width = 200; Columns["Description"].Width = 200; Columns["LastModified"].Width = 130; })); }); _initialized = true; }
public void Init(AMSClientV3 client) { _client = client; IEnumerable <TransformEntryV3> transforms = _client.AMSclient.Transforms.List(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName).Select(a => new TransformEntryV3 { Name = a.Name, Description = a.Description, LastModified = a.LastModified.ToLocalTime().ToString("G") } ); BindingList <TransformEntryV3> MyObservTransformthisPageV3 = new BindingList <TransformEntryV3>(transforms.ToList()); DataSource = MyObservTransformthisPageV3; Task myTask = Task.Factory.StartNew(() => { BeginInvoke(new Action(() => { Columns["Name"].Width = 200; Columns["Description"].Width = 200; Columns["LastModified"].Width = 130; })); }); _initialized = true; }
public JobInformation(Mainform mainform, AMSClientV3 client) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _amsClient = client; _mainform = mainform; }
public void LoadTransforms(AMSClientV3 client, string selectedTransformName = null) { _client = client; _selectedTransformName = selectedTransformName; LoadTransforms(); }
public async Task LoadTransformsAsync(AMSClientV3 client, string selectedTransformName = null) { _client = client; _selectedTransformName = selectedTransformName; await LoadTransformsAsync(); }
public async Task LoadAssetsAsync(AMSClientV3 client, string searchExactAssetName = null) { _client = client; _searchExactAssetName = searchExactAssetName; await LoadAssetsAsync(); }
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; }
public LiveEventInformation(Mainform mainform, AMSClientV3 client) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; MyMainForm = mainform; _client = client; }
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; } } }
public MediaRU(AMSClientV3 AmsClientV3) { _client.DefaultRequestHeaders.Add("x-ms-version", "2.19"); _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); _client.DefaultRequestHeaders.Add("DataServiceVersion", "3.0;NetFx"); _client.DefaultRequestHeaders.Add("MaxDataServiceVersion", "3.0;NetFx"); GetRestAPIEndpointforAccountv2(AmsClientV3).GetAwaiter().GetResult(); }
public ImportHttp(AMSClientV3 amsClient, bool AzureStorageContainerSASListMode = false) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _AzureStorageContainerSASListMode = AzureStorageContainerSASListMode; _amsClientV3 = amsClient; _uniqueness = Guid.NewGuid().ToString().Substring(0, 13); }
public ExportToExcel(AMSClientV3 amsClient, List <Asset> selassets) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _amsClient = amsClient; _selassets = selassets; backgroundWorkerExcel.WorkerReportsProgress = true; backgroundWorkerExcel.WorkerSupportsCancellation = true; }
private async void ButtonLogin_Click(object sender, EventArgs e) { if (listViewAccounts.SelectedIndices.Count != 1) { return; } // code when used from pick-up LoginInfo = CredentialList.MediaServicesAccounts[listViewAccounts.SelectedIndices[0]]; if (LoginInfo == 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; } AmsClient = new AMSClientV3(LoginInfo.Environment, LoginInfo.AzureSubscriptionId, LoginInfo); AzureMediaServicesClient response = null; try { response = await AmsClient.ConnectAndGetNewClientV3Async(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (response == null) { return; } // let's save the credentials (SP) They may be updated by the user when connecting CredentialList.MediaServicesAccounts[listViewAccounts.SelectedIndices[0]] = AmsClient.credentialsEntry; SaveCredentialsToSettings(); try { // let's refresh storage accounts AmsClient.credentialsEntry.MediaService.StorageAccounts = (await AmsClient.AMSclient.Mediaservices.GetAsync(AmsClient.credentialsEntry.ResourceGroup, AmsClient.credentialsEntry.AccountName)).StorageAccounts; Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(Program.GetErrorMessage(ex), "Login error", MessageBoxButtons.OK, MessageBoxIcon.Error); Cursor = Cursors.Default; return; } DialogResult = DialogResult.OK; // form will close with OK result // else --> form won't close... }
public ChooseStreamingEndpoint(AMSClientV3 client, Asset asset, string path, string filter = null, PlayerType playertype = PlayerType.AzureMediaPlayer, bool displayBrowserSelection = false) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _amsClient = client; _asset = asset; _filter = filter; _playertype = playertype; _path = path; _displayBrowserSelection = displayBrowserSelection; }
private async Task GetRefreshTokenIfNeededAsync(AMSClientV3 AmsClientV3) { // If Service Principal mode, let's authenticate now (if token expired or first time) if (AmsClientV3.credentialsEntry.UseSPAuth && AmsClientV3.accessTokenForRestV2 == null && _tokenSPExpirationTime < DateTime.Now) { string URLAut = string.Format(AmsClientV3.environment.AADSettings.AuthenticationEndpoint + "/{0}/oauth2/token", AmsClientV3.credentialsEntry.AadTenantId); // if end user used the sp cli output then we don't know the MediaSercices Resource. Let's guess it. if (string.IsNullOrEmpty(AmsClientV3.environment.MediaServicesV2Resource)) { string[] names = Enum.GetNames(typeof(AzureEnvType)); IEnumerable <AzureEnvironment> envs = names.Select(n => new AzureEnvironment((AzureEnvType)Enum.Parse(typeof(AzureEnvType), n))); AmsClientV3.environment.MediaServicesV2Resource = envs.Where(e => e.ArmEndpoint == AmsClientV3.environment.ArmEndpoint).FirstOrDefault()?.MediaServicesV2Resource; } if (string.IsNullOrEmpty(AmsClientV3.environment.MediaServicesV2Resource)) { // not found the resource url return; } ; Dictionary <string, string> values = new Dictionary <string, string> { { "grant_type", "client_credentials" }, { "client_id", AmsClientV3.credentialsEntry.ADSPClientId }, { "client_secret", AmsClientV3.credentialsEntry.ClearADSPClientSecret }, { "resource", AmsClientV3.environment.MediaServicesV2Resource } }; FormUrlEncodedContent content = new FormUrlEncodedContent(values); using (HttpClient client = new HttpClient()) { HttpResponseMessage response = await client.PostAsync(URLAut, content); if (!response.IsSuccessStatusCode) { string message = await response.Content.ReadAsStringAsync(); dynamic jsonMessage = JObject.Parse(message); throw new Exception(response.ReasonPhrase + " " + jsonMessage?.error_description); } string responseStringAut = await response.Content.ReadAsStringAsync(); dynamic json = JObject.Parse(responseStringAut); _tokenSP = json.access_token; string expirein = json.expires_in; _tokenSPExpirationTime = DateTime.Now.AddSeconds(double.Parse(expirein)); } } }
public CreateLocator(AMSClientV3 client, List <Asset> SelectedAssets, bool extendlocator = false) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _SelectedAssets = SelectedAssets; _client = client; if (extendlocator) // dialog box used to extend locator expiration date { buttonOk.Text = AMSExplorer.Properties.Resources.CreateLocator_CreateLocator_UpdateLocatorS; this.Text = AMSExplorer.Properties.Resources.CreateLocator_CreateLocator_UpdateLocators2; groupBoxStart.Enabled = false; // do not propose to specificy start date } }
public BatchUploadFrame2(string BatchFolderPath, bool BatchProcessFiles, bool BatchProcessSubFolders, AMSClientV3 client) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _client = client; folders = Directory.GetDirectories(BatchFolderPath).ToList(); files = Directory.GetFiles(BatchFolderPath).ToList(); try { if (BatchProcessFiles) { foreach (string file in files) { ListViewItem it = checkedListBoxFiles.Items.Add(Path.GetFileName(file)); it.Checked = true; if (!AssetInfo.AssetFileNameIsOk(Path.GetFileName(file))) { it.ForeColor = Color.Red; } } } if (BatchProcessSubFolders) { folders.RemoveAll(f => Directory.GetFiles(f).Count() == 0); // we remove all folder with 0 file in it at the root string s; int filecount; foreach (string folder in folders) { filecount = Directory.GetFiles(folder).Count(); s = filecount > 1 ? AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_01Files : AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_01File; ListViewItem it = checkedListBoxFolders.Items.Add(string.Format(s, Path.GetFileName(folder), filecount)); it.Checked = true; if (AssetInfo.ReturnFilenamesWithProblem(Directory.GetFiles(folder).ToList()).Count > 0) { it.ForeColor = Color.Red; } } } } catch (Exception e) { ErrorConnect = true; DialogResult = DialogResult.None; MessageBox.Show(AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_ErrorWhenReadingFilesOrFolders + Constants.endline + e.Message, AMSExplorer.Properties.Resources.AMSLogin_buttonExport_Click_Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public UploadOptionsUI(AMSClientV3 amsClient, bool multifilesMode) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _amsClientV3 = amsClient; _multifilesMode = multifilesMode; ControlsResetToDefault(); if (multifilesMode) { groupBoxMultifiles.Visible = true; buttonAdvancedOptions.Visible = false; } }
public async Task <InfoMediaRU> GetInfoMediaRU(AMSClientV3 AmsClientV3) { await GetRefreshTokenIfNeeded(AmsClientV3); string URL = _restEndpoint + "EncodingReservedUnitTypes"; string token = AmsClientV3.accessTokenForRestV2 != null ? AmsClientV3.accessTokenForRestV2.AccessToken : _tokenSP; _client.DefaultRequestHeaders.Remove("Authorization"); _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); string responseString = await _client.GetStringAsync(URL); _myanswer = MediaRUv2Answer.FromJson(responseString).Value[0]; return(_myanswer); }
public static int?ReturnNumberAssetFilters(string assetName, AMSClientV3 client) { client.RefreshTokenIfNeeded(); IPage <AssetFilter> filters; try { filters = client.AMSclient.AssetFilters.List(client.credentialsEntry.ResourceGroup, client.credentialsEntry.AccountName, assetName); } catch { return(null); } return(filters.Count()); }
public NewAsset(AMSClientV3 amsClient, bool displayAsAdvancedOptionWhenUpload = false) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _amsClientV3 = amsClient; if (displayAsAdvancedOptionWhenUpload) { labelStorage.Visible = comboBoxStorage.Visible = false; labelNewAsset.Text = "Asset creation options"; buttonOk.Text = "Ok"; } else { Task.Run(async() => await ControlsResetToDefaultAsync()); } }
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 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 async Task GetRestAPIEndpointforAccountv2IfNeededAsync(AMSClientV3 AmsClientV3) { if (_restEndpoint != null) { return; // we already know the restpoint, no need to get it } // This method get the RESTApiEndpoint URL string token = AmsClientV3.accessToken?.AccessToken; // if SP if (AmsClientV3.accessToken == null && AmsClientV3.credentialsEntry.UseSPAuth) { // let's get the current token in Service Principal mode TokenCacheItem accessTokenCache = TokenCache.DefaultShared.ReadItems() .Where(t => t.ClientId == AmsClientV3.credentialsEntry.ADSPClientId) .OrderByDescending(t => t.ExpiresOn) .First(); token = accessTokenCache?.AccessToken; } if (token == null) { return; } string URL = AmsClientV3.environment.ArmEndpoint + AmsClientV3.credentialsEntry.MediaService.Id.Substring(1) + "?api-version=2015-10-01"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); HttpResponseMessage response = await client.GetAsync(URL); if (response.IsSuccessStatusCode) { string str = await response.Content.ReadAsStringAsync(); dynamic json = JObject.Parse(str); _restEndpoint = json.properties.apiEndpoints[0].endpoint; } } }
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(); }
public async Task SetMediaRUAsync(AMSClientV3 AmsClientV3, int?Number, int?ReservedUniType) { if (_myanswer == null) { throw new Exception(); } await GetRefreshTokenIfNeededAsync(AmsClientV3); await GetRestAPIEndpointforAccountv2IfNeededAsync(AmsClientV3); string URL = _restEndpoint + "EncodingReservedUnitTypes(guid'" + _myanswer.AccountId.ToString() + "')"; string token = AmsClientV3.accessTokenForRestV2 != null ? AmsClientV3.accessTokenForRestV2.AccessToken : _tokenSP; _client.DefaultRequestHeaders.Remove("Authorization"); _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); dynamic myObject = (dynamic) new JObject(); if (Number != null) { myObject.CurrentReservedUnits = (int)Number; } if (ReservedUniType != null) { myObject.ReservedUnitType = (int)ReservedUniType; } StringContent content = new StringContent(myObject.ToString(), Encoding.UTF8, "application/json"); HttpResponseMessage response = await _client.PutAsync(URL, content); if (!response.IsSuccessStatusCode) { string message = await response.Content.ReadAsStringAsync(); dynamic json = JObject.Parse(message); throw new Exception(response.ReasonPhrase + " " + json?["odata.error"]?.message?.value); } }
public UploadOptions(AMSClientV3 amsClient, bool multifilesMode) { InitializeComponent(); Icon = Bitmaps.Azure_Explorer_ico; _amsClientV3 = amsClient; ControlsResetToDefault(); if (multifilesMode) { groupBoxMultifiles.Visible = true; } 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; }
public void Init(AMSClientV3 client) { IEnumerable <StreamingEndpointEntry> originquery; _client = client; _client.RefreshTokenIfNeeded(); originquery = _client.AMSclient.StreamingEndpoints.List(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName).Select(o => new StreamingEndpointEntry { Name = o.Name, Id = o.Id, Description = o.Description, CDN = ((bool)o.CdnEnabled) ? StreamingEndpointInformation.ReturnDisplayedProvider(o.CdnProvider) ?? "CDN" : string.Empty, ScaleUnits = StreamingEndpointInformation.ReturnTypeSE(o) != StreamingEndpointInformation.StreamEndpointType.Premium ? string.Empty : ((int)o.ScaleUnits).ToString(), Type = StreamingEndpointInformation.ReturnTypeSE(o), State = (StreamingEndpointResourceState)o.ResourceState, LastModified = ((DateTime)o.LastModified).ToLocalTime() }); SortableBindingList <StreamingEndpointEntry> MyObservOriginInPage = new SortableBindingList <StreamingEndpointEntry>(originquery.Take(0).ToList()); this.DataSource = MyObservOriginInPage; this.Columns["Name"].Width = 300; this.Columns["State"].Width = 100; this.Columns["CDN"].Width = 120; this.Columns["Description"].Width = 230; this.Columns["ScaleUnits"].Width = 100; this.Columns["ScaleUnits"].HeaderText = "Streaming Units"; this.Columns["LastModified"].Width = 150; this.Columns["LastModified"].HeaderText = "Last modified"; WorkerRefreshStreamingEndpoints = new BackgroundWorker(); WorkerRefreshStreamingEndpoints.WorkerSupportsCancellation = true; WorkerRefreshStreamingEndpoints.DoWork += new System.ComponentModel.DoWorkEventHandler(this.WorkerRefreshStreamingEndpoints_DoWork); _initialized = true; }