From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

---
 ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs |  281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs b/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs
new file mode 100755
index 0000000..795c206
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs
@@ -0,0 +1,281 @@
+锘縰sing System;
+using Newtonsoft.Json.Linq;
+using Shared.Common;
+using System.Collections.Generic;
+using Shared.Phone.Device.Logic;
+
+namespace Shared.Phone.Device.VideoIntercom
+{
+    public class VideoMachine : FrameLayout
+    {
+        public VideoMachine()
+        {
+        }
+        public void Show(List<VideoCalss> videoInfosLists)
+        {
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            view.toptitleNameBtn.TextID = R.MyInternationalizationString.videoIntercom;
+            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
+
+            var middle = new VerticalRefreshLayout
+            {
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
+            this.AddChidren(middle);
+
+            for (int i = 0; i < videoInfosLists.Count; i++)
+            {
+                var videoInfos = videoInfosLists[i];
+                var fLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(160),
+                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                };
+                middle.AddChidren(fLayout);
+                var iconBtn = new Button
+                {
+                    Width = Application.GetMinRealAverage(81),
+                    Height = Application.GetMinRealAverage(81),
+                    X = Application.GetRealWidth(58),
+                    Y = Application.GetRealHeight(55),
+                    UnSelectedImagePath = "Item/videoIntercom.png",
+                };
+                fLayout.AddChidren(iconBtn);
+                var nameBtn = new Button
+                {
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                    TextSize = 15,
+                    Y = Application.GetRealHeight(30),
+                    X = Application.GetRealWidth(176),
+                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetRealWidth(400),
+                    Text = videoInfos.DeviceName,
+                };
+                fLayout.AddChidren(nameBtn);
+
+                var name1Btn = new Button
+                {
+                    Text = videoInfos.RoomName,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                    TextSize = 12,
+                    Y = nameBtn.Bottom + Application.GetRealHeight(3),
+                    X = Application.GetRealWidth(176),
+                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetRealWidth(400),
+                };
+                fLayout.AddChidren(name1Btn);
+
+                var nextBtn = new Button
+                {
+                    Width = Application.GetMinRealAverage(104),
+                    Height = Application.GetMinRealAverage(104),
+                    UnSelectedImagePath = "Item/videoIntercomNext.png",
+                    X = Application.GetRealWidth(743 + 176),
+                    Y = Application.GetRealHeight(30),
+                };
+                fLayout.AddChidren(nextBtn);
+
+                var lineBtn = new Button
+                {
+                    Width = Application.GetRealWidth(845),
+                    Height = 1,
+                    Y = fLayout.Height - 1,
+                    X = Application.GetRealWidth(176),
+                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                };
+                fLayout.AddChidren(lineBtn);
+                var clickBtn = new Button
+                {
+                    Height = Application.GetRealHeight(160),
+                };
+                fLayout.AddChidren(clickBtn);
+
+                clickBtn.MouseUpEventHandler += (sen, e) =>
+                 {
+#if iOS
+                     GateWay.Ios.ESVideoInfo eSVideoInfo = new GateWay.Ios.ESVideoInfo();
+                     eSVideoInfo.DeviceName = videoInfos.DeviceName;
+                     eSVideoInfo.ESVideoUUID = videoInfos.ESVideoUUID;
+                     eSVideoInfo.ESRoomID = videoInfos.ESRoomID;
+                     eSVideoInfo.RoomName = videoInfos.RoomName;
+                     GateWay.Ios.ESVideo.ShowESVideoMonitor(eSVideoInfo);
+#elif Android
+                     ((BaseActivity)Application.Activity).AudioRecord((result) =>
+                     {
+                         if (result == false) { return; }
+                         Shared.Phone.VideoPhone.ESVideoInfo eSVideoInfo = new Shared.Phone.VideoPhone.ESVideoInfo();
+                         eSVideoInfo.DeviceName = videoInfos.DeviceName;
+                         eSVideoInfo.ESVideoUUID = videoInfos.ESVideoUUID;
+                         eSVideoInfo.ESRoomID = videoInfos.ESRoomID;
+                         eSVideoInfo.RoomName = videoInfos.RoomName;
+                         Shared.Phone.VideoPhone.ESVideo.ShowESVideoMonitor(eSVideoInfo);
+                     });
+#endif
+                 };
+
+            }
+
+        }
+        /// <summary>
+        /// 鍒ゆ柇璐﹀彿鏄惁鏀寔鍙瀵硅
+        /// </summary>
+        /// <param name="topFrameLayout">鍙瀵硅鍥炬爣鐨勭埗鎺т欢</param>
+        public async static void AccountSupportVideo(FrameLayout topFrameLayout)
+        {
+            var jobject = new JObject();
+            jobject.Add("RequestVersion", CommonPage.RequestVersion);
+            jobject.Add("RequestSource", "0");
+            jobject.Add("HomeID", Config.Instance.HomeId);
+            var url = "https://developer.hdlcontrol.com/ProposedProductionApi/VideoIntercom/CheckBindRecord";
+            var str = await Send.HttpWebRequest(url, jobject.ToString(), "POST", 3, true);
+            if (!string.IsNullOrEmpty(str))
+            {
+                try
+                {
+                    var json = JObject.Parse(str);
+                    if (json != null)
+                    {
+                        var stateCode = json["StateCode"].ToString();
+                        //鍙瀵硅蹇嵎鏂瑰紡
+                        var videoIntercomBtn = new Button();
+                        videoIntercomBtn.Gravity = Gravity.CenterVertical;
+                        videoIntercomBtn.UnSelectedImagePath = "Item/videoIntercom.png";
+                        videoIntercomBtn.Width = Application.GetMinRealAverage(69);
+                        videoIntercomBtn.Height = Application.GetMinRealAverage(69);
+                        List<VideoCalss> videoList= new List<VideoCalss>();
+                        if (stateCode == "Success")
+                        {//鍒ゆ柇杩欎釜璐﹀彿鏄惁缁戝畾;
+                            topFrameLayout.AddChidren(videoIntercomBtn);
+                            CloudsVideo cloudsVideo = Newtonsoft.Json.JsonConvert.DeserializeObject<CloudsVideo>(json["ResponseData"].ToString());
+                            videoList = await GetVideoInfoList(cloudsVideo);
+                        }
+                        if (UserCenter.UserCenterResourse.ResidenceOption.SafetyShortcut)
+                        {
+                            videoIntercomBtn.X = Application.GetRealWidth(746 + 10);
+                        }
+                        else
+                        {
+                            videoIntercomBtn.X = Application.GetRealWidth(850 + 10);
+                        }
+                        videoIntercomBtn.MouseUpEventHandler += (sender, e) =>
+                        {
+
+                            var videoMachine = new Device.VideoIntercom.VideoMachine();
+                            UserView.HomePage.Instance.AddChidren(videoMachine);
+                            UserView.HomePage.Instance.PageIndex += 1;
+                            videoMachine.Show(videoList);
+                            
+                        };
+                    }
+                }
+                catch { }
+            }
+        }
+        /// <summary>
+        /// 鑾峰彇鍙瀵硅鍒楄〃
+        /// </summary>
+        static async System.Threading.Tasks.Task<List<VideoCalss>> GetVideoInfoList(CloudsVideo clouds)
+        {
+            List<VideoCalss> eSVideoInfosList = new List<VideoCalss>();
+            var jobject = new JObject();
+            jobject.Add("cmtID", clouds.FLCommunityID);
+            jobject.Add("unitno", clouds.FLBuildingID);
+            jobject.Add("method", "getUUIDList");
+            var url = " http://112.74.164.111:180/api.php/Device/getmonitorUUID";
+            var str = await Send.HttpWebRequest(url, jobject.ToString(), "POST");
+            if (string.IsNullOrEmpty(str))
+            {
+                return eSVideoInfosList;
+            }
+            var json = JObject.Parse(str);
+            if (json == null)
+            {
+                return eSVideoInfosList;
+            }
+            if (json["resCode"].ToString() != "0")
+            {
+                return eSVideoInfosList;
+            }
+            var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(json["list"].ToString());
+            if (list.Count == 0)
+            {
+                return eSVideoInfosList;
+            }
+            foreach (var videoInfo in list)
+            {
+                VideoCalss eSVideoInfo = new VideoCalss();
+                eSVideoInfo.ESRoomID = int.Parse(clouds.FLRoomID);
+                string str1 = clouds.FLBuildingID.Substring(0, 2).TrimStart('0');
+                string str2 = clouds.FLBuildingID.Substring(2, 2).TrimStart('0');
+                eSVideoInfo.RoomName = str1 +Language.StringByID( R.MyInternationalizationString.dong) + str2 + Language.StringByID(R.MyInternationalizationString.unit);
+                eSVideoInfo.DeviceName = videoInfo["aliasName"];
+                if (videoInfo["uuid"].Contains(","))
+                {
+                    var uuid = videoInfo["uuid"].Split(',');
+                    eSVideoInfo.ESVideoUUID = uuid[0];
+                }
+                else
+                {
+                    eSVideoInfo.ESVideoUUID = videoInfo["uuid"];
+                }
+                eSVideoInfosList.Add(eSVideoInfo);
+            }
+            return eSVideoInfosList;
+        }
+    }
+    public class VideoCalss
+    {
+        /// <summary>
+        /// 瀹ゅ鏈虹殑UUID
+        /// 渚嬶細JJY000007FSEYX
+        /// </summary>
+        public string ESVideoUUID = string.Empty;
+        /// <summary>
+        /// 褰撳墠鐢ㄦ埛鐨勬埧闂碔D
+        /// 渚嬶細0801
+        /// </summary>
+        public int ESRoomID;
+        /// <summary>
+        /// 瀹ゅ鏈虹殑鍚嶇О
+        /// 渚嬶細瀹ゅ鏈�
+        /// </summary>
+        public string DeviceName = string.Empty;
+        /// <summary>
+        /// 鎴块棿鍛藉悕
+        /// 渚嬶細8鏍�1鍗曞厓0801
+        /// </summary>
+        public string RoomName = string.Empty;
+
+    }
+    public class CloudsVideo
+    {
+        /// <summary>
+        /// 鏍嬫ゼ鍗曞厓鍙�
+        /// </summary>
+        public string FLBuildingID = string.Empty;
+        /// <summary>
+        /// 閭f爧妤肩殑鍚嶇О
+        /// </summary>
+        public string FLBuildingName = string.Empty;
+        /// <summary>
+        /// 灏忓尯ID
+        /// </summary>
+        public string FLCommunityID = string.Empty;
+        /// <summary>
+        /// 鎴块棿ID
+        /// </summary>
+        public string FLRoomID = string.Empty;
+        /// <summary>
+        /// 浣忓畢ID
+        /// </summary>
+        public string HomeID = string.Empty;
+
+        public string FLSecretKey = string.Empty;
+
+    }
+}

--
Gitblit v1.8.0