From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs |  190 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 129 insertions(+), 61 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundListForm.cs
index 5b1441d..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,30 +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 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴�");
-                dialogForm.SetTitleText("甯姪");
+            //helpBtn.MouseUpEventHandler += (sernder, e) =>
+            //{
+            //    var helpForm = new AddSmartSound();
+            //    helpForm.AddForm();
+            //    /*
+            //    //鐢熸垚涓�涓脊绐楃敾闈�
+            //    var dialogForm = new TextDialog("缁戝畾鏅鸿兘闊崇鍒扮涓夋柟 APP 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴PP");
+            //    dialogForm.SetTitleText("甯姪");
 
-                //鎸変笅纭鎸夐挳
-                dialogForm.ComfirmClickEvent += () =>
-                {
-                    //鐢婚潰鍏抽棴
-                    dialogForm.CloseDialog();
-                };
-            };
+            //    //鎸変笅纭鎸夐挳
+            //    dialogForm.ComfirmClickEvent += () =>
+            //    {
+            //        //鐢婚潰鍏抽棴
+            //        dialogForm.CloseDialog();
+            //        OpenXiaoDuAPP();
+            //    };*/
+            //};
         }
 
         /// <summary>
@@ -122,8 +142,8 @@
                     this.CloseProgressBar();
                 });                
             });           
-        }
-       
+        }
+       
         /// <summary>
         /// 鑾峰彇闊崇鍒楄〃
         /// </summary>
@@ -186,6 +206,14 @@
 
                         row.ImagePath = "SmartSound/Xiaodu.png";
                         row.Remark = remark;
+                    }else if (smartSound.PlatfromName == "AISpeech")
+                    {
+                        string remark = "鎬濆繀椹�";
+                        if (smartSound.Remark != null && smartSound.Remark.Trim() != "")
+                            remark += "(" + smartSound.Remark + ")";
+
+                        row.ImagePath = "SmartSound/Sibici.png";
+                        row.Remark = remark;
                     }
 
                     row.InitControl();
@@ -227,53 +255,82 @@
             }
         }
 
+        private void OpenXiaoDuAPP()
+        {
+            bool bol = false;
+            try
+            {
+#if Android
+                bol = HDLUtils.OpenAppWithPackageName("com.baidu.duer.superapp");
+#else                
+                bol=HDLUtils.OpenApp("xiaoduapp://");
+#endif
+
+                if (!bol)
+                {
+#if Android
+                    HDLUtils.OpenUrl("market://details?id=com.baidu.duer.superapp");
+#else
+                HDLUtils.OpenUrl("https://apps.apple.com/cn/app/%E5%B0%8F%E5%BA%A6/id1437733193");
+#endif
+                }
+            }
+            catch (Exception e)
+            {
+                string error = e.Message;
+                bol = false;
+            }
+        }
+
+        /// <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 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴�");
+            var dialogForm = new TextDialog("瑙i櫎缁戝畾闇�瑕佸埌绗笁鏂� APP 杩涜鎿嶄綔", "璺宠浆鑷崇涓夋柟APP");
             dialogForm.SetTitleText("瑙i櫎缁戝畾");
 
             //鎸変笅纭鎸夐挳
             dialogForm.ComfirmClickEvent += () =>
-            {
-                HdlThreadLogic.Current.RunThread(() =>
-                {
-                    this.ShowProgressBar("鍒犻櫎鏈嶅姟鍣ㄨ褰�...");
-                    string json = DelectSmartSound(smartSound);
-                    if (json == "SUCCESS")
-                    {
-                        smartSoundInfo.ResponseData.Data.Remove(smartSound);
-                    }
-                    this.CloseProgressBar();
-
-                    HdlThreadLogic.Current.RunMainInThread(() =>
-                    {
-                        //鐢婚潰鍏抽棴
-                        dialogForm.CloseDialog();
-                        bool bol = false;
-                        try
-                        {
-#if Android
-                            bol = HDLUtils.OpenAppWithPackageName("com.baidu.duer.superapp");
-#else
-                            HDLUtils.OpenApp("xiaoduapp://");
-#endif
-                        }
-                        catch (Exception e)
-                        {
-                            string error = e.Message;
-                            bol = false;
-                        }
-                        if (!bol)
-                        {
-                            this.ShowMassage(ShowMsgType.Tip, "鎵撳紑APP澶辫触");
-                        }
-                        iniView();
-                    });
-                });
+            {
+                if (smartSound.PlatfromName == "Baidu")
+                {
+                    OpenXiaoDuAPP();
+                }
+                else if (smartSound.PlatfromName == "AISpeech") {
+                    OpenSBCAPP();
+                }                
             };
         }
         /// <summary>
@@ -293,7 +350,6 @@
             //鎸変笅纭鎸夐挳
             dialogForm.ComfirmClickEvent += (async (textValue) =>
             {
-
                 //鐢婚潰鍏抽棴
                 dialogForm.CloseDialog();
 
@@ -301,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