Esempio n. 1
0
        public DataBindingDialogModel(DataPanelModel model, SceneNode targetElement, ReferenceStep targetProperty)
            : base(targetElement, targetProperty)
        {
            this.isBinding = true;
            this.addXmlDataSourceCommand        = model.AddXmlDataSourceCommand;
            this.createSampleDataCommand        = model.CreateSampleDataCommand;
            this.createSampleDataFromXmlCommand = model.CreateSampleDataFromXmlCommand;
            this.addClrObjectDataSourceCommand  = model.AddClrObjectDataSourceCommand;
            DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate(targetElement, (IPropertyId)targetProperty, true);

            if (dataContextInfo.DataSource.IsValidWithSource)
            {
                ISchema schemaForDataSource = SchemaManager.GetSchemaForDataSource(dataContextInfo.DataSource.SourceNode);
                if (schemaForDataSource != null && !(schemaForDataSource is EmptySchema))
                {
                    this.dataContext = schemaForDataSource.GetNodePathFromPath(dataContextInfo.DataSource.Path);
                }
            }
            this.bindsTwoWayByDefault = this.BindsTwoWayByDefault(targetElement, targetProperty);
            this.bindingFilterModes   = new ObservableCollection <BindingFilterMode>();
            this.bindingFilterModes.Add(BindingFilterMode.None);
            this.bindingFilterModes.Add(BindingFilterMode.FilterByType);
            ICollectionView defaultView = CollectionViewSource.GetDefaultView((object)this.bindingFilterModes);

            defaultView.MoveCurrentTo((object)BindingFilterMode.FilterByType);
            this.bindingSources  = new ObservableCollection <IBindingSourceModel>();
            this.dataSourceModel = new DataSourceBindingSourceModel(model, new DataSchemaItemFilter(this.BindingFilter));
            this.AddBindingSource((IBindingSourceModel)this.dataSourceModel);
            if (targetElement.ViewModel.ActiveEditingContainer is SceneElement)
            {
                this.elementPropertyModel = new ElementPropertyBindingSourceModel(targetElement, new DataSchemaItemFilter(this.BindingFilter));
                this.AddBindingSource((IBindingSourceModel)this.elementPropertyModel);
            }
            this.explicitDataContextModel = new ExplicitDataContextBindingSourceModel(targetElement, targetProperty, new DataSchemaItemFilter(this.BindingFilter));
            this.AddBindingSource((IBindingSourceModel)this.explicitDataContextModel);
            this.bindingSourcesProxy = new BindingProxy <IBindingSourceModel>();
            this.bindingSourcesProxy.PropertyChanged += new PropertyChangedEventHandler(this.BindingSourcesProxy_PropertyChanged);
            this.bindingSourcesView = (CollectionView) new DataBindingProxyCollectionView <IBindingSourceModel>(this.bindingSources, (IDataBindingProxy <IBindingSourceModel>) this.bindingSourcesProxy);
            BindingSceneNode binding = targetElement.GetBinding((IPropertyId)targetProperty);

            if (binding != null)
            {
                this.SetExistingBindingValues(binding);
            }
            else if (!(this.explicitDataContextModel.Schema is EmptySchema))
            {
                this.bindingSourcesView.MoveCurrentTo((object)this.explicitDataContextModel);
            }
            else
            {
                this.bindingSourcesView.MoveCurrentTo((object)this.dataSourceModel);
            }
            if (binding == null || !binding.IsModeSet)
            {
                this.CurrentBindingMode = BindingPropertyHelper.GetDefaultBindingMode(this.TargetElement.DocumentNode, (IPropertyId)this.TargetProperty, this.CurrentDataPath).Mode;
            }
            this.bindingSourcesView.CurrentChanging += new CurrentChangingEventHandler(this.BindingSourcesView_CurrentChanging);
            defaultView.CurrentChanged += new EventHandler(this.BindingFilterModesView_CurrentChanged);
            this.PropertyChanged       += new PropertyChangedEventHandler(this.DataBindingDialogModel_PropertyChanged);
        }
        public SampleDataEditorModel(DataSchemaNodePath schemaPath, IMessageDisplayService messageService)
        {
            this.messageService = messageService;
            SampleType     sampleType         = schemaPath.Node.SampleType;
            DataSchemaNode collectionItemNode = schemaPath.EffectiveCollectionItemNode;

            this.editingSchemaPath    = new DataSchemaNodePath(schemaPath.Schema, collectionItemNode.Parent);
            this.sampleCompositeType  = (SampleCompositeType)collectionItemNode.SampleType;
            this.ValueBuilder         = new SampleDataValueBuilderBase(this.SampleDataSet, this.SampleDataSet.RootNode.Context);
            this.SampleDataProperties = (IList <SampleDataProperty>) new List <SampleDataProperty>();
            foreach (SampleProperty sampleProperty in (IEnumerable <SampleProperty>) this.sampleCompositeType.SampleProperties)
            {
                if (sampleProperty.IsBasicType)
                {
                    this.SampleDataProperties.Add(new SampleDataProperty(sampleProperty, this));
                }
            }
            ((List <SampleDataProperty>) this.SampleDataProperties).Sort((Comparison <SampleDataProperty>)((a, b) => StringLogicalComparer.Instance.Compare(a.SampleProperty.Name, b.SampleProperty.Name)));
            this.sourceCollectionNode = this.GetCollectionNode(this.SampleDataSet.RootNode, false);
            this.ValueBuilder.InitCollectionDepth(this.editingSchemaPath);
            List <SampleDataRow> rows = new List <SampleDataRow>();

            if (this.sourceCollectionNode != null)
            {
                int count = this.sourceCollectionNode.Children.Count;
                for (int rowNumber = 0; rowNumber < count; ++rowNumber)
                {
                    rows.Add(new SampleDataRow(this, rowNumber));
                }
            }
            this.SampleDataRows = (ObservableCollection <SampleDataRow>) new SampleDataEditorModel.SampleDataRowCollection(rows);
        }
        public ConfigureSampleDataDialog(DataSchemaNodePath schemaPath, IMessageDisplayService messageService)
        {
            this.Title      = StringTable.SampleDataConfigurationDialogTitle;
            this.MinWidth   = ConfigureSampleDataDialog.dialogSize.Width;
            this.MinHeight  = ConfigureSampleDataDialog.dialogSize.Height;
            this.Height     = ConfigureSampleDataDialog.dialogSize.Height;
            this.Width      = ConfigureSampleDataDialog.dialogSize.Width;
            this.ResizeMode = ResizeMode.CanResize;
            this.Model      = new SampleDataEditorModel(schemaPath, messageService);
            FrameworkElement element = Microsoft.Expression.DesignSurface.FileTable.GetElement("Resources\\DataPane\\ConfigureSampleDataDialog.xaml");

            this.DialogContent            = (UIElement)element;
            this.sampleDataGrid           = (DataGrid)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "SampleDataGrid");
            this.rowsSlider               = (NumberEditor)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "RowsSlider");
            this.acceptButton             = (Button)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "AcceptButton");
            this.rowsSlider.KeyDown      += new KeyEventHandler(this.HandleEnterPressOnRowsSlider);
            this.sampleDataGrid.GotFocus += new RoutedEventHandler(this.sampleDataGrid_GotFocus);
            if (this.sampleDataGrid != null)
            {
                this.Columns = (IList <SampleDataDialogColumn>) new List <SampleDataDialogColumn>();
                foreach (SampleDataProperty property in (IEnumerable <SampleDataProperty>) this.Model.SampleDataProperties)
                {
                    SampleDataDialogColumn column = new SampleDataDialogColumn(property, this);
                    this.Columns.Add(column);
                    this.StyleColumnHeader(column);
                    this.sampleDataGrid.Columns.Add((DataGridColumn)column);
                }
            }
            element.DataContext = (object)this.Model;
        }
