public void LoadCustomTraceExtenders() { if (_customTracerExtenders == null) { //load the components var extenderComponents = Categories.GetComponentElements("UCSampleExampleCategory"); if (extenderComponents == null) { System.Windows.MessageBox.Show("There are no custom trace extenders loaded for 'UCSampleExampleCategory'", "Category UCSampleExampleCategory"); return; } _customTracerExtenders = new List <CustomTraceComponent>(); XNamespace ns = "http://schemas.esri.com/DADF/Registry"; foreach (var component in extenderComponents) { //get the content XElement content = component.GetContent(); CustomTraceComponent record = new CustomTraceComponent(); record.Name = content.Attribute("name").Value; record.Description = content.Attribute("description").Value; record.Author = content.Attribute("author").Value; record.Version = content.Attribute("version").Value; //other parameters XElement otherParam = content.Element(ns + "param1"); //get the value string val = otherParam.Attribute("value").Value; //etc. //"the" component record.extender = component.CreateComponent() as IComponentCategoryInterface;//this is your custom interface, 3rd parties MUST implement it //save it _customTracerExtenders.Add(record); } } }
public void LoadCustomTraceExtenders() { if (_customTracerExtenders == null) { //load the components var extenderComponents = Categories.GetComponentElements("UCSampleExampleCategory"); if (extenderComponents == null) { System.Windows.MessageBox.Show("There are no custom trace extenders loaded for 'UCSampleExampleCategory'", "Category UCSampleExampleCategory"); return; } _customTracerExtenders = new List<CustomTraceComponent>(); XNamespace ns = "http://schemas.esri.com/DADF/Registry"; foreach (var component in extenderComponents) { //get the content XElement content = component.GetContent(); CustomTraceComponent record = new CustomTraceComponent(); record.Name = content.Attribute("name").Value; record.Description = content.Attribute("description").Value; record.Author = content.Attribute("author").Value; record.Version = content.Attribute("version").Value; //other parameters XElement otherParam = content.Element(ns + "param1"); //get the value string val = otherParam.Attribute("value").Value; //etc. //"the" component record.extender = component.CreateComponent() as IComponentCategoryInterface;//this is your custom interface, 3rd parties MUST implement it //save it _customTracerExtenders.Add(record); } } }