From 8ccc71771efec9434ad3b4a45c5f2ec11326d40f Mon Sep 17 00:00:00 2001
From: lss <lsc@hdlchina.com.cn>
Date: 星期五, 23 四月 2021 10:25:24 +0800
Subject: [PATCH] 2021-04-23 添加乐橙可视对讲

---
 HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs |  115 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 71 insertions(+), 44 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
index 3271e9e..f5ca90f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
@@ -4,6 +4,7 @@
 using Shared;
 using HDL_ON.Stan;
 using ZXing.QrCode.Internal;
+using static HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod;
 
 namespace HDL_ON.UI.UI2.FuntionControlView.Video
 {
@@ -12,10 +13,9 @@
         /// <summary>
         /// 鍔犺浇鍙瀵硅UI
         /// </summary>
-        /// <param name="listVideo">闂ㄥ彛鏈哄垪琛�</param>
         /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param>
-        /// <param name="video">褰撳墠鐨勫彲瑙嗗璁�</param>
-        public void Show(List<FlVideo> listVideo, List<CallView> listCall, VideoClouds video)
+        /// <param name="videoList">鍙瀵硅鍒楄〃</param>
+        public void Show(List<CallView> listCall, List<Video> videoList)
         {
             #region 甯冨眬鐣岄潰
             this.BackgroundColor = MusicColor.ViewColor;
@@ -35,8 +35,8 @@
             pageView.AddChidren(view1);
             var view2 = new FrameLayout();
             pageView.AddChidren(view2);
-            View1(view1, listVideo, video);
-            View2(view2, listCall, video);
+            View1(view1, videoList);
+            View2(view2, listCall, videoList);
             Button btn11 = new Button
             {
                 X = Application.GetRealWidth(170),
@@ -107,13 +107,13 @@
             };
             #endregion
         }
+
         /// <summary>
         /// 绗竴涓晫闈�
         /// </summary>
         /// <param name="view1">鐖舵帶浠�</param>
-        /// <param name="list">闂ㄥ彛鏈哄垪琛�</param>
-        /// <param name="videoClouds">褰撳墠鐨勫彲瑙嗗璁�</param>
-        void View1(FrameLayout view1, List<FlVideo> list, VideoClouds videoClouds)
+        /// <param name="video">鍙瀵硅瀵硅薄</param>
+        void View1(FrameLayout view1, List<Video> videoList)
         {
             #region 甯冨眬鐣岄潰
             var bjFl = new FrameLayout
@@ -188,23 +188,25 @@
                 Width = Application.GetRealWidth(327),
             };
             bjFl.AddChidren(vv);
-            if (list.Count > 0)
+
+            bool bol = haveFlVideo(videoList);
+            if (bol)
             {
                 //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�,铏氭嫙涓�涓嚭鏉�
-                list.Add(new FlVideo { aliasName = Language.StringByID(StringId.menjinerweima), devType = "100" });
+                videoList.Add(new Video { deviceName = Language.StringByID(StringId.menjinerweima), interphoneType = "100" });
             }
             //鏁扮粍涓暟
             //int value = 15;
             //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱
             int l = 0;
-            if (list.Count % 3 == 0)
+            if (videoList.Count % 3 == 0)
             {
-                l = list.Count / 3;
+                l = videoList.Count / 3;
             }
             else
             {
 
-                l = (list.Count / 3) + 1;
+                l = (videoList.Count / 3) + 1;
             }
             var fL = new FrameLayout
             {
@@ -214,9 +216,9 @@
             vv.AddChidren(fL);
             int line = 0;
             #endregion
-            for (int i = 1, j = 0; i <= list.Count; i++, j++)
+            for (int i = 1, j = 0; i <= videoList.Count; i++, j++)
             {
-                var video = list[i - 1];
+                var video = videoList[i - 1];
                 #region
                 var fLayout = new FrameLayout
                 {
@@ -245,7 +247,7 @@
                     TextSize = TextSize.Text10,
                     TextColor = CSS.CSS_Color.TextualColor,
                     TextAlignment = TextAlignment.Center,
-                    Text = video.aliasName,
+                    Text = video.deviceName,
                 };
                 fLayout.AddChidren(deviceNameBtn);
 
@@ -263,11 +265,11 @@
                 //闂ㄥ彛鏈虹殑鐐瑰嚮浜嬩欢
                 clickBtn.MouseUpEventHandler += (sender, e) =>
                 {
-                    var flVideo = clickBtn.Tag as FlVideo;
-                    if (flVideo.devType == "100")
+                    var video = clickBtn.Tag as Video;
+                    if (video.devType == "100")
                     {
                         //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�
-                        VideoSend.GetQRcode(this, videoClouds, (tag, paw) =>
+                        VideoSend.GetQRcode(this, video, (tag, paw) =>
                         {
                             if (tag)
                             {
@@ -279,36 +281,44 @@
                     }
                     else
                     {
-                        if (string.IsNullOrEmpty(flVideo.uuid))
+
+                        if (string.IsNullOrEmpty(video.deviceId))
                         {
                             new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.peizhicanshuyouyichang));
                             return;
                         }
+
+                        //Unitno = Intent.GetStringExtra("unitno");
+                        //HomeID = Intent.GetStringExtra("HomeID");
+
+
                         ESVideoInfo eSVideoInfo = new ESVideoInfo
                         {
-                            ESVideoUUID = getUuid(flVideo.uuid),
-                            DeviceName = flVideo.aliasName,
-                            roomno = videoClouds.flRoomId,
-                            unitno = videoClouds.flBuildingId,
+                            ESVideoUUID = getUuid(video.deviceId),
+                            DeviceName = video.deviceName,
+                            roomno = video.flRoomBindVO.flRoomId,
+                            unitno = video.flRoomBindVO.flBuildingId,
+                            uuid= getUuid(video.deviceId),
+                            cmtID=video.flRoomBindVO.flCmtId,
+                            Lc_AccessToken = video.subAccountToken,
+                            Lc_DeviceId = video.deviceId,
+                            Lc_Psk = video.deviceName,
+                            Lc_PlayToken = video.playToken,
                         };
-                        ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo);
+                        ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo, video.interphoneType);
                     }
-
-
                 };
             }
-
-
         }
+
         /// <summary>
         /// 绗簩涓晫闈�
         /// </summary>
         /// <param name="view2">鐖舵帶浠�</param>
         /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param>
-        /// <param name="video">褰撳墠鐨勫彲瑙嗗璁�</param>
-        void View2(FrameLayout view2, List<CallView> listCall, VideoClouds video)
+        /// <param name="videoList">鍙瀵硅鍒楄〃</param>
+        void View2(FrameLayout view2, List<CallView> listCall, List<Video> videoList)
         {
-
             var bjFl = new FrameLayout
             {
                 Y = Application.GetRealHeight(24),
@@ -347,20 +357,20 @@
                 TextAlignment = TextAlignment.CenterLeft,
                 TextID = StringId.baolu30,
             };
-            //bjFl.AddChidren(regionBtn);
+            bjFl.AddChidren(regionBtn);
 
             var vv = new VerticalRefreshLayout
             {
                 X = Application.GetRealWidth(16),
-                Y = Application.GetRealHeight(58),
-                Height = Application.GetRealHeight(458),
+                Y = Application.GetRealHeight(58 + 17),
+                Height = Application.GetRealHeight(458 - 17),
                 Width = Application.GetRealWidth(295),
             };
             bjFl.AddChidren(vv);
             vv.BeginHeaderRefreshingAction += () =>
             {
                 VideoMethod videoMethod = new VideoMethod();
-                var list = videoMethod.GetCall(video.id);
+                var list = videoMethod.GetCall();
                 RefreshView(vv, list);
                 //鍏抽棴鍒锋柊View锛�
                 vv.EndHeaderRefreshing();
@@ -368,6 +378,7 @@
             RefreshView(vv, listCall);
 
         }
+
         /// <summary>
         /// 閫氳瘽璁板綍鍒锋柊鐣岄潰
         /// </summary>
@@ -393,6 +404,7 @@
                     frameLayout60.btnTime.Text = getTime(call.callTime);
                     ///鍛煎彨鐘舵�侊紙0锛氭湭鎺ワ紱1锛氬凡鎺ワ紱2锛氭嫆鎺ワ級锛涙槸鍚﹀紑閿侊紱
                     frameLayout60.btnStateText.Text = getStateText(call.callStatus) + "," + getUnlockText(call.isUnlock);
+
                 }
 
             }
