///<summary> /// Called to Add the object as a Child. ///</summary> /// <exception cref="ArgumentNullException">value is NULL.</exception> /// <exception cref="ArgumentException">value is not of type FixedPage.</exception> /// <exception cref="InvalidOperationException">A child already exists (a PageContent can have at most one child).</exception> ///<param name="value"> /// Object to add as a child ///</param> /// <ExternalAPI/> void IAddChild.AddChild(Object value) { // VerifyAccess(); if (value == null) { throw new ArgumentNullException("value"); } FixedPage fp = value as FixedPage; if (fp == null) { throw new ArgumentException(SR.Get(SRID.UnexpectedParameterType, value.GetType(), typeof(FixedPage)), "value"); } if (_child != null) { throw new InvalidOperationException(SR.Get(SRID.CanOnlyHaveOneChild, typeof(PageContent), value)); } _pageRef = null; _child = fp; LogicalTreeHelper.AddLogicalChild(this, _child); }
// Token: 0x06007822 RID: 30754 RVA: 0x00223D06 File Offset: 0x00221F06 private void SetModelParent(object item) { if (this.ModelParentFE != null && item is DependencyObject) { LogicalTreeHelper.AddLogicalChild(this.ModelParentFE, null, item); } }
/// <summary>Synchronously loads and parses the document specified by the <see cref="P:System.Windows.Documents.DocumentReference.Source" /> property location.</summary> /// <param name="forceReload"> /// <see langword="true" /> to force a new load of the <see cref="P:System.Windows.Documents.DocumentReference.Source" /> document, even if it was previously loaded.</param> /// <returns>The document that was loaded.</returns> // Token: 0x06002B56 RID: 11094 RVA: 0x000C6024 File Offset: 0x000C4224 public FixedDocument GetDocument(bool forceReload) { base.VerifyAccess(); FixedDocument fixedDocument = null; if (this._doc != null) { fixedDocument = this._doc; } else { if (!forceReload) { fixedDocument = this.CurrentlyLoadedDoc; } if (fixedDocument == null) { FixedDocument fixedDocument2 = this._LoadDocument(); if (fixedDocument2 != null) { this._docIdentity = fixedDocument2; fixedDocument = fixedDocument2; } } } if (fixedDocument != null) { LogicalTreeHelper.AddLogicalChild(base.Parent, fixedDocument); } return(fixedDocument); }
/// <summary>For a description of this member, see <see cref="M:System.Windows.Markup.IAddChild.AddChild(System.Object)" />.</summary> /// <param name="value">The child <see cref="T:System.Object" /> to add.</param> // Token: 0x06003239 RID: 12857 RVA: 0x000DC47C File Offset: 0x000DA67C void IAddChild.AddChild(object value) { if (value == null) { throw new ArgumentNullException("value"); } FixedPage fixedPage = value as FixedPage; if (fixedPage == null) { throw new ArgumentException(SR.Get("UnexpectedParameterType", new object[] { value.GetType(), typeof(FixedPage) }), "value"); } if (this._child != null) { throw new InvalidOperationException(SR.Get("CanOnlyHaveOneChild", new object[] { typeof(PageContent), value })); } this._pageRef = null; this._child = fixedPage; LogicalTreeHelper.AddLogicalChild(this, this._child); }
// NOTE: Only change the item's logical links if the host is a Visual (bug 986386) void SetModelParent(object item) { // to avoid the unnecessary, expensive code in AddLogicalChild, check for DO first if ((ModelParentFE != null) && (item is DependencyObject)) { LogicalTreeHelper.AddLogicalChild(ModelParentFE, null, item); } }
// Token: 0x0600324E RID: 12878 RVA: 0x000DC808 File Offset: 0x000DAA08 private void _RequestPageCallback(IAsyncResult ar) { PageContentAsyncResult pageContentAsyncResult = (PageContentAsyncResult)ar; if (pageContentAsyncResult == this._asyncOp && pageContentAsyncResult.Result != null) { LogicalTreeHelper.AddLogicalChild(this, pageContentAsyncResult.Result); this._pageRef = new WeakReference(pageContentAsyncResult.Result); } this._asyncOp = null; this._NotifyPageCompleted(pageContentAsyncResult.Result, pageContentAsyncResult.Exception, pageContentAsyncResult.IsCancelled, pageContentAsyncResult.AsyncState); }
protected override View /*Group*/ CreateLayoutControl(UIElement value) { LogicalTreeHelper.AddLogicalChild(this, value); var innerLayoutControl = new NativeScrollViewer(this.Context); innerLayoutControl.ScrollChanged += innerDefaultControl_ScrollChanged; innerLayoutControl.LayoutParameters = this.CreateLayoutParams(); innerLayoutControl.ChildView = value.NativeUIElement; SetBackground(); this.ContentNativeUIElement = innerLayoutControl; return(this.ContentNativeUIElement); }
// [....] load a page private FixedPage _LoadPage() { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageBegin); FixedPage p = null; Stream pageStream; try { if (_child != null) { p = _child; } else { Uri uriToLoad = _ResolveUri(); if (uriToLoad != null) { _LoadPageImpl(((IUriContext)this).BaseUri, uriToLoad, out p, out pageStream); if (p == null || p.IsInitialized) { pageStream.Close(); } else { _pendingStreams.Add(p, pageStream); p.Initialized += new EventHandler(_OnPaserFinished); } } } if (p != null) { LogicalTreeHelper.AddLogicalChild(this, p); _pageRef = new WeakReference(p); } else { _pageRef = null; } } finally { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageEnd); } return(p); }
public override View GetView(int position, View reusableView, ViewGroup parent) { UIElement listItem; if (reusableView == null) { reusableView = new WrapedViewGroup(parent.Context); listItem = (UIElement)this.Generator.ContainerFromIndex(position); LogicalTreeHelper.AddLogicalChild(this.ListPicker, listItem); this.NativeViewContainers.Add(listItem.NativeUIElement, listItem); ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement); } else { var nativeItem = ((WrapedViewGroup)reusableView).GetChildAt(0); if (this.NativeViewContainers.ContainsKey(nativeItem)) { listItem = this.NativeViewContainers[nativeItem]; this.Generator.Reuse(position, listItem); } else { ((WrapedViewGroup)reusableView).RemoveAllViews(); listItem = (UIElement)this.Generator.ContainerFromIndex(position); LogicalTreeHelper.AddLogicalChild(this.ListPicker, listItem); this.NativeViewContainers.Add(listItem.NativeUIElement, listItem); ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement); } } var width = GetDialogWidth() / WidthDivider; var availableSize = new SizeF(ScreenProperties.ConvertPixelsToDPI(width), float.PositiveInfinity); var measuredSize = listItem.MeasureOverride(availableSize); listItem.Arrange(new RectangleF(PointF.Empty, measuredSize)); ThreadPool.QueueUserWorkItem(o => DisableTouch((View)listItem.NativeUIElement.Parent)); // Need to use AbsListView.LayoutParams to prevent Java.CastException reusableView.LayoutParameters = new AbsListView.LayoutParams((int)width, (int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Height)); //if (position == this.SelectedItemPosition) //{ // listItem.NativeUIElement.SetBackgroundColor(Android.Graphics.Color.ParseColor("#33b5e5")); // lastSelectedView = listItem.NativeUIElement; //} //else //{ // listItem.NativeUIElement.SetBackgroundColor(Android.Graphics.Color.Transparent); //} return(reusableView); }
private void _RequestPageCallback(IAsyncResult ar) { PageContentAsyncResult par = (PageContentAsyncResult)ar; if (par == _asyncOp && par.Result != null) { //par.Result.IsTreeSeparator = true; LogicalTreeHelper.AddLogicalChild(this, par.Result); _pageRef = new WeakReference(par.Result); } // Set outstanding async op to null to allow for reentrancy during callback. _asyncOp = null; _NotifyPageCompleted(par.Result, par.Exception, par.IsCancelled, par.AsyncState); }
private void OnNativeContentChanged(UIElement oldValue, UIElement newValue) { if (this.NativeUIElement != null) { if (oldValue != null) { oldValue.NativeUIElement.RemoveFromSuperview(); } LogicalTreeHelper.AddLogicalChild(this, newValue); this.NativeUIElement.AddSubview(newValue.NativeUIElement); } else { LogicalTreeHelper.AddLogicalChild(this, newValue); } }
protected internal override void NativeInit() { base.NativeInit(); if (this.Parent != null && this.Context != null) { this.NativeOnbackgroundChange(); foreach (var child in this.Children) { if (child.NativeUIElement != null && child.NativeUIElement.Parent != this.NativeUIElement) { LogicalTreeHelper.AddLogicalChild(this, child); this.AddNativeChildView(child); } } } }
// Token: 0x0600324F RID: 12879 RVA: 0x000DC870 File Offset: 0x000DAA70 private FixedPage _LoadPage() { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageBegin); FixedPage fixedPage = null; try { if (this._child != null) { fixedPage = this._child; } else { Uri uri = this._ResolveUri(); if (uri != null) { Stream stream; PageContent._LoadPageImpl(((IUriContext)this).BaseUri, uri, out fixedPage, out stream); if (fixedPage == null || fixedPage.IsInitialized) { stream.Close(); } else { this._pendingStreams.Add(fixedPage, stream); fixedPage.Initialized += this._OnPaserFinished; } } } if (fixedPage != null) { LogicalTreeHelper.AddLogicalChild(this, fixedPage); this._pageRef = new WeakReference(fixedPage); } else { this._pageRef = null; } } finally { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageEnd); } return(fixedPage); }
public override View GetView(int position, View reusableView, ViewGroup parent) { UIElement listItem; if (reusableView == null) { reusableView = new WrapedViewGroup(parent.Context); listItem = (UIElement)this.Generator.ContainerFromIndex(position); LogicalTreeHelper.AddLogicalChild(this.VirtualizingStackPanel, listItem); this.NativeViewContainers.Add(listItem.NativeUIElement, listItem); ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement); } else { var nativeItem = ((WrapedViewGroup)reusableView).GetChildAt(0); if (this.NativeViewContainers.ContainsKey(nativeItem)) { listItem = this.NativeViewContainers[nativeItem]; this.Generator.Reuse(position, listItem); } else { ((WrapedViewGroup)reusableView).RemoveAllViews(); listItem = (UIElement)this.Generator.ContainerFromIndex(position); LogicalTreeHelper.AddLogicalChild(this.VirtualizingStackPanel, listItem); this.NativeViewContainers.Add(listItem.NativeUIElement, listItem); ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement); } } var availableSize = this.VirtualizingStackPanel.Orientation == Orientation.Horizontal ? new SizeF(float.PositiveInfinity, this.VirtualizingStackPanel.measuredSize.Height) : new SizeF(this.VirtualizingStackPanel.measuredSize.Width, float.PositiveInfinity); var measuredSize = listItem.MeasureOverride(availableSize); listItem.Arrange(new RectangleF(PointF.Empty, measuredSize)); // Need to use AbsListView.LayoutParams to prevent Java.CastException reusableView.LayoutParameters = new AbsListView.LayoutParams((int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Width), (int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Height)); return(reusableView); }
//-------------------------------------------------------------------- // // Public Methods // //--------------------------------------------------------------------- #region Public Methods /// <summary> /// Synchonrously download and parse the document based on the Source specification. /// If a document was attached earlier and forceReload == false, the attached /// document will be returned. forceReload == true results in downloading of the referenced /// document based on Source specification, any previously attached document is ignored /// in this case. /// Regardless of forceReload, the document will be loaded based on Source specification if /// it hasn't been loaded earlier. /// </summary> /// <param name="forceReload">Force reloading the document instead of using cached value</param> /// <returns>The document tree</returns> public FixedDocument GetDocument(bool forceReload) { DocumentsTrace.FixedDocumentSequence.IDF.Trace(string.Format("DocumentReference.GetDocument ({0}, {1})", Source == null ? new Uri("", UriKind.RelativeOrAbsolute) : Source, forceReload)); VerifyAccess(); FixedDocument idp = null; if (_doc != null) { idp = _doc; } else { if (!forceReload) { idp = CurrentlyLoadedDoc; } if (idp == null) { FixedDocument idpReloaded = _LoadDocument(); if (idpReloaded != null) { DocumentsTrace.FixedDocumentSequence.IDF.Trace(string.Format("DocumentReference.GetDocument Loaded IDP {0}", idpReloaded.GetHashCode())); // save the doc's identity _docIdentity = idpReloaded; idp = idpReloaded; } } } if (idp != null) { LogicalTreeHelper.AddLogicalChild(this.Parent, idp); } return(idp); }
protected override View CreateDefaultControl(string value) { if (this.Content is string) { var control = new TextBlock { FontFamily = this.FontFamily, Text = this.Content as string, FontSize = this.FontSize, FontStyle = this.FontStyle, Foreground = this.Foreground }; LogicalTreeHelper.AddLogicalChild(this, control); return(control.NativeUIElement); } else { var innerDefaultControl = new Android.Widget.TextView(this.Context); innerDefaultControl.LayoutParameters = this.CreateLayoutParams(); innerDefaultControl.SetSingleLine(true); innerDefaultControl.TextFormatted = Html.FromHtml(String.Format("<a href=\"\">{0}</a>", value)); return(innerDefaultControl); } }
protected virtual View CreateLayoutControl(UIElement value) { LogicalTreeHelper.AddLogicalChild(this, value); return(value.NativeUIElement); }