private RawDataSourceInfoBase UnwindElementNameBindingInternal(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { RawDataSourceInfoBase localDataSource1 = localDataSource; bool flag = false; while (true) { RawDataSourceInfoBase dataSourceInfoBase = this.MoveToElementNameBinding(walker, localDataSource1 as ElementDataSourceInfo); if (dataSourceInfoBase != null) { localDataSource1 = dataSourceInfoBase; if (localDataSource1.IsValid) { flag = true; } else { break; } } else { goto label_5; } } return(localDataSource1); label_5: if (flag) { return(this.NavigateSpecialDataContextInternal(walker, localDataSource1, false)); } return(localDataSource1); }
public void MoveUpIfDataContextLocation(IDataContextAncestorWalker walker) { if (!this.IsDataContextLocation(walker)) { return; } walker.MoveNext(); }
public RawDataSourceInfoBase GetRawDataContextInfo(IDataContextAncestorWalker walker) { RawDataSourceInfoBase rawDataContextInfo = this.GetRawDataContextInfo(walker.CurrentNode); if (rawDataContextInfo == null || !rawDataContextInfo.IsValid) { return(rawDataContextInfo); } return(this.UnwindElementNameBindingInternal(walker, rawDataContextInfo)); }
private RawDataSourceInfoBase NavigateSpecialDataContextInternal(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource, bool unwindElementName) { RawDataSourceInfoBase localDataSource1 = unwindElementName ? this.UnwindElementNameBindingInternal(walker, localDataSource) : localDataSource; RawDataSourceInfoBase dataSourceInfoBase; do { dataSourceInfoBase = this.MoveToDataContextProperty(walker, localDataSource1) ?? this.MoveToSpecialDataContextPathExtension(walker, localDataSource1); if (dataSourceInfoBase != null) { localDataSource1 = dataSourceInfoBase; } }while (dataSourceInfoBase != null && dataSourceInfoBase.IsValid); return(localDataSource1); }
private RawDataSourceInfoBase MoveToSpecialDataContextPathExtension(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { if (walker.CurrentNode == null) { return((RawDataSourceInfoBase)null); } DataContextPropertyPathExtension propertyPathExtension1 = DataContextMetadata.GetDataContextPropertyPathExtension(walker.CurrentNode, walker.CurrentProperty); if (propertyPathExtension1 == null) { return((RawDataSourceInfoBase)null); } string propertyPathExtension2 = this.GetPropertyPathExtension(walker.CurrentNode, walker.CurrentProperty, propertyPathExtension1); if (propertyPathExtension2 == null) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } DocumentNode dataSourceNode = walker.CurrentNode.Properties[(IPropertyId)propertyPathExtension1.Property]; RawDataSourceInfoBase dataSourceInfoBase; if (dataSourceNode == null) { dataSourceInfoBase = (RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty; } else { dataSourceInfoBase = DataContextHelper.GetRawDataSourceInfo(dataSourceNode); if (dataSourceInfoBase.IsValid) { dataSourceInfoBase.AppendClrPath(propertyPathExtension2); } } RawDataSourceInfoBase localDataSource1 = dataSourceInfoBase.CombineWith(localDataSource); walker.MoveTo(walker.CurrentNode, propertyPathExtension1.Property, true); return(this.UnwindElementNameBindingInternal(walker, localDataSource1)); }
private RawDataSourceInfoBase MoveToDataContextProperty(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { if (walker.CurrentNode == null) { return((RawDataSourceInfoBase)null); } DataContextProperty dataContextProperty = DataContextMetadata.GetDataContextProperty(walker.CurrentNode, walker.CurrentProperty); if (dataContextProperty == null) { return((RawDataSourceInfoBase)null); } if (!dataContextProperty.IsValid) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } DocumentNode dataContextNode = dataContextProperty.DataContextNode; if (dataContextNode == null) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } this.OnDataSourceFound(walker.CurrentNode, walker.CurrentProperty); RawDataSourceInfoBase rawDataSourceInfo = DataContextHelper.GetRawDataSourceInfo(dataContextNode); if (rawDataSourceInfo.IsValid && dataContextProperty.IsCollectionItem) { rawDataSourceInfo.AppendIndexStep(); } RawDataSourceInfoBase localDataSource1 = rawDataSourceInfo.CombineWith(localDataSource); walker.MoveTo(dataContextProperty.SourceNode, dataContextProperty.Property, true); return(this.UnwindElementNameBindingInternal(walker, localDataSource1)); }
private RawDataSourceInfoBase MoveToElementNameBinding(IDataContextAncestorWalker walker, ElementDataSourceInfo elementBinding) { if (walker.CurrentNode == null || elementBinding == null || elementBinding.RootTargetProperty == null) { return((RawDataSourceInfoBase)null); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } this.OnDataSourceFound(walker.CurrentNode, walker.CurrentProperty); if (!walker.MoveTo(elementBinding.RootElement, elementBinding.RootTargetProperty, true)) { return((RawDataSourceInfoBase)null); } DocumentNode dataSourceNode = elementBinding.RootElement.Properties[(IPropertyId)elementBinding.RootTargetProperty]; RawDataSourceInfoBase dataSourceInfoBase = dataSourceNode != null?DataContextHelper.GetRawDataSourceInfo(dataSourceNode) : (RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty; if (dataSourceInfoBase.IsValid) { dataSourceInfoBase.AppendClrPath(elementBinding.NormalizedClrPath); } return(dataSourceInfoBase); }
public bool IsVisited(IDataContextAncestorWalker walker) { return(this.IsVisited((DocumentNode)walker.CurrentNode, walker.CurrentProperty)); }
public DataContextInfo Evaluate(IDataContextAncestorWalker walker, bool isForSettingValue) { this.visitedLocations.Reset(); DataContextInfo dataContextInfo1 = new DataContextInfo(); RawDataSourceInfoBase dataSourceInfoBase1 = (RawDataSourceInfoBase)null; bool flag = isForSettingValue; this.evaluatingInfo = dataContextInfo1; DataContextInfo dataContextInfo2 = (DataContextInfo)null; try { while (walker.MoveNext()) { if (flag) { flag = DataContextMetadata.GetDataContextAttribute <DualDataContextAttribute>(walker.CurrentProperty) != null; } RawDataSourceInfoBase dataSourceInfoBase2 = !flag?this.NavigateSpecialDataContextInternal(walker, dataSourceInfoBase1, true) : dataSourceInfoBase1; flag = false; if (dataSourceInfoBase2 != dataSourceInfoBase1) { dataSourceInfoBase1 = dataSourceInfoBase2; this.MoveUpIfDataContextLocation(walker); } if (dataSourceInfoBase1 != null) { if (!dataSourceInfoBase1.IsValid) { break; } } RawDataSourceInfoBase rawDataContextInfo = this.GetRawDataContextInfo(walker); if (rawDataContextInfo != null) { if (rawDataContextInfo.IsValid) { dataSourceInfoBase1 = rawDataContextInfo.CombineWith(dataSourceInfoBase1); } else if (dataSourceInfoBase1 != null) { dataSourceInfoBase1.SetInvalid(); } else { dataSourceInfoBase1 = rawDataContextInfo; } } if (dataSourceInfoBase1 != null) { if (dataSourceInfoBase1.IsValid) { if (dataSourceInfoBase1.HasSource) { break; } } else { break; } } if (dataContextInfo2 == null) { dataContextInfo2 = this.GetTypedTemplateDataContext(walker.CurrentNode, dataSourceInfoBase1); } } } finally { this.evaluatingInfo = (DataContextInfo)null; } if (dataContextInfo2 != null && dataContextInfo2.DataSource.IsValidWithSource && (dataSourceInfoBase1 == null || !dataSourceInfoBase1.IsValid || !dataSourceInfoBase1.HasSource)) { dataContextInfo1 = dataContextInfo2; } else { dataContextInfo1.RawDataSource = dataSourceInfoBase1; } return(dataContextInfo1); }
public RawDataSourceInfoBase UnwindElementNameBinding(IDataContextAncestorWalker walker, RawDataSourceInfoBase dataSource) { this.visitedLocations.Reset(); return(this.UnwindElementNameBindingInternal(walker, dataSource)); }
public bool IsDataContextLocation(IDataContextAncestorWalker walker) { return(DataContextHelper.IsDataContextProperty((DocumentNode)walker.CurrentNode, (IPropertyId)walker.CurrentProperty)); }
public RawDataSourceInfoBase NavigateSpecialDataContext(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { this.visitedLocations.Reset(); return(this.NavigateSpecialDataContextInternal(walker, localDataSource, true)); }