Beispiel #1
0
            public DataPanePopupCallback(DataSchemaItem dataSchemaItem)
            {
                DataSchemaNode parent = dataSchemaItem.DataSchemaNode.Parent;

                dataSchemaItem.DataSourceNode.DocumentNode.TypeResolver.GetType(parent.Type);
                this.property           = DesignDataConfigurationButton.WritablePropertyFromSchemaItem(dataSchemaItem);
                this.designDataFile     = DesignDataHelper.GetDesignDataFile(dataSchemaItem.DataSourceNode.DocumentNode);
                this.stringConfigurator = new SampleStringConfiguration(SampleDataFormatHelper.NormalizeFormat(SampleBasicType.String, (string)null, false), (string)null);
            }
Beispiel #2
0
        private static bool CompareDesignDataSources(DocumentNode leftSource, DocumentNode rightSource)
        {
            if (leftSource == null || rightSource == null)
            {
                return(false);
            }
            IProjectItem designDataFile1 = DesignDataHelper.GetDesignDataFile(leftSource);

            if (designDataFile1 == null)
            {
                return(false);
            }
            IProjectItem designDataFile2 = DesignDataHelper.GetDesignDataFile(rightSource);

            return(designDataFile1 == designDataFile2);
        }
Beispiel #3
0
        public IType ResolveType(ITypeResolver typeResolver)
        {
            IType type = (IType)null;

            if (this.type != (Type)null)
            {
                type = typeResolver.GetType(this.type);
            }
            else if (this.IsCollection)
            {
                type = typeResolver.ResolveType(PlatformTypes.Array);
            }
            else if (!this.HasChildren)
            {
                type = typeResolver.ResolveType(PlatformTypes.String);
            }
            return(DesignDataHelper.GetSourceType(type, typeResolver));
        }
        private static BindingPropertyCompatibility GetPropertyCompatibility(BindingPropertyMatchInfo propertyInfo, IType dataType, ITypeResolver typeResolver)
        {
            IType sourceType = DesignDataHelper.GetSourceType(dataType, typeResolver);

            if (PlatformTypes.String.IsAssignableFrom((ITypeId)sourceType) && !PlatformTypes.String.IsAssignableFrom((ITypeId)propertyInfo.PropertyType) && PlatformTypes.IEnumerable.IsAssignableFrom((ITypeId)propertyInfo.PropertyType))
            {
                return(BindingPropertyCompatibility.None);
            }
            if (propertyInfo.NullableNormalizedPropertyType.IsAssignableFrom((ITypeId)sourceType) || propertyInfo.PropertyType.IsAssignableFrom((ITypeId)sourceType) || propertyInfo.PropertyType.IsBinding)
            {
                return(BindingPropertyCompatibility.Assignable);
            }
            TypeConverter typeConverter = propertyInfo.Property.TypeConverter ?? propertyInfo.Property.PropertyType.TypeConverter;

            if (typeConverter != null && typeConverter.CanConvertFrom(sourceType.RuntimeType) && (!PlatformTypes.String.IsAssignableFrom((ITypeId)sourceType) || !PlatformTypes.IConvertible.IsAssignableFrom((ITypeId)propertyInfo.NullableNormalizedPropertyType)))
            {
                return(BindingPropertyCompatibility.Convertible);
            }
            return(PlatformTypes.String.IsAssignableFrom((ITypeId)propertyInfo.PropertyType) ? BindingPropertyCompatibility.StringSpecial : BindingPropertyCompatibility.None);
        }
Beispiel #5
0
        public static IProjectItem PromptAndCreateDesignData(SceneViewModel viewModel)
        {
            DesignObjectDataSourceDialog dataSourceDialog = new DesignObjectDataSourceDialog(viewModel.DataPanelModel);
            bool?nullable = dataSourceDialog.ShowDialog();

            if (nullable.HasValue)
            {
                if (nullable.Value)
                {
                    try
                    {
                        using (TemporaryCursor.SetWaitCursor())
                            return(DesignDataHelper.CreateDesignDataFile(dataSourceDialog.ObjectType, dataSourceDialog.DataSourceName.Trim(), viewModel.ProjectContext, false));
                    }
                    catch (Exception ex)
                    {
                        viewModel.DesignerContext.MessageDisplayService.ShowError(ex.Message);
                    }
                }
            }
            return((IProjectItem)null);
        }
Beispiel #6
0
 public DesignDataTypeConfigurationPopup(DataSchemaItem dataSchemaItem)
     : base((IPopupControlCallback) new DesignDataTypeConfigurationPopup.DataPanePopupCallback(dataSchemaItem), ConfigurationPlaceholder.StringFormat)
 {
     this.IsPerformingSchemaChange = !DesignDataHelper.GetDesignDataFile(dataSchemaItem.DataSourceNode.DocumentNode).IsOpen;
 }
Beispiel #7
0
 public DataSourceNode(DocumentNode documentNode)
 {
     this.documentNode = documentNode;
     this.IsDesignData = DesignDataHelper.GetDesignDataFile(documentNode) != null;
 }
Beispiel #8
0
        public static DocumentNode CreateDesignDataExtension(IProjectItem designDataFile, IDocumentContext documentContext)
        {
            DesignDataExtension designDataExtension = new DesignDataExtension(DesignDataHelper.GetDesignDataPath(designDataFile));

            return(documentContext.CreateNode(designDataExtension.GetType(), (object)designDataExtension));
        }
Beispiel #9
0
 public static DocumentNode GetRootDesignDataNode(DocumentNode documentNode)
 {
     return(DesignDataHelper.GetRootDesignDataNode(DesignDataHelper.GetDesignDataFile(documentNode), (IProjectContext)documentNode.TypeResolver));
 }
Beispiel #10
0
 public static bool CompareDataSources(DocumentNode leftSource, DocumentNode rightSource)
 {
     return(leftSource == rightSource || leftSource != null && rightSource != null && DesignDataHelper.CompareDesignDataSources(leftSource, rightSource));
 }
Beispiel #11
0
        public DataSourceMatchCriteria CompareSources(DataSourceInfo other)
        {
            if (this == other)
            {
                return(DataSourceMatchCriteria.Exact);
            }
            if (this.Category == DataSourceCategory.Invalid || this.Category != other.Category || !DesignDataHelper.CompareDataSources(this.SourceNode, other.SourceNode))
            {
                return(DataSourceMatchCriteria.Ignore);
            }
            DataSourceMatchCriteria sourceMatchCriteria = DataSourceMatchCriteria.Ignore;

            if (this.Category == DataSourceCategory.Clr)
            {
                sourceMatchCriteria = DataSourceInfo.CompareClrPaths(this.Path, other.Path);
            }
            else if (this.Category == DataSourceCategory.Xml)
            {
                sourceMatchCriteria = DataSourceInfo.CompareXmlPaths(XmlSchema.NormalizeXPath(this.Path), XmlSchema.NormalizeXPath(other.Path));
            }
            return(sourceMatchCriteria);
        }