private void LoadSigns() { //30-05-2018 //if (File.Exists(xmlPath)) //{ // basicCivilCustom = Extension.Create(xmlPath);//Path.Combine(dirPath, "NZSigns.xml") //} //else // basicCivilCustom = null; List <CivilCustomization> _civil = new List <CivilCustomization>(); foreach (string str in Directory.GetFiles(signsDrawingPath, "*.xml", SearchOption.AllDirectories)) { try { basicCivilCustom = new BasicCivilCustomization(); basicCivilCustom = Extension.Create(str); _civil.AddRange(basicCivilCustom.CivilCustomization); } catch { } } basicCivilCustom = new BasicCivilCustomization(); basicCivilCustom.CivilCustomization = _civil; if (basicCivilCustom != null) { basicCivilCustom.CivilCustomization.ForEach(x => { bool bIsContains = false; foreach (string strDwg in dwgfileList) { //string dwgName = System.IO.Path.GetFileName(strDwg).Replace(".dwg", ""); if (x.DrawingName.Equals(strDwg, StringComparison.InvariantCultureIgnoreCase)) { bIsContains = true; break; } } if (!bIsContains) { basicCivilCustom.CivilCustomization.Remove(x); } }); } loadDWGFilesToList(); if (!cmboDescription.Items.Contains("--Select--")) { cmboDescription.Items.Insert(0, "--Select--"); } cmboDescription.SelectedIndex = 0; //16-04-2018 //lstDescription.SelectedIndexChanged -= lstDescription_SelectedIndexChanged; //lstDescription.SelectedIndex = -1; //lstDescription.SelectedIndexChanged += lstDescription_SelectedIndexChanged; }
public static string ToXMLString(this BasicCivilCustomization obj) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(BasicCivilCustomization)); StringBuilder sb = new StringBuilder(); using (XmlWriter xmlWriter = XmlWriter.Create(sb, new XmlWriterSettings() { Indent = true })) { xmlSerializer.Serialize(xmlWriter, obj); } return(sb.ToString()); }
private void LoadSigns() { //30-05-2018 //if (File.Exists(xmlPath)) //{ // basicCivilCustom = Extension.Create(xmlPath);//Path.Combine(dirPath, "NZSigns.xml") //} //else // basicCivilCustom = null; List <CivilCustomization> _civil = new List <CivilCustomization>(); foreach (string str in Directory.GetFiles(signsDrawingPath, "*.xml", SearchOption.AllDirectories)) { try { basicCivilCustom = new BasicCivilCustomization(); basicCivilCustom = Extension.Create(str); _civil.AddRange(basicCivilCustom.CivilCustomization); } catch { } } basicCivilCustom = new BasicCivilCustomization(); basicCivilCustom.CivilCustomization = _civil; loadDWGFilesToList(); if (!cmboDescription.Items.Contains("--Select--")) { cmboDescription.Items.Insert(0, "--Select--"); } cmboDescription.SelectedIndex = 0; //16-04-2018 //lstDescription.SelectedIndexChanged -= lstDescription_SelectedIndexChanged; //lstDescription.SelectedIndex = -1; //lstDescription.SelectedIndexChanged += lstDescription_SelectedIndexChanged; }