public iOSFormsInspectView(Page page, bool useNativeViewBounds = false, bool withSubviews = true) { if (page == null) { throw new ArgumentNullException(nameof(page)); } element = page; PopulateTypeInformationFromObject(page); // TODO: Pull the ClassId or some user-set property as the description? var view = Platform.GetRenderer(page).NativeView; if (!useNativeViewBounds) { var layer = view.Layer; Transform = XIVR.GetViewTransform(layer); if (Transform != null) { X = layer.Bounds.X; Y = layer.Bounds.Y; Width = layer.Bounds.Width; Height = layer.Bounds.Height; } else { X = layer.Frame.X; Y = layer.Frame.Y; Width = layer.Frame.Width; Height = layer.Frame.Height; } } else { var convertedOffset = view.ConvertPointToView(view.Frame.Location, view.Window); X = convertedOffset.X; Y = convertedOffset.Y; } Width = page.Bounds.Width; Height = page.Bounds.Height; Visibility = page.GetViewVisibility(); Kind = ViewKind.Primary; if (withSubviews) { HandlePageChildren( page, (p, b) => new iOSFormsInspectView(p, useNativeViewBounds || b, withSubviews), e => new iOSFormsInspectView(e, withSubviews), AddSubview ); } }
public iOSFormsInspectView(Element element, bool withSubviews = true) { if (element == null) { throw new ArgumentNullException(nameof(element)); } this.element = element; PopulateTypeInformationFromObject(element); var velement = element as VisualElement; if (velement != null) { Visibility = velement.GetViewVisibility(); var view = Platform.GetRenderer(velement).NativeView; var layer = view.Layer; Transform = XIVR.GetViewTransform(layer); if (Transform != null) { X = layer.Bounds.X; Y = layer.Bounds.Y; Width = layer.Bounds.Width; Height = layer.Bounds.Height; } else { X = layer.Frame.X; Y = layer.Frame.Y; Width = layer.Frame.Width; Height = layer.Frame.Height; } } else { // Since this is not a visual element, set it as collapsed by default. Visibility = ViewVisibility.Collapsed; } Kind = ViewKind.Primary; // TODO: Figure out different types of elements and extra useful data from them when appropriate. Description = GetDescriptionFromElement(element, supplementaryDescriptionMap); if (withSubviews) { HandleElementChildren(element, arg => new iOSFormsInspectView(arg, withSubviews), AddSubview); } }
public iOSFormsInspectView(Page container, Page page, bool withSubviews = true) { if (container == null) { throw new ArgumentNullException(nameof(container)); } if (page == null) { throw new ArgumentNullException(nameof(page)); } element = container; PopulateTypeInformationFromObject(container); var view = Platform.GetRenderer(container).NativeView; var layer = view.Layer; Transform = XIVR.GetViewTransform(layer); if (Transform != null) { X = layer.Bounds.X; Y = layer.Bounds.Y; Width = layer.Bounds.Width; Height = layer.Bounds.Height; } else { X = layer.Frame.X; Y = layer.Frame.Y; Width = layer.Frame.Width; Height = layer.Frame.Height; } Kind = ViewKind.Primary; Visibility = container.GetViewVisibility(); HandleContainerChildren( container, page, p => new iOSFormsInspectView(p, true, withSubviews), e => new iOSFormsInspectView(e, withSubviews), AddSubview ); }