public IconButton() { propHolder = new PropertiesHolder(); this.InitializeComponent(); this.DataContext = propHolder; }
public IconButton() { propHolder = new PropertiesHolder(); this.InitializeComponent(); this.DataContext = propHolder; }
protected internal ThreadPoolOptions(PropertiesHolder parent) : base(parent, "quartz.threadPool") { }
private Node CreateNode() { var item = stack.Pop(); if (item is Node) { return((Node)item); } #region Valores simples... else if (item == null) { return(new Node { Type = NodeType.Value }); } else if (IsSimpleValue(item)) { return(new Node { Type = NodeType.Value, Value = item }); } #endregion #region Xmls else if (item is XContainer) { // var xml = (XContainer)item; // var text = xml.ToString(SaveOptions.DisableFormatting); // return new Node { Type = NodeType.Value, Value = text }; return(new Node { Type = NodeType.Value, Value = item }); } #endregion #region Propriedades... else if (item is PropertiesHolder) { var properties = (PropertiesHolder)item; var graph = properties.Graph; var enumerator = properties.Enumerator; var ready = enumerator.MoveNext(); if (!ready) { return(CreateNode()); } stack.Push(properties); var graphInfo = new GraphReaderInfo(graph.GetType()); var property = (PropertyInfo)enumerator.Current; var propertyValue = property.GetValue(graph, null); var ignore = IgnoreValueMethod.Invoke(propertyValue); if (ignore) { return(CreateNode()); } var name = graphInfo.GetPropertyLabel(property); var propertyName = ValueConventions.CreateName(name, Settings, TextCase.PascalCase); stack.Push(new Node { Type = NodeType.PropertyEnd }); stack.Push(propertyValue); return(new Node { Type = NodeType.PropertyStart, Value = propertyName }); } #endregion #region Dicionarios, tratados como objetos... else if (Collections.IsDictionary(item)) { var dictionary = (IDictionary)item; var enumerator = dictionary.GetEnumerator(); var name = item.GetType().Name; var propertyName = ValueConventions.CreateName(name, Settings, TextCase.PascalCase); stack.Push(new Node { Type = NodeType.ObjectEnd }); stack.Push(enumerator); return(new Node { Type = NodeType.ObjectStart, Value = propertyName }); } else if (item is DictionaryEntry) { var entry = (DictionaryEntry)item; stack.Push(new Node { Type = NodeType.PropertyEnd }); stack.Push(entry.Value); var name = entry.Key.ToString(); var propertyName = ValueConventions.CreateName(name, Settings, TextCase.PascalCase); return(new Node { Type = NodeType.PropertyStart, Value = name }); } #endregion #region Listas... else if (item is IEnumerable) { var collection = (IEnumerable)item; var enumerator = collection.GetEnumerator(); var collectionType = collection.GetType(); var collectionInfo = new GraphReaderInfo(collectionType); var name = collectionInfo.GetLabel(); var collectionName = ValueConventions.CreateName(name, Settings, TextCase.PascalCase); stack.Push(new Node { Type = NodeType.CollectionEnd }); stack.Push(enumerator); return(new Node { Type = NodeType.CollectionStart, Value = collectionName }); } else if (item is IEnumerator) { var enumerator = (IEnumerator)item; var ready = enumerator.MoveNext(); if (ready) { stack.Push(enumerator); stack.Push(enumerator.Current); } return(CreateNode()); } #endregion #region Objetos... else { var graph = item; var graphType = graph.GetType(); var graphInfo = new GraphReaderInfo(graphType); var properties = graphInfo.GetProperties(); var enumerator = properties.GetEnumerator(); var holder = new PropertiesHolder { Graph = graph, Enumerator = enumerator }; var name = graphInfo.GetLabel(); var propertyName = ValueConventions.CreateName(name, Settings, TextCase.PascalCase); stack.Push(new Node { Type = NodeType.ObjectEnd }); stack.Push(holder); return(new Node { Type = NodeType.ObjectStart, Value = propertyName }); } #endregion }