From dc6493db59dcb0893eac50b72122f94c24056b3f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 12 十月 2020 14:35:39 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs |  137 ++++++++++++++++++++++++++++++---------------
 1 files changed, 92 insertions(+), 45 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs
index 20d377d..0c08901 100755
--- a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs
+++ b/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 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴PP");
-                dialogForm.SetTitleText("甯姪");
+            //helpBtn.MouseUpEventHandler += (sernder, e) =>
+            //{
+            //    var helpForm = new AddSmartSound();
+            //    helpForm.AddForm();
+            //    /*
+            //    //鐢熸垚涓�涓脊绐楃敾闈�
+            //    var dialogForm = new TextDialog("缁戝畾鏅鸿兘闊崇鍒扮涓夋柟 APP 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴PP");
+            //    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>
         /// 瑙i櫎缁戝畾寮圭獥
         /// </summary>
         private void ShowDelectDialog(SmartSoundInfo.SoundInfo smartSound)
         {
             //鐢熸垚涓�涓脊绐楃敾闈�
-            var dialogForm = new TextDialog("瑙i櫎缁戝畾闇�瑕佸埌绗笁鏂� APP 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴PP");
+            var dialogForm = new TextDialog("瑙i櫎缁戝畾闇�瑕佸埌绗笁鏂� APP 杩涜鎿嶄綔", "璺宠浆鑷崇涓夋柟APP");
             dialogForm.SetTitleText("瑙i櫎缁戝畾");
 
             //鎸変笅纭鎸夐挳
             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
                 {

--
Gitblit v1.8.0