예제 #1
0
        /// <summary>
        /// If the bindings for the page being loaded are not already cached, then
        ///
        /// 1) store the page we are on.
        /// 2) convert the xml UI into an element based object model representing the hierarchy and binding information of the UI.
        /// 3) parse the page being loaded by calling the parser and telling it to start.
        ///
        /// The parser will create the binding by calling the PageBindingFactory
        /// </summary>
        private void Load(MemoryStream page)
        {
            //1) get the node tree from the UI markup.
            var nodes = ViewTokenizer.Parser(page);

            //2) get the visitors to visit the node tree.
            _tokenWalker.Walk(nodes, _visitors);
        }
예제 #2
0
        public void SetContentView(int layoutResId, IViewModel viewModel)
        {
            var stream = EmbeddedResource.Instance.GetStream(this, layoutResId);

            var node = ViewTokenizer.Parser(stream);

            var pageBinding = new PageBindingFactory(this.LayoutInflater, node, viewModel);

            this.LayoutInflater.Factory = pageBinding;

            base.SetContentView(layoutResId);

            pageBinding.Bind();
        }