public void XamlResourceIdAttributeGetTypeForPath()
        {
            tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath START");

            try
            {
                AssemblyImplent assembly = new AssemblyImplent();
                XamlResourceIdAttribute.GetTypeForPath(assembly, "myPath");
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath END (OK)");
                Assert.Pass("Caught Exception : passed!");
            }
        }
Exemple #2
0
        public void SetAndLoadSource(Uri value, string resourcePath, Assembly assembly, global::System.Xml.IXmlLineInfo lineInfo)
        {
            _source = value;

            //this will return a type if the RD as an x:Class element, and codebehind
            var type = XamlResourceIdAttribute.GetTypeForPath(assembly, resourcePath);

            if (type != null)
            {
                _mergedInstance = s_instances.GetValue(type, (key) => (ResourceDictionary)Activator.CreateInstance(key));
            }
            else
            {
                _mergedInstance = DependencyService.Get <IResourcesLoader>().CreateFromResource <ResourceDictionary>(resourcePath, assembly, lineInfo);
            }
            OnValuesChanged(_mergedInstance.ToArray());
        }
        public void XamlResourceIdAttributeGetTypeForPath2()
        {
            tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath2 START");

            try
            {
                var ret = XamlResourceIdAttribute.GetTypeForPath(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, $"XamlResourceIdAttributeGetTypeForPath2 END");
        }
        public void XamlResourceIdAttributeGetTypeForPath()
        {
            tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath START");

            try
            {
                var ret = XamlResourceIdAttribute.GetTypeForPath(typeof(UIElement).Assembly, "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, $"XamlResourceIdAttributeGetTypeForPath END");
        }
Exemple #5
0
        public void SetAndLoadSource(Uri value, string resourcePath, 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.GetTypeForPath(assembly, resourcePath);

            if (type != null)
            {
                mergedInstance = s_instances.GetValue(type, (key) => (ResourceDictionary)Activator.CreateInstance(key));
            }
            else
            {
                mergedInstance = DependencyService.Get <IResourcesLoader>()?.CreateFromResource <ResourceDictionary>(resourcePath, assembly, lineInfo);
            }
            OnValuesChanged(mergedInstance.ToArray());
        }