Esempio n. 4
0
 public MiniSourceBindingDialogModel(DataSchemaNodePath bindingPath, SceneNode targetElement, IType targetPropertyType)
     : base(bindingPath, targetElement, (ReferenceStep)null)
 {
     this.targetPropertyType      = targetPropertyType;
     this.sourceBindingProperties = MiniSourceBindingDialogModel.GetBindableProperties(targetElement, targetPropertyType);
     this.Initialize();
 }
Esempio n. 5
0
 public DataSchemaItem(DataSchemaNodePath nodePath, SchemaItem schemaItem, DataPanelModel model, SelectionContext <DataModelItemBase> selectionContext)
     : base(selectionContext)
 {
     this.nodePath           = nodePath;
     this.schemaItem         = schemaItem;
     this.model              = model;
     this.doubleClickCommand = (ICommand) new DelegateCommand(new DelegateCommand.SimpleEventHandler(this.OnDoubleClicked));
     this.PropertyChanged   += new PropertyChangedEventHandler(this.DataSchemaItem_PropertyChanged);
 }
Esempio n. 6
0
        public DataSchemaItem GetItemFromPath(string path)
        {
            DataSchemaNodePath nodePathFromPath = this.schema.GetNodePathFromPath(path);

            if (nodePathFromPath != null && nodePathFromPath.Node != null)
            {
                return(this.FindDataSchemaItemForNode(nodePathFromPath));
            }
            return((DataSchemaItem)null);
        }
