Exemplo n.º 1
0
        void JsonSync(TElement page)
        {
            if (!WebBrowser.IsBusy)
            {
                //Console.WriteLine("json sync {0}", this.GetHashCode());

                var commands = GetSyncCommands(page).ToArray();

                var jsSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                var json         = jsSerializer.Serialize(commands);
                if (IsTrace)
                {
                    //Console.WriteLine(page.ToString_Fair());
                    Console.WriteLine(JsonDataHlp.JsonObjectToString(jsSerializer.DeserializeObject(json)));
                }

                var res = WebBrowser.Document.InvokeScript("sync_page_from_json", new object[] { json });
                if (res != null)
                {
                    lastPage = page;
                }
            }
        }
Exemplo n.º 2
0
 public string ToText()
 {
     return(JsonDataHlp.JsonObjectToString(Data));
 }