CrabtreeOn,印度客户定制APP,迁移2.0平台版本
陈嘉乐
2021-02-01 0e9129254837bf36523d69e735527448f71d6337
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Shared.SimpleControl.Phone.Music;
using SmartHome;
namespace Shared.SimpleControl.Phone
{
@@ -139,6 +140,13 @@
            };
            msgView.AddChidren (btnMail2);
            btnMail2.MouseUpEventHandler += (e, e2) => {
#if DEBUG
                GetDeviceList ();
#endif
            };
            var btnFAQ = new Button () { 
                Height = Application.GetRealHeight(100),
                Y = msgView.Bottom + Application.GetRealHeight(20),
@@ -150,6 +158,15 @@
            };
            AddChidren (btnFAQ);
            btnFAQ.MouseUpEventHandler += (e,e2) =>{
#if DEBUG
                upload ();
#endif
            };
   
            var btnLine = new Button () { 
@@ -160,5 +177,65 @@
            AddChidren (btnLine);
        }
        /// <summary>
        ///
        /// </summary>
        void upload ()
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
                try {
                    var RES = HDLLinkUtlis.Current.UploadOidAndSidList ();
                    Application.RunOnMainThread (() => {
                        if (RES) {
                            Utlis.ShowTip ("上传成功");
                        } else {
                            Utlis.ShowTip ("上传失败");
                        }
                    });
                } catch {
                    MainPage.FailureToServer ();
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                    });
                }
            });
        }
        /// <summary>
        ///
        /// </summary>
        void GetDeviceList ()
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
                try {
                    var deviceResult = HttpServerRequest.Current.GetDeviceList ();
                    if (deviceResult.Code == StateCode.SUCCESS) {
                        var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieFunctionRes> (deviceResult.Data.ToString ());
                        Utlis.WriteLine ("deviceList Count" + deviceList.list.Count);
                    } else {
                        Utlis.ShowTip ("设备列表");
                    }
                    //Application.RunOnMainThread (() => {
                    //});
                } catch {
                    MainPage.FailureToServer ();
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                    });
                }
            });
        }
    }
}