public void XRIDIsGeneratedForRDWithoutCodeBehind() { var asm = typeof(ResourceDictionaryWithSource).Assembly; var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(asm, "AppResources/Colors.xaml"); Assert.That(resourceId, Is.Not.Null); var type = XamlResourceIdAttribute.GetTypeForResourceId(asm, resourceId); Assert.That(type, Is.Null); }
public void CodeBehindIsGeneratedForRDWithXamlComp() { var asm = typeof(ResourceDictionaryWithSource).Assembly; var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(asm, "AppResources/CompiledColors.xaml"); Assert.That(resourceId, Is.Not.Null); var type = XamlResourceIdAttribute.GetTypeForResourceId(asm, resourceId); Assert.That(type, Is.Not.Null); var rd = Activator.CreateInstance(type); Assert.That(rd as ResourceDictionary, Is.Not.Null); }
public void XamlResourceIdAttributeGetTypeForResourceId() { tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId START"); try { AssemblyImplent assembly = new AssemblyImplent(); XamlResourceIdAttribute.GetTypeForResourceId(assembly, "myResourceId"); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId END (OK)"); Assert.Pass("Caught Exception : passed!"); } }
public void XamlResourceIdAttributeGetTypeForResourceId2() { tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId2 START"); try { var ret = XamlResourceIdAttribute.GetTypeForResourceId(typeof(UIElement).Assembly, "none.xaml"); Assert.IsNull(ret, "Should be null"); } catch (Exception e) { Tizen.Log.Error(tag, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId2 END"); }
public void XamlResourceIdAttributeGetTypeForResourceId() { tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId START"); try { var ret = XamlResourceIdAttribute.GetTypeForResourceId(typeof(UIElement).Assembly, "Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.ClockView.xaml"); Assert.IsNotNull(ret, "Shouldn't be null"); } catch (Exception e) { Tizen.Log.Error(tag, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId END"); }
public void SetAndLoadSource(Uri value, string resourceID, Assembly assembly, System.Xml.IXmlLineInfo lineInfo) { _source = value; if (_mergedWith != null) { throw new ArgumentException("Source can not be used with MergedWith"); } //this will return a type if the RD as an x:Class element, and codebehind var type = XamlResourceIdAttribute.GetTypeForResourceId(assembly, resourceID); if (type != null) { _mergedInstance = s_instances.GetValue(type, (key) => (ResourceDictionary)Activator.CreateInstance(key)); } else { _mergedInstance = DependencyService.Get <IResourcesLoader>().CreateResourceDictionary(resourceID, assembly, lineInfo); } OnValuesChanged(_mergedInstance.ToArray()); }