lss
2020-06-01 df237b08cf97c27a2526b8f523f852f298a8b9b1
ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs
@@ -1,8 +1,13 @@
using System;
using System.Collections.Generic;
<<<<<<< HEAD
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
=======
using System.Diagnostics;
using System.Threading.Tasks;
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
using Shared.Common;
using Shared.Phone.UserCenter.Device;
using Shared.Phone.UserCenter.SmartSound.Util;
@@ -17,6 +22,10 @@
        {
        }
<<<<<<< HEAD
=======
        //private List<SmartSoundInfo> smartSoundList = null;
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
        private SmartSoundInfo smartSoundInfo = null;
        /// <summary>
@@ -40,9 +49,22 @@
        {
            // iniData();//先加载模拟数据
<<<<<<< HEAD
            this.ScrollEnabled = false;
            //设置标题信息
=======
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            // iniData();//先加载模拟数据
            this.ScrollEnabled = false;
            //设置标题信息
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
            base.SetTitleText("智能音箱");
            Dictionary<string, string> floorDictionary = Config.Instance.Home.FloorDics;//楼层列表
@@ -60,6 +82,7 @@
            this.InitMiddleFrame();
            helpBtn.MouseUpEventHandler += (sernder, e) =>
<<<<<<< HEAD
            {
                //这里是加载帮组的界面
            };                       
@@ -70,10 +93,25 @@
        /// </summary>
        /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param>
        public async void InitMiddleFrame()
=======
            {
                //这里是加载帮组的界面
            };
        }
        /// <summary>
        /// 初始化中部控件(外部可以调用)
        /// </summary>
        /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param>
        public async void InitMiddleFrame()
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
        {
            // show出没有设备的图标文字提示
            this.ShowNotDataImage(bodyFrameLayout, new string[] { "还没有音箱哦,", "绑定智能音箱请前往第三方 APP 进行操作" });
            var frame = new FrameLayout();
            this.bodyFrameLayout.AddChidren(frame);
            frame.BackgroundColor = UserCenterColor.Current.White;
@@ -81,6 +119,7 @@
            frame.Height = this.bodyFrameLayout.Height;
            // 初始化 lisetView
<<<<<<< HEAD
            listView = new VerticalListRefreshControl(29);
            listView.Y = 0;
            listView.Height = bodyFrameLayout.Height;
@@ -91,6 +130,18 @@
                {
                    await getData();
                    //下拉刷新
=======
            listView = new VerticalListRefreshControl(29);
            listView.Y = 0;
            listView.Height = bodyFrameLayout.Height;
            frame.AddChidren(listView);
            listView.BeginHeaderRefreshingAction += () =>
            {
                HdlThreadLogic.Current.RunThread(async () =>
                {
                    await getData();
                    //下拉刷新
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
                    iniView();
                    HdlThreadLogic.Current.RunMain(() =>
@@ -106,6 +157,7 @@
            await getData();
<<<<<<< HEAD
            this.CloseProgressBar(ShowReLoadMode.NO);
            iniView();
@@ -115,12 +167,19 @@
        /// 获取音箱列表
        /// </summary>
        /// <returns></returns>
=======
            this.CloseProgressBar( ShowReLoadMode.YES);
            iniView();
        }
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
        private async Task getData()
        {
            SmartSoundInfo.Auth auth = new SmartSoundInfo.Auth();
            auth.HomeID = Common.Config.Instance.Home.Id;
            auth.UserID = Common.Config.Instance.Guid;
            auth.Platform = "";
<<<<<<< HEAD
            string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/Auth?Platform&PageSetting.PageSize=100&PageSetting.PageIndex=1&UserID={0}&HomeID={1}",
                Common.Config.Instance.Guid,Common.Config.Instance.Home.Id);
            byte[] byteData = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(auth));
@@ -176,6 +235,29 @@
                listView.AddChidren(row);
                if (smartSound.Platform == "Baidu")
=======
            dataString = await UserCenterLogic.GetResponseDataByRequestHttps("zigbeespeakerservice/Auth", true, auth);
            smartSoundInfo = (SmartSoundInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(dataString);
        }
        private void iniView()
        {
            //
            listView.RemoveAll();
            if (smartSoundInfo==null)
                return;
            for (int i = 0; i < smartSoundInfo.ResponseData.Data.Count; i++)
            {
                //
                var smartSound = smartSoundInfo.ResponseData.Data[i];
                var row = new SoundRowLayout();
                listView.AddChidren(row);
                if (smartSound.Platform == "Xiaodu")
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
                {
                    row.Account = "小度:" + smartSound.UserName;
                    row.ImagePath = "SmartSound/Xiaodu.png";
@@ -190,7 +272,11 @@
                row.btnRename.ButtonClickEvent += (sender, e) =>
                {
                    //
<<<<<<< HEAD
                    int index = (int)(((NormalViewControl)sender).GetTagByKey("index"));
=======
                    int index = (int)(((NormalViewControl)sender).GetTagByKey("index"));
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
                    var smartSound = smartSoundInfo.ResponseData.Data[index];
                    ShowRenameDialog(row, smartSound);
@@ -240,6 +326,7 @@
            //请输入备份名称
            dialogForm.SetTipText(smartSound.Remark);
<<<<<<< HEAD
            //按下确认按钮
            dialogForm.ComfirmClickEvent += (async (textValue) =>
            {
@@ -261,6 +348,33 @@
                }
            });
        }
=======
        /// <summary>
        /// 重命名弹窗
        /// </summary>
        /// <returns></returns>
        private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSoundInfo.SoundInfo smartSound)
        {
            //生成一个弹窗画面
            var dialogForm = new DialogInputControl();
            //添加备份
            dialogForm.SetTitleText("重命名");
            //请输入备份名称
            dialogForm.SetTipText(smartSound.Remark);
            //按下确认按钮
            dialogForm.ComfirmClickEvent += ((textValue) =>
            {
                //画面关闭
                dialogForm.CloseDialog();
                //上传备份
                smartSound.Remark = textValue;
                soundRowLayout.btnRemark.Text= textValue;
            });
        }
>>>>>>> b5b3f2bf5b04de190acea40790537b9e96649188
        #endregion