示例#1
0
 public void RecycleCell(object data, DataTemplate dataTemplate, VisualElement parent)
 {
     if (_viewCell == null)
     {
         _viewCell = (dataTemplate.CreateContent() as FastGridCell);
         _viewCell.BindingContext = data;
         _viewCell.Parent         = parent;
         _viewCell.PrepareCell(new Size(Bounds.Width, Bounds.Height));
         _originalBindingContext = _viewCell.BindingContext;
         var renderer = RendererFactory.GetRenderer(_viewCell.View);
         _view = renderer.NativeView;
         _view.AutoresizingMask = UIViewAutoresizing.All;
         _view.ContentMode      = UIViewContentMode.ScaleToFill;
         ContentView.AddSubview(_view);
         return;
     }
     else if (data == _originalBindingContext)
     {
         _viewCell.BindingContext = _originalBindingContext;
     }
     else
     {
         _viewCell.BindingContext = data;
     }
 }
        public void CreateClassRenderer_XmlSummary_NewInstanceIsCreated()
        {
            var factory = new RendererFactory(ReportType.XmlSummary);

            var renderer = factory.CreateClassRenderer();

            Assert.IsNull(renderer, "Null expected.");
        }
        public void CreateClassRenderer_LatexSummary_SingletonIsReturned()
        {
            var factory = new RendererFactory(ReportType.LatexSummary);

            var renderer = factory.CreateClassRenderer();

            Assert.IsNull(renderer, "Null expected.");
        }
示例#4
0
        private void InitializeRendererFactory()
        {
            var factory = new RendererFactory(this);

            factory.RegisterFactory("layout", new LayoutRenderer(this));
            factory.RegisterFactory("content", new ContentRenderer(this));

            DependencyResolver.Register(typeof(IRendererFactory), () => factory);
        }
        public void CreateSummaryRenderer_HtmlSummary_NewInstanceIsCreated()
        {
            var factory = new RendererFactory(ReportType.HtmlSummary);

            var renderer1 = factory.CreateSummaryRenderer();
            var renderer2 = factory.CreateSummaryRenderer();

            Assert.AreNotSame(renderer1, renderer2, "New instance expected.");
            Assert.IsInstanceOfType(renderer1, typeof(HtmlRenderer), "Wrong type returned.");
        }
        public void CreateClassRenderer_Latex_SingletonIsReturned()
        {
            var factory = new RendererFactory(ReportType.Latex);

            var renderer1 = factory.CreateClassRenderer();
            var renderer2 = factory.CreateClassRenderer();

            Assert.AreSame(renderer1, renderer2, "Singleton instance expected.");
            Assert.IsInstanceOfType(renderer1, typeof(LatexRenderer), "Wrong type returned.");
        }
示例#7
0
        protected T GetInitializedElement <T> (View view)
            where T : class, IVisualElementRenderer
        {
            var renderer = RendererFactory.GetRenderer(view) as T;
            var parent   = new UIView();

            parent.AddSubview(renderer.NativeView);

            return(renderer);
        }
示例#8
0
        public void InputWithoutAnythingSpecialReturnsBasicInputElement()
        {
            string block = "input";
            var nodes = Parse(block);

            IRendererFactory factory = new RendererFactory();

            factory.RegisterFactory("input", new InputRenderer());
            var renderer = factory.GetRenderer(nodes.Children.First().BlockName);

            var result = renderer.Render(nodes.Children.First(), null);

            Assert.AreEqual("<input />", result);
        }
示例#9
0
        public void InputWithAttributsReturnsElementWithAttributes()
        {
            string block = "input[attr=\"value\"]";

            var nodes = Parse(block);

            IRendererFactory factory = new RendererFactory();

            factory.RegisterFactory("input", new InputRenderer());
            var renderer = factory.GetRenderer(nodes.Children.First().BlockName);

            var result = renderer.Render(nodes.Children.First(), null);

            Assert.AreEqual("<input attr=\"value\" />", result);
        }
示例#10
0
        //https://github.com/visionmedia/jade/blob/master/test/jade.test.js
        public IRendererFactory GetFactory()
        {
            RendererFactory factory = new RendererFactory();

            factory.RegisterFactory(new[] { "base", "basefont", "frame", "link", "meta", "area", "br", "col", "hr", "img", "param" }, new SelfClosingRenderer());
            factory.RegisterFactory("doctype", new DocTypeRenderer());
            factory.RegisterFactory("rawoutput", new RawOutputRenderer());
            factory.RegisterFactory("output", new OutputRenderer());
            factory.RegisterFactory("input", new InputRenderer());
            factory.RegisterFactory("string", new StringLiteralRenderer());
            factory.RegisterFactory("foreach", new ForeachRenderer());

            //default renderer
            factory.RegisterFactory("*", new HtmlRenderer());

            return factory;
        }
        public void SupportsParallelClassReports_Xml_TrueIsReturned()
        {
            var factory = new RendererFactory(ReportType.Xml);
            Assert.IsTrue(factory.SupportsParallelClassReports, "True was expected.");

            factory = new RendererFactory(ReportType.XmlSummary);
            Assert.IsTrue(factory.SupportsParallelClassReports, "True was expected.");
        }
 public void SupportsParallelClassReports_Latex_FalseIsReturned()
 {
     var factory = new RendererFactory(ReportType.Latex);
     Assert.IsFalse(factory.SupportsParallelClassReports, "False was expected.");
 }
 static HtmlRendererFactory()
 {
     HtmlRendererFactory.Factory = new RendererFactory(new HtmlRendererFactory());
 }
 static TxtRendererFactory()
 {
     TxtRendererFactory.Factory = new RendererFactory(new TxtRendererFactory());
 }
示例#15
0
        static ParrotViewEngine()
        {
            RendererFactory factory = new RendererFactory();

            factory.RegisterFactory(new[] { "base", "basefont", "frame", "link", "meta", "area", "br", "col", "hr", "img", "param" }, new SelfClosingRenderer());
            factory.RegisterFactory("doctype", new DocTypeRenderer());
            factory.RegisterFactory("rawoutput", new RawOutputRenderer());
            factory.RegisterFactory("output", new OutputRenderer());
            factory.RegisterFactory("input", new InputRenderer());
            factory.RegisterFactory("string", new StringLiteralRenderer());
            factory.RegisterFactory("layout", new LayoutRenderer());
            factory.RegisterFactory("content", new ContentRenderer());

            //default renderer
            factory.RegisterFactory("*", new HtmlRenderer());

            Infrastructure.Host.DependencyResolver.Register(typeof(IRendererFactory), () => factory);

            Factory = factory;
        }