Ejemplo n.º 1
0
        protected override bool OnDataButton(BD.DgnButtonEvent ev)
        {
            BD.HitPath hitPath = DoLocate(ev, true, 1);
            if (null != hitPath)
            {
                BDDE.DgnECManager       manager = BDDE.DgnECManager.Manager;
                BDDE.FindInstancesScope scope   = BDDE.FindInstancesScope.CreateScope(hitPath.GetHeadElement(), new BDDE.FindInstancesScopeOption(BDDE.DgnECHostType.Element, true));
                BDEPQ.ECQuery           query   = new BDEPQ.ECQuery(Extension.Utilities.GetActiveModelAllClasses());
                query.SelectClause.SelectAllProperties = true;
                using (BDDE.DgnECInstanceCollection ecInstances = manager.FindInstances(scope, query))
                {
                    if (ecInstances == null)
                    {
                        return(false);
                    }
                    m_findinstacneOnElementViewModel.InstancesInfo.Clear();
                    //ObservableCollection<Instance> instanceCollection = new ObservableCollection<Instance>();
                    foreach (var ecin in ecInstances)
                    {
                        foreach (BES.IECProperty itemProp in ecin.ClassDefinition.Properties(false))
                        {
                            var instanceitem = new Instance();
                            instanceitem.ClassName    = ecin.ClassDefinition.DisplayLabel;
                            instanceitem.PropertyName = itemProp.Name;
                            string type = itemProp.Type.Name.ToLower();
                            instanceitem.TypeName = type;
                            BEI.IECPropertyValue propvalue = ecin.GetPropertyValue(itemProp.Name);

                            switch (type)
                            {
                            case "string":
                                instanceitem.PropertyValue = (propvalue != null) ? propvalue.StringValue : "";
                                break;

                            case "boolean":
                                instanceitem.PropertyValue = (propvalue != null) ? propvalue.StringValue : "";
                                break;

                            case "int":
                                instanceitem.PropertyValue = (propvalue != null) ? propvalue.IntValue.ToString() : "";
                                break;

                            case "double":
                                instanceitem.PropertyValue = (propvalue != null) ? propvalue.DoubleValue.ToString() : "";
                                break;
                            }
                            m_findinstacneOnElementViewModel.InstancesInfo.Add(instanceitem);
                        }
                    }
                    m_findinstacneOnElementViewModel.WindowTitle = hitPath.GetHeadElement().ElementId.ToString();
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 public void FindSchema()
 {
     BDEC.DgnECManager manager = BDEC.DgnECManager.Manager;
     SchemaList = manager.DiscoverSchemasForModel(Program.GetActiveDgnModel(), Bentley.DgnPlatformNET.DgnEC.ReferencedModelScopeOption.All, false).ToObservableCollection();
 }