Esempio n. 7
0
        public static BindingSceneNode CreateElementNameBinding(DataSchemaNodePath bindingPath, SceneNode target, IType targetPropertyType)
        {
            MiniSourceBindingDialogModel bindingDialogModel = new MiniSourceBindingDialogModel(bindingPath, target, targetPropertyType);
            bool?nullable = new MiniBindingDialog((MiniBindingDialogModel)bindingDialogModel).ShowDialog();

            if ((!nullable.GetValueOrDefault() ? 1 : (!nullable.HasValue ? true : false)) != 0)
            {
                return((BindingSceneNode)null);
            }
            return(bindingDialogModel.CreateElementNameBinding(target));
        }
Esempio n. 8
0
 public DataSourceInfo(DataSchemaNodePath bindingPath)
 {
     this.SourceNode = bindingPath.Schema.DataSource.DocumentNode;
     if (this.SourceNode == null)
     {
         this.Category = DataSourceCategory.Invalid;
     }
     else
     {
         this.Category = bindingPath.Schema is XmlSchema ? DataSourceCategory.Xml : DataSourceCategory.Clr;
         this.Path     = bindingPath.Path;
     }
 }
        public MiniTargetBindingDialogModel(DataSchemaNodePath bindingPath, SceneNode targetElement, ReferenceStep targetProperty, bool useDesignDataContext)
            : base(bindingPath, targetElement, targetProperty)
        {
            this.useDesignDataContext     = useDesignDataContext;
            this.targetBindableProperties = BindingPropertyHelper.GetBindableTargetProperties(this.TargetElement);
            IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(this.TargetElement.Type);

            if (dataContextProperty != null && !this.TargetElement.ViewModel.BindingEditor.CanCreateAndSetBindingOrData(targetElement, (IPropertyId)dataContextProperty, bindingPath, true))
            {
                this.targetBindableProperties.Remove((ReferenceStep)dataContextProperty);
            }
            this.Initialize();
        }
Esempio n. 10
0
        public override SceneNode CreateBindingOrData(SceneViewModel viewModel, string bindingPath, SceneNode targetNode, IProperty targetProperty)
        {
            SceneNode          sceneNode        = (SceneNode)null;
            DataSchemaNodePath nodePathFromPath = this.Schema.GetNodePathFromPath(bindingPath);

            if (nodePathFromPath != null)
            {
                sceneNode = (SceneNode)(viewModel.BindingEditor.CreateAndSetBindingOrData(targetNode, (IPropertyId)targetProperty, nodePathFromPath) as BindingSceneNode);
            }
            if (sceneNode == null)
            {
                sceneNode = (SceneNode)this.CreateFallbackBind(viewModel, bindingPath, targetNode, targetProperty);
            }
            return(sceneNode);
        }
