private void CheckTypeIfNeeded(ORMTypes typeToLookAt) { if ((_definitionObject.ORMTypes & typeToLookAt) == typeToLookAt) { CheckTreeNodeItem(tvModelElements.Nodes, typeToLookAt.ToString()); } }
private void tvModelElements_AfterCheck(object sender, TreeViewEventArgs e) { if (_loadingDefinition) { return; } if ((string)e.Node.Tag == "AllConstraints") { if (!_alteringAllConstraintsCheck) { _alteringAllConstraintsCheck = true; foreach (TreeNode node in e.Node.Nodes) { node.Checked = e.Node.Checked; } _alteringAllConstraintsCheck = false; } } else if (!e.Node.Checked && ((string)e.Node.Tag).IndexOf("Constraint") > -1 && !_alteringAllConstraintsCheck) { if (e.Node.Parent.Checked) { _alteringAllConstraintsCheck = true; e.Node.Parent.Checked = false; _alteringAllConstraintsCheck = false; } } if (_definitionNode != null) { if (e.Node.Checked) { XmlNode newType = CustomPropertiesManager.LoadedDocument.CreateNode("element", "ORMType", CustomPropertiesDomainModel.XmlNamespace); XmlAttribute nameAttrib = CustomPropertiesManager.LoadedDocument.CreateAttribute("name"); nameAttrib.Value = (string)e.Node.Tag; _definitionNode.SelectSingleNode("def:ORMTypes", CustomPropertiesManager.NamespaceManager).AppendChild(newType); newType.Attributes.Append(nameAttrib); } else { XmlNode node = _definitionNode.SelectSingleNode("def:ORMTypes/def:ORMType[@name='" + (string)e.Node.Tag + "']", CustomPropertiesManager.NamespaceManager); node.ParentNode.RemoveChild(node); } } if (_definitionObject != null) { ORMTypes typeChanged = (ORMTypes)Enum.Parse(typeof(ORMTypes), (string)e.Node.Tag); if (e.Node.Checked) { _definitionObject.ORMTypes = _definitionObject.ORMTypes | typeChanged; } else { _definitionObject.ORMTypes = _definitionObject.ORMTypes ^ typeChanged; } } }
/// <summary> /// Used when adding a CustomPropertyGroup to the machine. Looks to see if the specified typeToLookFor /// is in the typesValue and if so adds the XML to the types node. /// </summary> /// <param name="typesValue">The existing types already specified.</param> /// <param name="typeToLookFor">The type we're looking for.</param> /// <param name="ORMTypesNode">The types node to add the type to if needed.</param> private void AddORMTypeToGroupIfNeeded(ORMTypes typesValue, ORMTypes typeToLookFor, XmlNode ORMTypesNode) { if ((typesValue & typeToLookFor) == typeToLookFor) { XmlNode newOrmType = _loadedDoc.CreateElement("ORMType", CustomPropertiesDomainModel.XmlNamespace); XmlAttribute nameAttrib = CustomPropertiesManager.LoadedDocument.CreateAttribute("name"); nameAttrib.Value = typeToLookFor.ToString(); ORMTypesNode.AppendChild(newOrmType); newOrmType.Attributes.Append(nameAttrib); } }
private static void GetProvidedProperties(ORMTypes selectedTypes, object extendableElement, PropertyDescriptorCollection properties) { foreach (CustomPropertyDefinition customPropertyDefinition in ((ModelElement)extendableElement).Store.ElementDirectory.FindElements <CustomPropertyDefinition>()) { if ((customPropertyDefinition.ORMTypes & selectedTypes) == 0) { continue; } properties.Add(CustomPropertyDescriptor.GetDescriptorForCustomPropertyDefinition(customPropertyDefinition)); } }
private static void GetProvidedProperties(ORMTypes selectedTypes, object extendableElement, PropertyDescriptorCollection properties) { foreach (CustomPropertyDefinition customPropertyDefinition in ((ModelElement)extendableElement).Store.ElementDirectory.FindElements<CustomPropertyDefinition>()) { if ((customPropertyDefinition.ORMTypes & selectedTypes) == 0) { continue; } properties.Add(CustomPropertyDescriptor.GetDescriptorForCustomPropertyDefinition(customPropertyDefinition)); } }