private void UpdateControls() { if (m_TagsByCategory == null) { return; } m_Listen = false; try { ITagsDBReadByLanguage tagsRead = TagsModule.GetTagsDB().GetReadInterfaceByLanguage(m_LanguageId); m_Categories = tagsRead.GetAllCategories(); categoriesBox.BeginUpdate(); categoriesBox.Items.Clear(); int selIndex = -1; foreach (CategoryForLanguage category in m_Categories) { categoriesBox.Items.Add(category.Name); if (category.Id == m_SelectedCategoryId) { selIndex = categoriesBox.Items.Count - 1; } } categoriesBox.Items.Add(StringResources.All); if (selIndex == -1) { selIndex = 0; if (m_Categories.Count > 0) { m_SelectedCategoryId = m_Categories[0].Id; } else { m_SelectedCategoryId = -2; } } categoriesBox.SelectedIndex = selIndex; categoriesBox.EndUpdate(); UpdateTagsBox(tagsRead); } catch (Ares.Tags.TagsDbException ex) { MessageBox.Show(this, String.Format(StringResources.TagsDbError, ex.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); } m_Listen = true; }
private void UpdateControls() { m_Listen = false; tagCategoryCombinationBox.Enabled = m_Element != null; tagCategoryCombinationBox.SelectedIndex = (m_Element != null) ? (int)m_Element.TagCategoryCombination : 0; fadeUpDown.Enabled = m_Element != null; fadeUpDown.Value = m_Element != null ? m_Element.FadeTime : 0; try { ITagsDBReadByLanguage tagsRead = TagsModule.GetTagsDB().GetReadInterfaceByLanguage(m_LanguageId); languageBox.BeginUpdate(); languageBox.Items.Clear(); m_Languages = tagsRead.GetAllLanguages(); int selIndex = -1; foreach (LanguageForLanguage language in m_Languages) { languageBox.Items.Add(language.Name); if (language.Id == m_LanguageId) { selIndex = languageBox.Items.Count - 1; } } if (selIndex != -1) { languageBox.SelectedIndex = selIndex; } languageBox.EndUpdate(); m_Categories = tagsRead.GetAllCategories(); categoriesBox.BeginUpdate(); categoriesBox.Items.Clear(); selIndex = -1; foreach (CategoryForLanguage category in m_Categories) { categoriesBox.Items.Add(category.Name); if (category.Id == m_SelectedCategoryId) { selIndex = categoriesBox.Items.Count - 1; } } categoriesBox.Items.Add(StringResources.All); if (selIndex == -1) { selIndex = 0; if (m_Categories.Count > 0) { m_SelectedCategoryId = m_Categories[0].Id; } else { m_SelectedCategoryId = -2; } } categoriesBox.SelectedIndex = selIndex; categoriesBox.EndUpdate(); UpdateTagsBox(tagsRead); } catch (Ares.Tags.TagsDbException ex) { MessageBox.Show(this, String.Format(StringResources.TagsDbError, ex.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); } m_Listen = true; }
private void UpdateControls() { bool hasFiles = (m_Files != null && m_Files.Count > 0); tagsBox.Enabled = hasFiles; shareButton.Enabled = hasFiles; downloadButton.Enabled = hasFiles; id3Button.Enabled = hasFiles; musicBrainzButton.Enabled = hasFiles; addTagButton.Enabled = hasFiles; confirmButton.Enabled = hasFiles; m_Listen = false; try { ITagsDBReadByLanguage tagsRead = TagsModule.GetTagsDB().GetReadInterfaceByLanguage(m_LanguageId); m_Categories = tagsRead.GetAllCategories(); categoriesBox.BeginUpdate(); categoriesBox.Items.Clear(); int selIndex = -1; foreach (CategoryForLanguage category in m_Categories) { categoriesBox.Items.Add(category.Name); if (category.Id == m_SelectedCategoryId) { selIndex = categoriesBox.Items.Count - 1; } } categoriesBox.Items.Add(StringResources.All); if (m_SelectedCategoryId == -2) { selIndex = categoriesBox.Items.Count - 1; } if (selIndex == -1) { selIndex = 0; if (m_Categories.Count > 0) { m_SelectedCategoryId = m_Categories[0].Id; } else { m_SelectedCategoryId = -2; } } categoriesBox.SelectedIndex = selIndex; categoriesBox.EndUpdate(); UpdateTagsBox(tagsRead); languageBox.BeginUpdate(); languageBox.Items.Clear(); m_Languages = tagsRead.GetAllLanguages(); selIndex = -1; foreach (LanguageForLanguage language in m_Languages) { languageBox.Items.Add(language.Name); if (language.Id == m_LanguageId) { selIndex = languageBox.Items.Count - 1; } } if (selIndex != -1) { languageBox.SelectedIndex = selIndex; } languageBox.EndUpdate(); if (confirmButton.Enabled) { confirmButton.Enabled = Ares.Tags.TagsModule.GetTagsDB().WriteInterface.CanConfirmTags(m_Files); } } catch (Ares.Tags.TagsDbException ex) { MessageBox.Show(this, String.Format(StringResources.TagsDbError, ex.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); } m_Listen = true; }