Context.Body.Variables.Add(vardef);
Context.IL.Append(PushValueFromLanguagePrimitive(typedef, node));
- Context.IL.Emit(OpCodes.Stloc, vardef);
+ Context.IL.Emit(Stloc, vardef);
return;
}
Context.Body.Variables.Add(vardef);
Context.IL.Append(il);
- Context.IL.Emit(OpCodes.Stloc, vardef);
+ Context.IL.Emit(Stloc, vardef);
//clean the node as it has been fully exhausted
foreach (var prop in node.Properties)
if (!node.SkipProperties.Contains(prop.Key))
node.SkipProperties.Add(prop.Key);
node.CollectionItems.Clear();
+
+ Context.IL.Append(RegisterSourceInfo(Context, node));
return;
}
if (!node.SkipProperties.Contains(prop.Key))
node.SkipProperties.Add(prop.Key);
node.CollectionItems.Clear();
+ Context.IL.Append(RegisterSourceInfo(Context, node));
return;
}
+ Context.IL.Append(RegisterSourceInfo(Context, node));
}
}
Context.Body.Variables.Add(vardef);
Context.IL.Emit(OpCodes.Ldarg_0);
Context.IL.Emit(OpCodes.Stloc, vardef);
+ Context.IL.Append(RegisterSourceInfo(Context, node));
}
public void Visit(ListNode node, INode parentNode)
break;
}
}
+
+ internal static IEnumerable<Instruction> RegisterSourceInfo(ILContext context, INode valueNode)
+ {
+ if (!context.DefineDebug)
+ yield break;
+ if (!(valueNode is IXmlLineInfo lineInfo))
+ yield break;
+ if (!(valueNode is IElementNode elementNode))
+ yield break;
+ if (context.Variables[elementNode].VariableType.IsValueType)
+ yield break;
+
+ var module = context.Body.Method.Module;
+
+ yield return Create(Ldloc, context.Variables[elementNode]); //target
+
+ yield return Create(Ldstr, context.XamlFilePath);
+ yield return Create(Ldstr, ";assembly=");
+ yield return Create(Ldstr, context.Module.Assembly.Name.Name);
+ yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "String"),
+ methodName: "Concat",
+ parameterTypes: new[] {
+ ("mscorlib", "System", "String"),
+ ("mscorlib", "System", "String"),
+ ("mscorlib", "System", "String"),
+ },
+ isStatic: true));
+
+
+ yield return Create(Ldc_I4, (int)UriKind.RelativeOrAbsolute);
+ yield return Create(Newobj, module.ImportCtorReference(("System", "System", "Uri"),
+ parameterTypes: new[] {
+ ("mscorlib", "System", "String"),
+ ("System", "System", "UriKind"),
+ })); //uri
+
+ yield return Create(Ldc_I4, lineInfo.LineNumber); //lineNumber
+ yield return Create(Ldc_I4, lineInfo.LinePosition); //linePosition
+
+ yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml.Diagnostics", "VisualDiagnostics"),
+ methodName: "RegisterSourceInfo",
+ parameterTypes: new[] {
+ ("mscorlib", "System", "Object"),
+ ("System", "System", "Uri"),
+ ("mscorlib", "System", "Int32"),
+ ("mscorlib", "System", "Int32")},
+ isStatic: true));
+ }
}
}
\ No newline at end of file
//If it's a BP, SetValue ()
if (CanSetValue(bpRef, attached, valueNode, iXmlLineInfo, context))
- return SetValue(parent, bpRef, valueNode, iXmlLineInfo, context).Concat(RegisterSourceInfo(context, valueNode));
+ return SetValue(parent, bpRef, valueNode, iXmlLineInfo, context);
//If it's a property, set it
if (CanSet(parent, localName, valueNode, context))
- return Set(parent, localName, valueNode, iXmlLineInfo, context).Concat(RegisterSourceInfo(context, valueNode));
+ return Set(parent, localName, valueNode, iXmlLineInfo, context);
//If it's an already initialized property, add to it
if (CanAdd(parent, propertyName, valueNode, iXmlLineInfo, context))
- return Add(parent, propertyName, valueNode, iXmlLineInfo, context).Concat(RegisterSourceInfo(context, valueNode));
+ return Add(parent, propertyName, valueNode, iXmlLineInfo, context);
throw new XamlParseException($"No property, bindable property, or event found for '{localName}', or mismatching type between value and property.", iXmlLineInfo);
}
- internal static IEnumerable<Instruction> RegisterSourceInfo(ILContext context, INode valueNode)
- {
- if (!context.DefineDebug)
- yield break;
- if (!(valueNode is IXmlLineInfo lineInfo))
- yield break;
- if (!(valueNode is IElementNode elementNode))
- yield break;
- if (context.Variables[elementNode].VariableType.IsValueType)
- yield break;
-
- var module = context.Body.Method.Module;
-
- yield return Create(Ldloc, context.Variables[elementNode]); //target
-
- yield return Create(Ldstr, context.XamlFilePath);
- yield return Create(Ldstr, ";assembly=");
- yield return Create(Ldstr, context.Module.Assembly.Name.Name);
- yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "String"),
- methodName: "Concat",
- parameterTypes: new[] {
- ("mscorlib", "System", "String"),
- ("mscorlib", "System", "String"),
- ("mscorlib", "System", "String"),
- },
- isStatic: true));
-
-
- yield return Create(Ldc_I4, (int)UriKind.RelativeOrAbsolute);
- yield return Create(Newobj, module.ImportCtorReference(("System", "System", "Uri"),
- parameterTypes: new[] {
- ("mscorlib", "System", "String"),
- ("System", "System", "UriKind"),
- })); //uri
-
- yield return Create(Ldc_I4, lineInfo.LineNumber); //lineNumber
- yield return Create(Ldc_I4, lineInfo.LinePosition); //linePosition
-
- yield return Create(Call, module.ImportMethodReference(("XSF", "Xamarin.Forms.Xaml.Diagnostics", "VisualDiagnostics"),
- methodName: "RegisterSourceInfo",
- parameterTypes: new[] {
- ("mscorlib", "System", "Object"),
- ("System", "System", "Uri"),
- ("mscorlib", "System", "Int32"),
- ("mscorlib", "System", "Int32")},
- isStatic: true));
- }
public static IEnumerable<Instruction> GetPropertyValue(VariableDefinition parent, XmlName propertyName, ILContext context, IXmlLineInfo lineInfo, out TypeReference propertyType)
{
rootnode.Accept(new SetResourcesVisitor(visitorContext), null);
rootnode.Accept(new SetPropertiesVisitor(visitorContext, true), null);
- il.Append(SetPropertiesVisitor.RegisterSourceInfo(visitorContext, rootnode));
-
il.Emit(Ret);
initComp.Body = body;
exception = null;
* limitations under the License.
*/
+using System;
+using ElmSharp.Wearable;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using Xamarin.Forms.Platform.Tizen.Native.Watch;
using XPageRenderer = Xamarin.Forms.Platform.Tizen.PageRenderer;
using CPageRenderer = Tizen.Wearable.CircularUI.Forms.Renderer.PageRenderer;
+using EColor = ElmSharp.Color;
+using NPage = Xamarin.Forms.Platform.Tizen.Native.Page;
+using NLayoutEventArgs = Xamarin.Forms.Platform.Tizen.Native.LayoutEventArgs;
+using XForms = Xamarin.Forms.Forms;
+using System.Collections.Specialized;
[assembly: ExportRenderer(typeof(Page), typeof(CPageRenderer))]
namespace Tizen.Wearable.CircularUI.Forms.Renderer
{
- public class PageRenderer : XPageRenderer
+ // TODO: need to change the implementation to inhert the PageRenderer later
+ public class PageRenderer : VisualElementRenderer<Page>
{
- protected override FormsMoreOptionItem CreateMoreOptionItem(ToolbarItem item)
+ NPage _page;
+ Lazy<MoreOption> _moreOption;
+
+ public PageRenderer()
+ {
+ RegisterPropertyHandler(Page.BackgroundImageSourceProperty, UpdateBackgroundImage);
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
+ {
+ if (null == _page)
+ {
+ _page = new NPage(XForms.NativeParent);
+ _page.LayoutUpdated += OnLayoutUpdated;
+ SetNativeView(_page);
+ }
+ base.OnElementChanged(e);
+ }
+
+ protected override void OnElementReady()
+ {
+ _moreOption = new Lazy<MoreOption>(CreateMoreOption);
+ if (Element.ToolbarItems is INotifyCollectionChanged items)
+ {
+ items.CollectionChanged += OnToolbarCollectionChanged;
+ }
+ if (Element.ToolbarItems.Count > 0)
+ {
+ UpdateToolbarItems(true);
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
{
- var moreOptionItem = base.CreateMoreOptionItem(item);
+ if (_page != null)
+ {
+ _page.LayoutUpdated -= OnLayoutUpdated;
+ }
+
+ if (Element.ToolbarItems is INotifyCollectionChanged items)
+ {
+ items.CollectionChanged -= OnToolbarCollectionChanged;
+ }
+
+ if (_moreOption.IsValueCreated)
+ {
+ _moreOption.Value.Clicked -= OnMoreOptionItemClicked;
+ _moreOption.Value.Closed -= SendMoreOptionClosed;
+ _moreOption.Value.Opened -= SendMoreOptionOpened;
+ _moreOption.Value.Items.Clear();
+ _moreOption.Value.Unrealize();
+ }
+ }
+ base.Dispose(disposing);
+ }
+
+ protected override void UpdateBackgroundColor(bool initialize)
+ {
+ if (initialize && Element.BackgroundColor.IsDefault)
+ return;
+
+ // base.UpdateBackgroundColor() is not called on purpose, we don't want the regular background setting
+ if (Element.BackgroundColor.IsDefault || Element.BackgroundColor.A == 0)
+ _page.Color = EColor.Transparent;
+ else
+ _page.Color = Element.BackgroundColor.ToNative();
+ }
+
+ protected override void UpdateLayout()
+ {
+ // empty on purpose
+ }
+
+ protected virtual FormsMoreOptionItem CreateMoreOptionItem(ToolbarItem item)
+ {
+ var moreOptionItem = new FormsMoreOptionItem
+ {
+ MainText = item.Text,
+ ToolbarItem = item
+ };
+ var icon = item.IconImageSource as FileImageSource;
+ if (icon != null)
+ {
+ var img = new ElmSharp.Image(_moreOption.Value);
+ img.Load(ResourcePath.GetPath(icon));
+ moreOptionItem.Icon = img;
+ }
if (item is CircleToolbarItem circleToolbarItem)
{
moreOptionItem.SubText = circleToolbarItem.SubText;
}
return moreOptionItem;
}
+
+ protected virtual void OnMoreOptionClosed()
+ {
+ }
+
+ protected virtual void OnMoreOptionOpened()
+ {
+ }
+
+ void UpdateBackgroundImage(bool initialize)
+ {
+ if (initialize && Element.BackgroundImageSource.IsNullOrEmpty())
+ return;
+
+ // TODO: investigate if we can use the other image source types: stream, font, uri
+
+ var bgImage = Element.BackgroundImageSource as FileImageSource;
+ if (bgImage.IsNullOrEmpty())
+ _page.File = null;
+ else
+ _page.File = ResourcePath.GetPath(bgImage);
+ }
+
+ void OnLayoutUpdated(object sender, NLayoutEventArgs e)
+ {
+ Element.Layout(e.Geometry.ToDP());
+
+ if (_moreOption != null && _moreOption.IsValueCreated)
+ {
+ _moreOption.Value.Geometry = _page.Geometry;
+ }
+ }
+
+ MoreOption CreateMoreOption()
+ {
+ var moreOption = new MoreOption(_page);
+ moreOption.Geometry = _page.Geometry;
+ _page.Children.Add(moreOption);
+ moreOption.Show();
+ moreOption.Clicked += OnMoreOptionItemClicked;
+ moreOption.Closed += SendMoreOptionClosed;
+ moreOption.Opened += SendMoreOptionOpened;
+ return moreOption;
+ }
+
+ void SendMoreOptionClosed(object sender, EventArgs e)
+ {
+ OnMoreOptionClosed();
+ }
+
+ void SendMoreOptionOpened(object sender, EventArgs e)
+ {
+ OnMoreOptionOpened();
+ }
+
+ void OnToolbarCollectionChanged(object sender, EventArgs eventArgs)
+ {
+ UpdateToolbarItems(false);
+ }
+
+ void UpdateToolbarItems(bool initialize)
+ {
+ //clear existing more option items and add toolbar item again on purpose.
+ if (!initialize && _moreOption.Value.Items.Count > 0)
+ {
+ _moreOption.Value.Items.Clear();
+ }
+
+ if (Element.ToolbarItems.Count > 0)
+ {
+ _moreOption.Value.Show();
+ foreach (var item in Element.ToolbarItems)
+ {
+ _moreOption.Value.Items.Add(CreateMoreOptionItem(item));
+ }
+ }
+ else
+ {
+ _moreOption.Value.Hide();
+ }
+ }
+
+ void OnMoreOptionItemClicked(object sender, MoreOptionItemEventArgs e)
+ {
+ var formsMoreOptionItem = e.Item as FormsMoreOptionItem;
+ if (formsMoreOptionItem != null)
+ {
+ ((IMenuItemController)formsMoreOptionItem.ToolbarItem)?.Activate();
+ }
+ _moreOption.Value.IsOpened = false;
+ }
}
}
\ No newline at end of file
readonly string profile;
+ static int ScreenWidth;
+
+ static int ScreenHeight;
+
+
public override Size PixelScreenSize
{
get
}
}
- public TizenDeviceInfo() : this(getScreenWidth(), getScreenHeight())
+ public TizenDeviceInfo()
{
- }
-
- static int getScreenWidth()
- {
- if (TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out int width))
- {
- return width;
- }
- else
- {
- throw new InvalidOperationException("Can not get screen.Width");
- }
- }
- static int getScreenHeight()
- {
- if (TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out int height))
- {
- return height;
- }
- else
- {
- throw new InvalidOperationException("Can not get screen.Height");
- }
- }
- TizenDeviceInfo(int width, int height)
- {
- pixelScreenSize = new Size(width, height);
+ int width = GetScreenWidth();
+ int height = GetScreenHeight();
scalingFactor = 1.0; // scaling is disabled, we're using pixels as Xamarin's geometry units
if (s_useDeviceIndependentPixel)
scalingFactor = s_dpi.Value / 160.0;
}
+ pixelScreenSize = new Size(width, height);
scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor);
profile = s_profile.Value;
}
- public TizenDeviceInfo RefreshByDIP()
+ internal static int GetScreenWidth(bool systemCall = false)
{
- return new TizenDeviceInfo((int)pixelScreenSize.Width, (int)pixelScreenSize.Height);
+ int width = 0;
+ if (systemCall)
+ {
+ TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out width);
+ ScreenWidth = width;
+ }
+ return ScreenWidth;
+ }
+
+ internal static int GetScreenHeight(bool systemCall = false)
+ {
+ int height = 0;
+ if (systemCall)
+ {
+ TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out height);
+ ScreenHeight = height;
+ }
+ return ScreenHeight;
}
}
public static void Init(InitializationOptions options)
{
+ s_useDeviceIndependentPixel = options?.UseDeviceIndependentPixel ?? false;
SetupInit(options.Context, options);
}
+ static void PreloadInit()
+ {
+ Internals.Log.Listeners.Add(new XamarinLogListener());
+ if (System.Threading.SynchronizationContext.Current == null)
+ {
+ TizenSynchronizationContext.Initialize();
+ }
+
+ Elementary.Initialize();
+ Elementary.ThemeOverlay();
+ Utility.AppendGlobalFontPath(@"/usr/share/fonts");
+
+ Device.PlatformServices = new TizenPlatformServices();
+ if (Device.info != null)
+ {
+ ((TizenDeviceInfo)Device.info).Dispose();
+ Device.info = null;
+ }
+
+ TizenDeviceInfo.GetScreenWidth(true);
+ TizenDeviceInfo.GetScreenHeight(true);
+
+ StaticRegistrar.RegisterHandlers(CircularUIForms.StaticHandlers);
+ CircularUIForms.RegisterDependencyService();
+ TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(Assembly.GetAssembly(typeof(Xamarin.Forms.View)));
+ Registrar.RegisterAll(new Type[]
+ {
+ typeof(ExportRendererAttribute),
+ typeof(ExportImageSourceHandlerAttribute),
+ typeof(ExportCellAttribute),
+ typeof(ExportHandlerAttribute),
+ typeof(ExportFontAttribute)
+ });
+ }
+
static void SetupInit(CoreApplication application, InitializationOptions options = null)
{
Context = application;
if (!IsInitialized)
{
- Internals.Log.Listeners.Add(new XamarinLogListener());
- if (System.Threading.SynchronizationContext.Current == null)
+ if (!IsPreloaded)
{
- TizenSynchronizationContext.Initialize();
- }
+ Internals.Log.Listeners.Add(new XamarinLogListener());
+ if (System.Threading.SynchronizationContext.Current == null)
+ {
+ TizenSynchronizationContext.Initialize();
+ }
- Elementary.Initialize();
- Elementary.ThemeOverlay();
- Utility.AppendGlobalFontPath(@"/usr/share/fonts");
+ Elementary.Initialize();
+ Elementary.ThemeOverlay();
+ Utility.AppendGlobalFontPath(@"/usr/share/fonts");
- Device.PlatformServices = new TizenPlatformServices();
- if (Device.info != null)
- {
- ((TizenDeviceInfo)Device.info).Dispose();
- Device.info = null;
+ Device.PlatformServices = new TizenPlatformServices();
+ if (Device.info != null)
+ {
+ ((TizenDeviceInfo)Device.info).Dispose();
+ Device.info = null;
+ }
}
-
Device.Info = new Forms.TizenDeviceInfo();
Device.SetFlags(s_flags);
}
- else if (Device.info != null)
- {
- var info = ((TizenDeviceInfo)Device.info).RefreshByDIP();
- ((TizenDeviceInfo)Device.info).Dispose();
- Device.info = info;
- }
string profile = ((TizenDeviceInfo)Device.Info).Profile;
if (profile == "mobile")
Device.SetIdiom(TargetIdiom.Unsupported);
}
- if (!Forms.IsInitialized && !Forms.IsPreloaded)
+ if (!Forms.IsPreloaded)
{
StaticRegistrar.RegisterHandlers(CircularUIForms.StaticHandlers);
CircularUIForms.RegisterDependencyService();
TizenPlatformServices.AppDomain.CurrentDomain.AddAssembly(Assembly.GetAssembly(typeof(Xamarin.Forms.View)));
}
- if (!Forms.IsInitialized || Forms.IsPreloaded)
+ if (!Forms.IsInitialized)
{
if (options != null)
{
- s_useDeviceIndependentPixel = options.UseDeviceIndependentPixel;
s_platformType = options.PlatformType;
s_useMessagingCenter = options.UseMessagingCenter;
OptionalFeatureValues.UseStyle = options.UseStyle;
public static EvasObject Preload()
{
var dummyApp = new DummyFormsApplication();
- Init(dummyApp, false);
+ PreloadInit();
IsPreloaded = true;
var locale = TSystemSetting.LocaleLanguage;
{
(Control as IButton)?.UpdateStyle(style);
((IVisualElementController)Element).NativeSizeChanged();
+ UpdateBackgroundColor(false);
}
}
MoreOption CreateMoreOption()
{
var moreOption = new MoreOption(_page);
+ moreOption.Geometry = _page.Geometry;
_page.Children.Add(moreOption);
moreOption.Show();
moreOption.Clicked += OnMoreOptionItemClicked;
void OnToolbarCollectionChanged(object sender, EventArgs eventArgs)
{
- if (Element.ToolbarItems.Count > 0 || _moreOption.IsValueCreated)
- {
UpdateToolbarItems(false);
}
- }
void UpdateToolbarItems(bool initialize)
{
_moreOption.Value.Items.Clear();
}
+ if (Element.ToolbarItems.Count > 0)
+ {
+ _moreOption.Value.Show();
foreach (var item in Element.ToolbarItems)
{
_moreOption.Value.Items.Add(CreateMoreOptionItem(item));
}
}
+ else
+ {
+ _moreOption.Value.Hide();
+ }
+ }
void OnMoreOptionItemClicked(object sender, MoreOptionItemEventArgs e)
{
{
var themeStyle = SpecificVE.GetStyle(Element);
if (!string.IsNullOrEmpty(themeStyle))
+ {
Control.Style = themeStyle;
+ UpdateBackgroundColor(false);
+ UpdateProgressColor(false);
+ }
}
void UpdateAll()
break;
}
((IVisualElementController)Element).NativeSizeChanged();
+ UpdateBackgroundColor(false);
+ UpdateOnColor(false);
+ UpdateColor();
}
protected virtual void UpdateColor()
{
_toolbar.Style = style;
((IVisualElementController)Element).NativeSizeChanged();
+ UpdateBackgroundColor(false);
+ UpdateBarBackgroundColor(false);
+ UpdateSelectedTabColor(false);
+ UpdateUnselectedTabColor(false);
}
}
if (xpe == null && TrySetBinding(xamlelement, property, localName, value, lineInfo, out xpe))
return;
- var assemblyName = (context.RootAssembly ?? rootElement.GetType().GetTypeInfo().Assembly)?.GetName().Name;
//If it's a BindableProberty, SetValue
- if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
- VisualDiagnostics.RegisterSourceInfo(value, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
+ if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe))
return;
- }
//If we can assign that value to a normal property, let's do it
- if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, context, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
- VisualDiagnostics.RegisterSourceInfo(value, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
+ if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, context, out xpe))
return;
- }
//If it's an already initialized property, add to it
- if (xpe == null && TryAddToProperty(xamlelement, propertyName, value, xKey, lineInfo, serviceProvider, context, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
- VisualDiagnostics.RegisterSourceInfo(value, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
+ if (xpe == null && TryAddToProperty(xamlelement, propertyName, value, xKey, lineInfo, serviceProvider, context, out xpe))
return;
- }
xpe = xpe ?? new XamlParseException($"Cannot assign property \"{localName}\": Property does not exist, or is not assignable, or mismatching type between value and property", lineInfo);
if (context.ExceptionHandler != null)
name = name.Substring(name.LastIndexOf(':') + 1);
XamlLoader.ValueCreatedCallback(new XamlLoader.CallbackTypeInfo { XmlNamespace = node.XmlType.NamespaceUri, XmlTypeName = name }, value);
}
+
+ var assemblyName = (Context.RootAssembly ?? Context.RootElement?.GetType().GetTypeInfo().Assembly)?.GetName().Name;
+ if (assemblyName != null && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(Context.RootElement) is string path)
+ Diagnostics.VisualDiagnostics.RegisterSourceInfo(value, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
+
}
public void Visit(RootNode node, INode parentNode)
else
NameScope.SetNameScope(bindable, node.NameScopeRef?.NameScope);
}
+
+ var assemblyName = (Context.RootAssembly ?? Context.RootElement.GetType().GetTypeInfo().Assembly)?.GetName().Name;
+ if (rnode.Root != null && !rnode.Root.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(Context.RootElement) is string path)
+ Diagnostics.VisualDiagnostics.RegisterSourceInfo(rnode.Root, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
}
public void Visit(ListNode node, INode parentNode)
}
var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), view, (IXmlNamespaceResolver)reader) { LineNumber = ((IXmlLineInfo)reader).LineNumber, LinePosition = ((IXmlLineInfo)reader).LinePosition };
- if (XamlFilePathAttribute.GetFilePathForObject(view) is string path) {
- VisualDiagnostics.RegisterSourceInfo(view, new Uri($"{path};assembly={view.GetType().GetTypeInfo().Assembly.GetName().Name}", UriKind.Relative), ((IXmlLineInfo)rootnode).LineNumber, ((IXmlLineInfo)rootnode).LinePosition);
- VisualDiagnostics.SendVisualTreeChanged(null, view);
- }
XamlParser.ParseXaml(rootnode, reader);
#pragma warning disable 0618
var doNotThrow = ResourceLoader.ExceptionHandler2 != null || Internals.XamlLoader.DoNotThrowOnExceptions;
RootAssembly = rootAssembly ?? view.GetType().GetTypeInfo().Assembly,
ExceptionHandler = doNotThrow ? ehandler : (Action<Exception>)null
}, useDesignProperties);
+
+ VisualDiagnostics.SendVisualTreeChanged(null, view);
+
break;
}
}
var cvv = new CreateValuesVisitor(visitorContext);
cvv.Visit((ElementNode)rootnode, null);
inflatedView = rootnode.Root = visitorContext.Values[rootnode];
- if (XamlFilePathAttribute.GetFilePathForObject(inflatedView) is string path)
- {
- VisualDiagnostics.RegisterSourceInfo(inflatedView, new Uri($"{path};assembly={inflatedView.GetType().GetTypeInfo().Assembly.GetName().Name}", UriKind.Relative), ((IXmlLineInfo)rootnode).LineNumber, ((IXmlLineInfo)rootnode).LinePosition);
- VisualDiagnostics.SendVisualTreeChanged(null, inflatedView);
- }
visitorContext.RootElement = inflatedView as BindableObject;
Visit(rootnode, visitorContext, useDesignProperties);
+ VisualDiagnostics.SendVisualTreeChanged(null, inflatedView);
break;
}
}