public static void UpdateDesignValues(DocumentNode node, IProperty property, ISampleTypeConfiguration valueGenerator) { DocumentCompositeNode documentCompositeNode = node as DocumentCompositeNode; if (documentCompositeNode == null) { return; } if (property.DeclaringType.IsAssignableFrom((ITypeId)documentCompositeNode.Type)) { documentCompositeNode.Properties[(IPropertyId)property] = documentCompositeNode.Context.CreateNode(property.PropertyType.RuntimeType, valueGenerator.Value); } foreach (KeyValuePair <IProperty, DocumentNode> keyValuePair in (IEnumerable <KeyValuePair <IProperty, DocumentNode> >)documentCompositeNode.Properties) { DesignDataGenerator.UpdateDesignValues(keyValuePair.Value, property, valueGenerator); } if (!documentCompositeNode.SupportsChildren) { return; } for (int index = 0; index < documentCompositeNode.Children.Count; ++index) { DesignDataGenerator.UpdateDesignValues(documentCompositeNode.Children[index], property, valueGenerator); } }
public SampleDataPropertyConfiguration(SampleProperty sampleProperty) { this.activeType = (SampleBasicType)sampleProperty.PropertySampleType; this.valueGenerators = new Dictionary <SampleBasicType, ISampleTypeConfiguration>(); foreach (SampleBasicType sampleBasicType in SampleBasicType.SampleBasicTypes) { string format = sampleBasicType == sampleProperty.PropertySampleType ? sampleProperty.Format : (string)null; string formatParameters = sampleBasicType == sampleProperty.PropertySampleType ? sampleProperty.FormatParameters : (string)null; ISampleTypeConfiguration configuration = SampleDataPropertyConfiguration.CreateConfiguration(sampleProperty.DeclaringDataSet, sampleBasicType, format, formatParameters); this.valueGenerators.Add(sampleBasicType, configuration); } }
public static bool UpdateDesignValues(IProjectItem designDataFile, IProperty property, ISampleTypeConfiguration valueGenerator) { designDataFile.OpenView(false); SceneDocument sceneDocument = designDataFile.Document as SceneDocument; if (sceneDocument == null || sceneDocument.DocumentRoot == null || sceneDocument.DocumentRoot.RootNode == null) { return(false); } using (SceneEditTransaction editTransaction = sceneDocument.CreateEditTransaction(StringTable.UpdateDesignValuesUndo)) { DesignDataGenerator.UpdateDesignValues(sceneDocument.DocumentRoot.RootNode, property, valueGenerator); editTransaction.Commit(); } return(true); }