Esempio n. 1
0
        /// <summary>
        /// FIXME:
        /// reaload xml, recall the `DefineInitialData` method
        /// </summary>
        private void ResetLayout()
        {
            var schema   = DefineLayoutDocument();
            var initData = DefineInitialData();

            if (schema == null)
            {
                throw new System.Exception("DefineLayoutXml should return xml document string !");
            }
            shadowPlay.Build(schema);
            shadowPlay.ResetBridgeRootElement();
            shadowPlay.SetData(initData);
            shadowPlay.IsDataDirty = true;
        }
Esempio n. 2
0
 public void SetData(string key, object data)
 {
     if (shadowPlay != null)
     {
         shadowPlay.SetData(key, data);
     }
 }
Esempio n. 3
0
        static void Mainx(string[] args)
        {
            {
                ShadowPlay <LoveBridge.Element> userInterface = new ShadowPlay <LoveBridge.Element>();
                LoveBridge bridge = new LoveBridge();
                string     tmpXML = @"
<div flex-wrap=""wrap"" justify-content=""center"" flex-direction=""row"" el-bind:id="" 'root-id' "" >
    <div el-for=""item in list"" el-bind:id=""item"" width=""100px"" height=""100px"">
        my id is {{item}}
        <div el-for=""item in list"" el-bind:id=""item"" width=""100px"" height=""100px"">
            my id is {{item}}
        </div>
    </div>
</div>
";
                userInterface.Build(tmpXML);
                userInterface.SetBridge(bridge);
                userInterface.SetData("list", new List <string> {
                    "a3"
                });
                userInterface.Update();
                userInterface.Update();
                System.Console.WriteLine("--------------------------------");
                System.Console.WriteLine(userInterface.ToString());

                userInterface.SetData("list", new List <string> {
                });
                userInterface.Update();
                System.Console.WriteLine("--------------------------------");
                System.Console.WriteLine(userInterface.ToString());

                userInterface.SetData("list", new List <string> {
                    "a3"
                });
                userInterface.Update();
                System.Console.WriteLine("--------------------------------");
                System.Console.WriteLine(userInterface.ToString());


                System.Console.Read();
            }
        }
Esempio n. 4
0
        public virtual void Start()
        {
            shadowPlay = new ShadowPlay <LoveBridge.Element>();

            var schema = DefineLayoutXml();

            if (schema == null)
            {
                throw new System.Exception("DefineLayoutXml should return xml document string !");
            }

            var           initData   = DefineInitialData();
            List <string> properties = new List <string>();

            properties.AddRange(initData.Keys);
            shadowPlay.Build(schema);
            shadowPlay.SetData(initData);
            bridge = new LoveBridge();
            shadowPlay.SetBridge(bridge);
        }
Esempio n. 5
0
        public LayoutController() : base(nameof(LayoutController) + ".root.object")
        {
            shadowPlay = new ShadowPlay <Element>();

            var schema = DefineLayoutDocument();

            if (schema == null)
            {
                throw new System.Exception(nameof(DefineLayoutDocument) + " return an unexpected null!");
            }

            var initData = DefineInitialData();

            shadowPlay.Build(schema);
            shadowPlay.SetData(initData);
            bridge = new Bridge(shadowPlay, CreateElementCheck, SetRootParent);
            shadowPlay.SetBridge(bridge);

            //Update(); // not call virtual method in ..
        }
Esempio n. 6
0
        public override void Update(float dt)
        {
            Love.Misc.FPSGraph.Update(dt);

            Util.WatchTime(() =>
            {
                //if (((int)(Timer.GetTime() * 1000)) % 1000 > 500)
                //{
                //    userInterface.SetData("list", new List<string> { "1", "2", "3", "4", "5" });
                //}
                //else
                //{
                //    userInterface.SetData("list", new List<string> { "3", "4", "5" });
                //}

                //userInterface.SetData("list", new List<string> { "1", "2", "3", "4", "5" });


                for (int i = 0; i < 1; i++)
                {
                    var list = new List <string> {
                        "1", "2", "3", "4", "5", "6"
                    };
                    userInterface.SetData(new Dictionary <string, object>
                    {
                        { "styleObj", this },
                        { "w", "620px" },
                        { "mt", "5px 5px 2px 2px" },
                        { "pt", "15px" },
                        { "list", list },
                    });

                    //card.SetData("list", new List<object> { 2222 });
                    //card.ReRender();
                    userInterface.Update();
                }
            });
        }
Esempio n. 7
0
        public override void Load()
        {
            string tmpXML3 = @"
<div el-bind:padding-top=""pt""
    el-bind:width=""w""
    el-bind:height=""styleObj.StyleHeight""
    id=""root""
    flex-wrap=""wrap"" justify-content=""center"" flex-direction=""row"" >
    <div el-for=""item in list"" el-if=""item != '2' "" el-bind:margin=""mt"" el-bind:id=""item"" width=""100px"" height=""100px"">
        my id is {{item}}
        <div el-for=""item in list"" el-if=""item != '2' "" el-bind:margin=""mt"" el-bind:id=""item"" width=""50px"" height=""50px"">
            my id is {{item}}
        </div>
    </div>
</div>
";
            string tmpXML  = @"
<div el-bind:padding-top=""pt""  el-bind:width=""w""  el-bind:height=""styleObj.StyleHeight"" id=""root""
    flex-wrap=""wrap"" justify-content=""center"" flex-direction=""row"" >
    <div el-for=""item in list"" flex-wrap=""wrap"" el-if=""item != '2' "" el-bind:margin=""mt"" el-bind:id=""item"" width=""150px"" height=""150px"">
        my id is {{item}}
        <div el-for=""item in list"" flex-wrap=""wrap"" el-if=""item != '2' "" el-bind:id=""item"" width=""50px"" height=""50px"">
            my id is {{item}}
        </div>
    </div>
</div>
";

            userInterface.Build(tmpXML);
            userInterface.SetData(new Dictionary <string, object>()
            {
                { "styleObj", this },
                { "w", "620px" },
                { "mt", "5px" },
                { "pt", "15px" },
            });

            if (useFactory)
            {
                userInterface.SetBridge(fac);
            }

            userInterface.SetData("list", new List <string> {
                "a3"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());
            System.Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
            System.Console.WriteLine(fac.ToString());
            System.Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

            userInterface.SetData("list", new List <string> {
                "b3", "b5"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());

            userInterface.SetData("list", new List <string> {
                "c1", "c2", "c3"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());


            userInterface.SetData("list", new List <string> {
                "a3"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());

            userInterface.SetData("list", new List <string> {
                "c1", "c2", "c3"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());


            userInterface.SetData("list", new List <string> {
                "b3", "b5"
            });
            userInterface.Update();
            System.Console.WriteLine("--------------------------------");
            System.Console.WriteLine(userInterface.ToString());
        }