public void UpdateColours(NewSeviceEntryCollection ns, string ignoreName = "") { if (ns != null) // check service entry collection exists { //foreach (NewSeviceEntry nse in ns) // loop thro collection //{ foreach (Control lblbut in Controls[2].Controls) // loop thro controls in each entry { foreach (NewSeviceEntry nsen in ns) { if (lblbut is Label && lblbut.Text == nsen.NewSeviceEntryName && nsen.NewSeviceEntryName != ignoreName) { if (nsen.Enabled.ToUpper() == "TRUE") { lblbut.BackColor = Color.LightBlue; break; } else { lblbut.BackColor = Color.LightGray; } } } } //} } }
public void SetStopStartFlag() { if (File.Exists(xmlfileSvcEntry)) { NSC = new NewSeviceEntryCollection(main_form); NSC.GetAllEntries(); } }
/// <summary> /// Loads xml file that may or may not have entries /// and creates NewSeviceEntryCollection object collection /// </summary> public NewServiceEntryNames(MainForm mf) { // create class level reference to Mainform main_form = mf; // Set local copy of xml file xmlfileSvcEntry = MainForm.xmlfileN; // Load file into XDocument xmlDocSvcEntry = XDocument.Load(xmlfileSvcEntry); // Load and create all entries into collection NSC = new NewSeviceEntryCollection(mf); if (NSC.Count() > 0) { foreach (NewSeviceEntry nse in NSC) { //if (nse.Enabled == "True") //newEntryButton.BackColor = Color.LightBlue; } } }