Esempio n. 11
0
        public string GetPath(DataSchemaNodePath nodePath)
        {
            if (nodePath == null || nodePath.Node == this.root)
            {
                return(string.Empty);
            }
            DataSchemaNode node             = nodePath.Node;
            bool           isCollectionItem = node.IsCollectionItem;
            string         str = node.PathName;

            for (DataSchemaNode parent = node.Parent; parent != this.Root && parent != null; parent = parent.Parent)
            {
                str = isCollectionItem ? parent.PathName + str : parent.PathName + "." + str;
                isCollectionItem = parent.IsCollectionItem;
            }
            return(str);
        }
Esempio n. 12
0
        public bool IsSubpathOf(DataSchemaNodePath superPath)
        {
            if (this.Schema.Root != superPath.Schema.Root || this.Schema.Root == null || superPath.Schema.Root == null)
            {
                return(false);
            }
            DataSchemaNode parent = superPath.Schema.Root.Parent;

            for (DataSchemaNode dataSchemaNode = superPath.Node; dataSchemaNode != parent; dataSchemaNode = dataSchemaNode.Parent)
            {
                if (dataSchemaNode == this.Node)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 13
0
        internal ExplicitDataContextBindingSourceModel(SceneNode targetElement, ReferenceStep targetProperty, DataSchemaItemFilter dataSchemaFilter)
        {
            this.schema     = SchemaManager.GetSchemaForDataSourceInfo(new DataContextEvaluator().Evaluate(targetElement, (IPropertyId)targetProperty, true).DataSource);
            this.schemaItem = new SchemaItem(this.schema);
            DataSchemaNodePath nodePathFromPath = this.schema.GetNodePathFromPath((string)null);

            if (nodePathFromPath != null && nodePathFromPath.Node != null)
            {
                this.schemaItem.SelectedItem = this.schemaItem.FindDataSchemaItemForNode(nodePathFromPath);
            }
            this.schemaItem.SetDataSchemaItemFilter(dataSchemaFilter);
            this.schemaItem.PropertyChanged += new PropertyChangedEventHandler(this.schemaItem_PropertyChanged);
            if (this.schema is EmptySchema || this.schemaItem.Root == null)
            {
                return;
            }
            this.schemaItem.Root.IsExpanded = true;
        }
Esempio n. 14
0
        public static SceneNode CreateAndSetBindingOrData(DataSchemaNodePath bindingPath, SceneNode target, bool useDesignDataContext, ref ReferenceStep targetProperty)
        {
            MiniTargetBindingDialogModel bindingDialogModel = new MiniTargetBindingDialogModel(bindingPath, target, targetProperty, useDesignDataContext);
            MiniBindingDialog            miniBindingDialog  = new MiniBindingDialog((MiniBindingDialogModel)bindingDialogModel);

            if (targetProperty == null)
            {
                using (TemporaryCursor.SetCursor((Cursor)null))
                {
                    bool?nullable = miniBindingDialog.ShowDialog();
                    if ((!nullable.GetValueOrDefault() ? 1 : (!nullable.HasValue ? true : false)) != 0)
                    {
                        return((SceneNode)null);
                    }
                }
            }
            return(bindingDialogModel.CreateAndSetBindingOrData(ref targetProperty));
        }
Esempio n. 15
0
 public SchemaItem(ISchema schema, DataPanelModel model, SelectionContext <DataModelItemBase> selectionContext)
 {
     this.model = model;
     this.itemSelectionContext = selectionContext ?? (SelectionContext <DataModelItemBase>) new SingleSelectionContext <DataModelItemBase>();
     this.itemSelectionContext.PropertyChanged += new PropertyChangedEventHandler(this.itemSelectionContext_PropertyChanged);
     this.schema    = schema;
     this.flattener = new VirtualizingTreeItemFlattener <DataModelItemBase>((ITreeViewItemProvider <DataModelItemBase>) this);
     if (this.schema.Root != null)
     {
         DataSchemaNodePath nodePath = new DataSchemaNodePath(this.schema, this.schema.Root);
         this.itemSelectionContext.Clear();
         this.ClearSchemaItemTree(this.root);
         this.root = new DataSchemaItem(nodePath, this, this.model, this.itemSelectionContext);
         this.root.EnsureChildrenExpanded();
     }
     this.OnPropertyChanged("Root");
     this.flattener.RebuildList();
 }
Esempio n. 16
0
        public void ProcessChildren(DataSchemaItem dataSchemaItem)
        {
            DataSchemaNodePath dataSchemaNodePath = dataSchemaItem.DataSchemaNodePath;
            DataSchemaNode     dataSchemaNode     = dataSchemaNodePath.Node;
            bool flag = true;

            while (dataSchemaNode.IsCollection && dataSchemaNode.CollectionItem != null && dataSchemaNode.CollectionItem.Type != typeof(object))
            {
                dataSchemaNode = dataSchemaNode.CollectionItem;
            }
            if (dataSchemaNode.Type == typeof(string) && !(dataSchemaItem.DataSchemaNodePath.Schema is XmlSchema))
            {
                flag = false;
            }
            else if (dataSchemaItem.SampleType is SampleBasicType)
            {
                flag = false;
            }
            else if (dataSchemaNode != dataSchemaNodePath.Node)
            {
                SampleCollectionType sampleCollectionType = dataSchemaNodePath.Node.SampleType as SampleCollectionType;
                if (sampleCollectionType != null && sampleCollectionType.ItemSampleType is SampleBasicType)
                {
                    flag = false;
                }
            }
            if (flag)
            {
                foreach (DataSchemaNode node in dataSchemaNode.Children)
                {
                    DataSchemaItem dataSchemaItem1 = new DataSchemaItem(dataSchemaNodePath.GetExtendedPath(node), this, this.model, this.itemSelectionContext);
                    dataSchemaItem.AddChild((DataModelItemBase)dataSchemaItem1);
                }
            }
            if (this.lastFilter == null)
            {
                return;
            }
            dataSchemaItem.SetFilter(this.lastFilter);
        }
Esempio n. 17
0
        public DataSchemaItem FindDataSchemaItemForNode(DataSchemaNodePath descendant)
        {
            DataSchemaItem         currentItem = this.root;
            Stack <DataSchemaNode> stack       = new Stack <DataSchemaNode>();

            for (DataSchemaNode dataSchemaNode = descendant.Node; dataSchemaNode != this.root.DataSchemaNode; dataSchemaNode = dataSchemaNode.Parent)
            {
                stack.Push(dataSchemaNode);
            }
            while (stack.Count > 0)
            {
                DataSchemaNode nextNode = stack.Pop();
                DataSchemaNode adjustedNextNode;
                currentItem = this.GetItemForNode(currentItem, nextNode, out adjustedNextNode);
                if (adjustedNextNode != nextNode)
                {
                    do
                    {
                        ;
                    }while (stack.Count > 0 && stack.Pop() != adjustedNextNode);
                }
            }
            return(currentItem);
        }
Esempio n. 18
0
 private void UpdateBindingModes()
 {
     if (!this.IsBinding)
     {
         return;
     }
     if (!this.IsExpanded)
     {
         this.CurrentBindingMode = BindingPropertyHelper.GetDefaultBindingMode(this.TargetElement.DocumentNode, (IPropertyId)this.TargetProperty, this.CurrentDataPath).Mode;
     }
     else
     {
         DataSchemaNodePath relativeSchemaPath = this.CurrentRelativeSchemaPath;
         bool flag = false;
         if (relativeSchemaPath != null)
         {
             if (!relativeSchemaPath.Node.IsReadOnly && relativeSchemaPath.Node != relativeSchemaPath.Schema.Root)
             {
                 flag = true;
             }
         }
         else if (this.UseCustomBindingExpression && !string.IsNullOrEmpty(this.CustomBindingExpression))
         {
             flag = true;
         }
         if (this.canSetTwoWayBinding.HasValue && this.canSetTwoWayBinding.Value == flag)
         {
             return;
         }
         this.canSetTwoWayBinding = new bool?(flag);
         if (flag)
         {
             if (!this.BindingModesCollection.Contains(BindingMode.TwoWay) && this.IsBindingModeSupported(BindingMode.TwoWay))
             {
                 this.BindingModesCollection.Add(BindingMode.TwoWay);
             }
             if (!this.BindingModesCollection.Contains(BindingMode.OneWayToSource) && this.IsBindingModeSupported(BindingMode.OneWayToSource))
             {
                 this.BindingModesCollection.Add(BindingMode.OneWayToSource);
             }
             if (this.BindingModesCollection.Contains(BindingMode.Default) || !this.IsBindingModeSupported(BindingMode.Default))
             {
                 return;
             }
             this.BindingModesCollection.Insert(0, BindingMode.Default);
         }
         else
         {
             if (this.CurrentBindingMode == BindingMode.TwoWay || this.CurrentBindingMode == BindingMode.OneWayToSource || this.bindsTwoWayByDefault && this.CurrentBindingMode == BindingMode.Default)
             {
                 if ((relativeSchemaPath != null ? relativeSchemaPath.Node : (DataSchemaNode)null) == null)
                 {
                     if (this.bindsTwoWayByDefault)
                     {
                         this.CurrentBindingMode = BindingMode.OneWay;
                     }
                     else
                     {
                         this.CurrentBindingMode = (BindingMode)this.TargetElement.ProjectContext.GetCapabilityValue(PlatformCapability.DefaultBindingMode);
                     }
                 }
                 else
                 {
                     this.CurrentBindingMode = BindingPropertyHelper.GetDefaultBindingMode(this.TargetElement.DocumentNode, (IPropertyId)this.TargetProperty, relativeSchemaPath).Mode;
                 }
             }
             this.BindingModesCollection.Remove(BindingMode.TwoWay);
             this.BindingModesCollection.Remove(BindingMode.OneWayToSource);
             if (!this.bindsTwoWayByDefault)
             {
                 return;
             }
             this.BindingModesCollection.Remove(BindingMode.Default);
         }
     }
 }
Esempio n. 19
0
 public DataSchemaNodePath GetRelativeNodePath(DataSchemaNodePath childNodePath)
 {
     return(this.GetRelativeNodePath(childNodePath.Node));
 }
Esempio n. 20
0
        public static BindingModeInfo GetDefaultBindingMode(DocumentNode targetNode, IPropertyId targetProperty, DataSchemaNodePath schemaPath)
        {
            BindingMode      mode             = (BindingMode)targetNode.TypeResolver.GetCapabilityValue(PlatformCapability.DefaultBindingMode);
            BindingDirection bindingDirection = (BindingDirection)targetNode.TypeResolver.GetCapabilityValue(PlatformCapability.DefaultBindingDirection);
            DependencyPropertyReferenceStep propertyReferenceStep = targetNode.TypeResolver.ResolveProperty(targetProperty) as DependencyPropertyReferenceStep;
            bool flag = false;

            if (schemaPath != null)
            {
                if (schemaPath.Node.IsReadOnly)
                {
                    flag = true;
                }
                else if (schemaPath.Node == schemaPath.Schema.Root)
                {
                    flag = !DataContextHelper.IsDataContextProperty(targetNode, (IPropertyId)propertyReferenceStep);
                }
            }
            if (flag)
            {
                if (mode == BindingMode.Default && bindingDirection == BindingDirection.TwoWay && (propertyReferenceStep != null && propertyReferenceStep.BindsTwoWayByDefault(targetNode.Type.RuntimeType)))
                {
                    return(new BindingModeInfo(BindingMode.OneWay, false));
                }
                if (schemaPath.IsCollection)
                {
                    return(new BindingModeInfo(mode, true));
                }
                return(new BindingModeInfo(BindingMode.OneWay, false));
            }
            if (bindingDirection == BindingDirection.TwoWay)
            {
                return(new BindingModeInfo(mode, true));
            }
            IProperty property = targetNode.TypeResolver.ResolveProperty(targetProperty);

            if (property != null)
            {
                BindableAttribute bindableAttribute = property.Attributes[typeof(BindableAttribute)] as BindableAttribute;
                if (bindableAttribute != null && bindableAttribute.Direction == BindingDirection.TwoWay)
                {
                    return(new BindingModeInfo(BindingMode.TwoWay, false));
                }
            }
            return(new BindingModeInfo(mode, true));
        }
Esempio n. 21
0
 public string GetPath(DataSchemaNodePath nodePath)
 {
     return(this.GetPathInternal(this.root, nodePath.Node));
 }
Esempio n. 22
0
 public void Dispose()
 {
     this.nodePath = (DataSchemaNodePath)null;
 }
Esempio n. 23
0
        private static string ProvideNodePathForPendingEdit(DataSchemaItem parentItem, string newPropertyName, params SampleProperty[] renamedProperties)
        {
            DataSchemaNodePath dataSchemaNodePath = parentItem.DataSchemaNodePath;
            DataSchemaNode     endNode            = (DataSchemaNode)null;

            if (dataSchemaNodePath.IsCollection)
            {
                endNode = dataSchemaNodePath.EffectiveCollectionItemNode;
            }
            if (endNode == null)
            {
                endNode = dataSchemaNodePath.Node;
            }
            if (endNode == null)
            {
                return(newPropertyName);
            }
            string inheritedPath = (string)null;

            if (renamedProperties.Length == 0)
            {
                if (endNode != dataSchemaNodePath.Node)
                {
                    dataSchemaNodePath = new DataSchemaNodePath(dataSchemaNodePath.Schema, endNode);
                }
                return(ClrObjectSchema.CombinePaths(dataSchemaNodePath.Path, newPropertyName));
            }
            List <string> list = new List <string>()
            {
                newPropertyName
            };
            string pathName = endNode.PathName;

            for (DataSchemaNode parent = endNode.Parent; parent != null; parent = parent.Parent)
            {
                SampleCompositeType sampleCompositeType = parent.SampleType as SampleCompositeType;
                if (sampleCompositeType == null)
                {
                    list.Add(pathName);
                }
                else
                {
                    string         name           = pathName;
                    SampleProperty sampleProperty = sampleCompositeType.GetSampleProperty(name);
                    if (Enumerable.FirstOrDefault <SampleProperty>((IEnumerable <SampleProperty>)renamedProperties, (Func <SampleProperty, bool>)(p => p == sampleProperty)) != null)
                    {
                        name = newPropertyName;
                    }
                    list.Add(name);
                }
                if (parent != dataSchemaNodePath.Schema.Root)
                {
                    pathName = parent.PathName;
                }
                else
                {
                    break;
                }
            }
            for (int index = list.Count - 1; index >= 0; --index)
            {
                inheritedPath = ClrObjectSchema.CombinePaths(inheritedPath, list[index]);
            }
            return(inheritedPath);
        }
Esempio n. 24
0
 public string GetPath(DataSchemaNodePath nodePath)
 {
     return(string.Empty);
 }
Esempio n. 25
0
 protected MiniBindingDialogModel(DataSchemaNodePath bindingPath, SceneNode targetElement, ReferenceStep targetProperty)
     : base(targetElement, targetProperty)
 {
     this.bindingPath = bindingPath;
 }