@@ -404,11 +416,11 @@
         /// </summary>
         /// <param name="flVideo"></param>
         /// <param name="iconBtn">鍥炬爣</param>
-        private void getIconAndText(FlVideo flVideo, Button iconBtn)
+        private void getIconAndText(Video Video, Button iconBtn)
         {
             //(1瀹ゅ唴鏈�,2瀹ゅ鏈猴紝3鍥村鏈猴紝4绠$悊鏈�,5浜屾纭鏈�)
             string iconstr = "";
-            switch (flVideo.devType)
+            switch (Video.devType)
             {
                 case "1":
                     {
@@ -459,10 +471,7 @@
         {
             var utcTime = Convert.ToDateTime(str);
             var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
-            // var monday = dateTime.ToString("MM") + Language.StringByID(StringId.month) + dateTime.ToString("dd") + Language.StringByID(StringId.day);
-            var monday = dateTime.ToString("MM") + "/" + dateTime.ToString("dd");
-            var time = dateTime.ToString("HH") + ":" + dateTime.ToString("mm");
-            return monday + " " + time;
+            return dateTime.ToString("HH") + ":" + dateTime.ToString("mm");
         }
         /// <summary>
         /// 鑾峰彇鍛煎彨鐘舵�佹枃鏈�
@@ -499,14 +508,16 @@
         /// <returns></returns>
         private string getUnlockText(bool if_bool)
         {
+            string s = "";
             if (if_bool)
             {
-                return Language.StringByID(StringId.yikaisuo);
+                s = Language.StringByID(StringId.yikaisuo);
             }
             else
             {
-                return Language.StringByID(StringId.weikaisuo);
+                s = Language.StringByID(StringId.weikaisuo);
             }
+            return s;
         }
         /// <summary>
         /// 鑾峰彇uuid
@@ -526,6 +537,22 @@
             }
         }
 
+
+        //鍒ゆ柇鏄惁鏈� 涓版灄鍙瀵硅
+        private bool haveFlVideo(List<Video> videoList)
+        {
+            bool bol = false;
+
+            for (int i = 0; i < videoList.Count; i++)
+            {
+                var _video = videoList[i];
+                if (_video.interphoneType == "FLVI")
+                    return true;
+            }
+
+            return bol;
+        }
+
     }
 
 }

--
Gitblit v1.8.0