private void ChangePropertyName(DataStorePropertyEntry entry)
        {
            SampleProperty dataSetProperty = entry.DataSetProperty;

            entry.ValidatePropertyName();
            if (string.IsNullOrEmpty(entry.PropertyName))
            {
                return;
            }
            dataSetProperty.Rename(entry.PropertyName);
        }
Пример #2
0
 public DataStorePropertyEntry(SampleDataSet dataStore, IProperty property, IList <DataStorePropertyEntry> properties)
 {
     this.dataStore             = dataStore;
     this.property              = property;
     this.stringValue           = dataStore.RootNode.GetValue <string>((IPropertyId)this.property);
     this.type                  = DataStorePropertyEntry.DataStoreTypeFromSampleProperty(dataStore.RootType.GetSampleProperty(property.Name));
     this.dirtyState            = DataStorePropertyEntryDirtyStates.None;
     this.propertyName          = property.Name;
     this.cacheValue            = new Dictionary <DataStoreType, string>();
     this.cacheValue[this.type] = this.stringValue;
     this.properties            = properties;
 }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            DataStorePropertyEntry storePropertyEntry = item as DataStorePropertyEntry;

            if (storePropertyEntry == null)
            {
                return((DataTemplate)null);
            }
            if (storePropertyEntry.PropertyType != DataStoreType.Boolean)
            {
                return(this.TextEditingTemplate);
            }
            return(this.BoolEditingTemplate);
        }
        private void ChangePropertyValue(DocumentCompositeNode rootNode, DataStorePropertyEntry entry)
        {
            switch (entry.PropertyType)
            {
            case DataStoreType.String:
                rootNode.Properties[(IPropertyId)entry.Property] = (DocumentNode)rootNode.Context.CreateNode(entry.PropertyValue);
                break;

            case DataStoreType.Number:
                rootNode.Properties[(IPropertyId)entry.Property] = rootNode.Context.CreateNode(typeof(double), (object)double.Parse(entry.PropertyValue, (IFormatProvider)CultureInfo.CurrentCulture));
                break;

            case DataStoreType.Boolean:
                rootNode.Properties[(IPropertyId)entry.Property] = rootNode.Context.CreateNode(typeof(bool), (object)(bool)(bool.Parse(entry.PropertyValue) ? true : false));
                break;
            }
        }
 private void ChangePropertyType(DataStorePropertyEntry entry)
 {
     entry.DataSetProperty.ChangeType(DataStorePropertyEntry.SampleTypeFromDataStoreType(entry.PropertyType));
 }