Exemplo n.º 1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            DataSchemaItem dataSchemaItem = item as DataSchemaItem;

            if (dataSchemaItem == null)
            {
                return((DataTemplate)null);
            }
            DataSourceNode dataSourceNode = dataSchemaItem.DataSourceNode;

            if (dataSourceNode == null)
            {
                return((DataTemplate)null);
            }
            DataTemplate dataTemplate = (DataTemplate)null;

            if (dataSourceNode.IsDesignData)
            {
                dataTemplate = this.DesignData.GetTemplate(dataSchemaItem);
            }
            else if (dataSourceNode.IsSampleDataSource)
            {
                dataTemplate = this.SampleData.GetTemplate(dataSchemaItem);
            }
            if (dataTemplate == null)
            {
                dataTemplate = this.LiveData.GetTemplate(dataSchemaItem);
            }
            return(dataTemplate);
        }
Exemplo n.º 2
0
        public void OnDragBegin(DragBeginEventArgs e)
        {
            if (this.nodePath == null)
            {
                return;
            }
            List <DataSchemaItem> list1 = new List <DataSchemaItem>(Enumerable.OfType <DataSchemaItem>((IEnumerable)this.SelectionContext));

            if (list1.Count <= 0 || list1.Count != this.SelectionContext.Count || !list1.Contains(this))
            {
                return;
            }
            DataSchemaNode            parent         = list1[0].DataSchemaNode.Parent;
            DataSourceNode            dataSourceNode = list1[0].DataSourceNode;
            List <DataSchemaNodePath> list2          = new List <DataSchemaNodePath>();

            list2.Add(list1[0].nodePath.AbsolutePath);
            for (int index = 1; index < list1.Count; ++index)
            {
                if (parent != list1[index].DataSchemaNode.Parent || dataSourceNode != list1[index].DataSourceNode)
                {
                    return;
                }
                list2.Add(list1[index].nodePath.AbsolutePath);
            }
            DataSchemaNodePathCollection nodePathCollection = new DataSchemaNodePathCollection((IEnumerable <DataSchemaNodePath>)list2);

            using (DataBindingDragDropManager.GetDragDropToken())
            {
                int num = (int)DragSourceHelper.DoDragDrop(e.DragSource, (object)nodePathCollection, DragDropEffects.Copy | DragDropEffects.Move);
            }
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is FileBasedDataSourceItem)
            {
                return((object)this.designDataSourceImage);
            }
            DataSourceItem dataSourceItem = value as DataSourceItem;

            if (dataSourceItem != null)
            {
                DataSourceNode dataSourceNode = dataSourceItem.DataSourceNode;
                if (dataSourceNode is ClrObjectDataSourceNode)
                {
                    if (!dataSourceNode.IsSampleDataSource)
                    {
                        return((object)this.liveDataSourceImage);
                    }
                    return((object)this.sampleDataSourceImage);
                }
                if (dataSourceNode is XmlDataSourceNode)
                {
                    return((object)this.liveDataSourceImage);
                }
            }
            return((object)null);
        }
Exemplo n.º 4
0
        public ClrObjectSchema(Type type, DocumentNode dataSourceNode)
        {
            SchemaNodeTypes nodeType = ClrObjectSchema.IsCollection(type) ? SchemaNodeTypes.Collection : SchemaNodeTypes.Property;

            this.root       = new DataSchemaNode(type.Name, type.Name, nodeType, (string)null, type, (IDataSchemaNodeDelayLoader)this);
            this.dataSource = (DataSourceNode) new ClrObjectDataSourceNode(this, dataSourceNode);
            this.OnPropertyChanged("Root");
        }
Exemplo n.º 5
0
 private XmlSchema(XmlSchema source, DataSchemaNode root)
 {
     this.root              = root;
     this.dataSource        = (DataSourceNode) new XmlDataSourceNode(this, source.dataSource.DocumentNode);
     this.invalidRootXPath  = source.invalidRootXPath;
     this.namespaceManager  = source.namespaceManager;
     this.prefixToNamespace = source.prefixToNamespace;
     this.namespaceToPrefix = source.namespaceToPrefix;
     this.targetNamespace   = source.targetNamespace;
 }
Exemplo n.º 6
0
 public XmlSchema(DocumentNode dataSource)
 {
     this.dataSource = (DataSourceNode) new XmlDataSourceNode(this, dataSource);
     this.ValidateRootXPath();
 }
Exemplo n.º 7
0
 public XmlSchema(XmlSchemaSet schemaSet, DocumentNode dataSource)
 {
     this.Initialize(schemaSet);
     this.dataSource = (DataSourceNode) new XmlDataSourceNode(this, dataSource);
     this.ValidateRootXPath();
 }
Exemplo n.º 8
0
 private ClrObjectSchema(DataSchemaNode root, DocumentNode dataSourceNode)
 {
     this.root       = root;
     this.dataSource = (DataSourceNode) new ClrObjectDataSourceNode(this, dataSourceNode);
 }