黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Shared.Common;
using Shared.Phone.SmartSound.Forms;
using Shared.Phone.UserCenter.Device;
using Shared.Phone.UserCenter.SmartSound.Util;
using Shared.Phone.UserCenter.SmartSound.Widget;
@@ -30,6 +31,7 @@
        private RowLayoutControl oldShowRightMuneRow = null;
        private static string dataString = "";
        private MostRightIconControl btnAddDeviceIcon = null;
        #region ■ 初始化_____________________________
@@ -46,31 +48,48 @@
            base.SetTitleText("智能音箱");
            Dictionary<string, string> floorDictionary = Config.Instance.Home.FloorDics;//楼层列表
            var helpBtn = new MyButton();
            helpBtn.TextColor = UserCenterColor.Current.TextOrangeColor;
            helpBtn.Text = "帮助";
            helpBtn.Gravity = Gravity.CenterRight;
            helpBtn.TextAlignment = TextAlignment.CenterRight;
            topFrameLayout.AddChidren(helpBtn);
            helpBtn.X -= Application.GetRealWidth(58);
            //右上添加按钮
            if (btnAddDeviceIcon == null)
            {
                btnAddDeviceIcon = new MostRightIconControl(69, 69);
                btnAddDeviceIcon.UnSelectedImagePath = "Item/Add.png";
                topFrameLayout.AddChidren(btnAddDeviceIcon);
                btnAddDeviceIcon.InitControl();
                btnAddDeviceIcon.ButtonClickEvent += (sender, e) =>
                {
                    var helpForm = new AddSmartSound();
                    helpForm.AddForm();
                };
            }
            //var helpBtn = new MyButton();
            //helpBtn.TextColor = UserCenterColor.Current.TextOrangeColor;
            //helpBtn.Text = "帮助";
            //helpBtn.Gravity = Gravity.CenterRight;
            //helpBtn.TextAlignment = TextAlignment.CenterRight;
            //topFrameLayout.AddChidren(helpBtn);
            //helpBtn.X -= Application.GetRealWidth(58);
            //初始化中部控件
            this.InitMiddleFrame();
            helpBtn.MouseUpEventHandler += (sernder, e) =>
            {
                //生成一个弹窗画面
                var dialogForm = new TextDialog("绑定智能音箱到第三方 APP 进行操作", "跳转至小度APP");
                dialogForm.SetTitleText("帮助");
            //helpBtn.MouseUpEventHandler += (sernder, e) =>
            //{
            //    var helpForm = new AddSmartSound();
            //    helpForm.AddForm();
            //    /*
            //    //生成一个弹窗画面
            //    var dialogForm = new TextDialog("绑定智能音箱到第三方 APP 进行操作", "跳转至小度APP");
            //    dialogForm.SetTitleText("帮助");
                //按下确认按钮
                dialogForm.ComfirmClickEvent += () =>
                {
                    //画面关闭
                    dialogForm.CloseDialog();
                    OpenXiaoDuAPP();
                };
            };
            //    //按下确认按钮
            //    dialogForm.ComfirmClickEvent += () =>
            //    {
            //        //画面关闭
            //        dialogForm.CloseDialog();
            //        OpenXiaoDuAPP();
            //    };*/
            //};
        }
        /// <summary>
@@ -193,7 +212,7 @@
                        if (smartSound.Remark != null && smartSound.Remark.Trim() != "")
                            remark += "(" + smartSound.Remark + ")";
                        row.ImagePath = "SmartSound/Xiaodu.png";
                        row.ImagePath = "SmartSound/Sibici.png";
                        row.Remark = remark;
                    }
@@ -264,38 +283,54 @@
        }
        /// <summary>
        /// 思必驰
        /// </summary>
        private void OpenSBCAPP()
        {
            bool bol = false;
            try
            {
#if Android
                bol = HDLUtils.OpenAppWithPackageName("com.aispeech.companionapp");
#else
                bol=HDLUtils.OpenApp("AispeechMobile://");
#endif
                if (!bol)
                {
#if Android
                    HDLUtils.OpenUrl("market://details?id=com.aispeech.companionapp");
#else
                HDLUtils.OpenUrl("https://apps.apple.com/cn/app/id1460767442");
#endif
                }
            }
            catch (Exception e)
            {
                string error = e.Message;
                bol = false;
            }
        }
        /// <summary>
        /// 解除绑定弹窗
        /// </summary>
        private void ShowDelectDialog(SmartSoundInfo.SoundInfo smartSound)
        {
            //生成一个弹窗画面
            var dialogForm = new TextDialog("解除绑定需要到第三方 APP 进行操作", "跳转至小度APP");
            var dialogForm = new TextDialog("解除绑定需要到第三方 APP 进行操作", "跳转至第三方APP");
            dialogForm.SetTitleText("解除绑定");
            //按下确认按钮
            dialogForm.ComfirmClickEvent += () =>
            {
                OpenXiaoDuAPP();
                /*
                HdlThreadLogic.Current.RunThread(() =>
                {
                    this.ShowProgressBar("删除服务器记录...");
                    string json = DelectSmartSound(smartSound);
                    if (json == "SUCCESS")
                    {
                        smartSoundInfo.ResponseData.Data.Remove(smartSound);
                    }
                    this.CloseProgressBar();
                    HdlThreadLogic.Current.RunMainInThread(() =>
                    {
                        //画面关闭
                        dialogForm.CloseDialog();
                        OpenXiaoDuAPP();
                        iniView();
                    });
                });*/
                if (smartSound.PlatfromName == "Baidu")
                {
                    OpenXiaoDuAPP();
                }
                else if (smartSound.PlatfromName == "AISpeech") {
                    OpenSBCAPP();
                }
            };
        }
        /// <summary>
@@ -322,8 +357,20 @@
                string str = await setRemark(smartSound, remark); //上传备份
                if (str == "SUCCESS")
                {
                    smartSound.Remark = remark;
                    soundRowLayout.btnRemark.Text = "小度" + "(" + textValue + ")";
                    smartSound.Remark = remark;
                    if (smartSound.PlatfromName == "Baidu")
                    {
                        soundRowLayout.btnRemark.Text = "小度" + "(" + textValue + ")";
                    }
                    else if (smartSound.PlatfromName == "AISpeech")
                    {
                        soundRowLayout.btnRemark.Text = "思必驰" + "(" + textValue + ")";
                    }
                    else
                    {
                        soundRowLayout.btnRemark.Text =  textValue;
                    }
                }
                else
                {