private bool ActivateSection(SectionSettings section) { try { if (section.CanActivate == false) { return(false); } section.Dock = DockStyle.Fill; section.OnSectionActivated(); if (section != _previousSection && _previousSection != null) { _previousSection.OnSectionDeActivated(); } _previousSection = section; holderPanel.Controls.Clear(); holderPanel.Controls.Add(section); } catch (Exception ex) { Log.Error(ex); } return(true); }
public ConfigPage(SectionSettings aParentsection, SectionSettings aConfigSection, bool aIsExpertSetting) { sectionName = aConfigSection.Text; parentsection = aParentsection; configSection = aConfigSection; isExpertSetting = aIsExpertSetting; }
public static SectionSettings GetSection(string name) { SectionSettings sectionSettings = null; SectionTreeNode sectionTreeNode = null; try { sectionTreeNode = new SectionTreeNode(SettingsForm.SettingSections[name].ConfigSection); } catch (KeyNotFoundException) { MessageBox.Show("Someone broke section handling specifying a non existing name for {0}!", name); } if (sectionTreeNode != null) { sectionSettings = sectionTreeNode.Section; } else { // // Failed to locate the specified section, loop through and try to match // a section against the type name instead, as this is the way the wizard names // its sections. // IDictionaryEnumerator enumerator = SettingsForm.SettingSections.GetEnumerator(); while (enumerator.MoveNext()) { sectionTreeNode = enumerator.Value as SectionTreeNode; if (sectionTreeNode != null) { Type sectionType = sectionTreeNode.Section.GetType(); if (sectionType.Name.Equals(name)) { sectionSettings = sectionTreeNode.Section; break; } } } } return(sectionSettings); }
private bool MusicScanRunning() { SectionSettings section = SectionSettings.GetSection("Music Database"); if (section != null) { bool scanRunning = (bool)section.GetSetting("folderscanning"); if (scanRunning) { MessageBox.Show("Music Folderscan running in background.\r\nPlease wait for the scan to finish", "MediaPortal Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (ActivateSection(section)) { headerLabel.Caption = section.Text; } } return(scanRunning); } return(false); }
private bool ActivateSection(SectionSettings section) { try { if (section.CanActivate == false) { return false; } section.Dock = DockStyle.Fill; section.OnSectionActivated(); if (section != _previousSection && _previousSection != null) { _previousSection.OnSectionDeActivated(); } _previousSection = section; holderPanel.Controls.Clear(); holderPanel.Controls.Add(section); } catch (Exception ex) { Log.Error(ex); } return true; }
public SectionTreeNode(SectionSettings section) { this.section = section; this.Text = section.Text; }