Exemple #1
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            DataSchemaItem dataSchemaItem = values[0] as DataSchemaItem;
            bool           flag           = values.Length == 2 && (bool)values[1];

            if (dataSchemaItem != null)
            {
                if (dataSchemaItem.IsHierarchicalCollection)
                {
                    return((object)this.hierarchicalCollectionImage);
                }
                if (dataSchemaItem.DataSchemaNode.IsCollection)
                {
                    if (!flag)
                    {
                        return((object)this.detailsCollectionImage);
                    }
                    return((object)this.masterCollectionImage);
                }
                if (dataSchemaItem.HasChildren)
                {
                    return((object)this.compositeImage);
                }
                if (SampleDataSet.SampleDataTypeFromType(dataSchemaItem.DataSchemaNode.Type) is SampleCompositeType)
                {
                    return((object)this.compositeImage);
                }
            }
            return((object)null);
        }
Exemple #2
0
        private static SampleCompositeType CalculateEffectiveType(Type type)
        {
            SampleNonBasicType sampleNonBasicType = SampleDataSet.SampleDataTypeFromType(type);

            if (sampleNonBasicType != null)
            {
                SampleCollectionType sampleCollectionType;
                while ((sampleCollectionType = sampleNonBasicType as SampleCollectionType) != null)
                {
                    sampleNonBasicType = sampleCollectionType.ItemType as SampleNonBasicType;
                }
            }
            return(sampleNonBasicType as SampleCompositeType);
        }
        public IType GetSampleType(Type type)
        {
            if (this.dataSets.Count == 0)
            {
                return((IType)null);
            }
            SampleNonBasicType sampleType = SampleDataSet.SampleDataTypeFromType(type);

            if (sampleType == null)
            {
                return((IType)null);
            }
            if (this.dataSets.Find((Predicate <SampleDataSet>)(s => s == sampleType.DeclaringDataSet)) == null)
            {
                return((IType)null);
            }
            return((IType)sampleType);
        }
 public virtual DataTemplate GetTemplate(DataSchemaItem dataSchemaItem)
 {
     return(!dataSchemaItem.DataSchemaNode.IsCollection ? (!dataSchemaItem.HasChildren ? (!(SampleDataSet.SampleDataTypeFromType(dataSchemaItem.DataSchemaNode.Type) is SampleCompositeType) ? this.BasicTemplate : this.CompositeTemplate) : this.CompositeTemplate) : this.CollectionTemplate);
 }