From 813aee559e544e6bf7777404612a4712cad184c8 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 01 四月 2021 16:31:38 +0800
Subject: [PATCH] 2021-04-01 1.更新丰林iOS最新SDK

---
 HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs |  256 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 227 insertions(+), 29 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
index c3752e2..329407c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
@@ -2,18 +2,27 @@
 using HDL_ON.UI.Music;
 using System.Collections.Generic;
 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
 {
     public class MainView : FrameLayout
     {
-        public void Show(List<ESVideoInfo> listVideo, List<CallView> listCall)
+        /// <summary>
+        /// 鍔犺浇鍙瀵硅UI
+        /// </summary>
+        /// <param name="listVideo">闂ㄥ彛鏈哄垪琛�</param>
+        /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param>
+        /// <param name="video">褰撳墠鐨勫彲瑙嗗璁�</param>
+        public void Show(List<VideoMethod.FlVideo> listVideo, List<CallView> listCall, VideoClouds video)
         {
+            #region 甯冨眬鐣岄潰
             this.BackgroundColor = MusicColor.ViewColor;
             var topView = new TopView();
             this.AddChidren(topView.TopFLayoutView());
-            topView.topNameBtn.Text = "鍙瀵硅";
+            topView.topNameBtn.TextID = StringId.keshiduijiang;
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
                 RemoveFromParent();
@@ -30,8 +39,8 @@
             pageView.AddChidren(view1);
             var view2 = new FrameLayout();
             pageView.AddChidren(view2);
-            View1(view1, listVideo);
-            View2(view2, listCall);
+            View1(view1, listVideo, video);
+            View2(view2, listCall, video);
             Button btn11 = new Button
             {
                 X = Application.GetRealWidth(170),
@@ -80,22 +89,25 @@
 
                 if (pageView.PageIndex == 0)
                 {
-                    topView.topNameBtn.Text = "鍙瀵硅";
+                    topView.topNameBtn.TextID = StringId.keshiduijiang;
                 }
                 else
                 {
-                    topView.topNameBtn.Text = "閫氳瘽璁板綍";
+                    topView.topNameBtn.TextID = StringId.tonghuajilu;
 
                 }
             };
+            #endregion
         }
         /// <summary>
         /// 绗竴涓晫闈�
         /// </summary>
         /// <param name="view1">鐖舵帶浠�</param>
-        void View1(FrameLayout view1, List<ESVideoInfo> list)
+        /// <param name="list">闂ㄥ彛鏈哄垪琛�</param>
+        /// <param name="videoClouds">褰撳墠鐨勫彲瑙嗗璁�</param>
+        void View1(FrameLayout view1, List<VideoMethod.FlVideo> list, VideoClouds videoClouds)
         {
-
+            #region 甯冨眬鐣岄潰
             var bjFl = new FrameLayout
             {
                 Y = Application.GetRealHeight(24),
@@ -117,7 +129,8 @@
                 TextColor = MusicColor.MusicTxet14Color,
                 TextSize = TextSize.Text24,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = "鍙瀵硅",
+                //Text = "鍙瀵硅",
+                TextID = StringId.keshiduijiang,
             };
             bjFl.AddChidren(nameBtn);
             /// <summary>
@@ -134,7 +147,7 @@
                 TextAlignment = TextAlignment.CenterLeft,
                 Text = "123456"
             };
-            bjFl.AddChidren(regionBtn);
+            // bjFl.AddChidren(regionBtn);
             /// <summary>
             ///鏀惰棌鍥炬爣
             /// </summary>
@@ -147,8 +160,8 @@
                 UnSelectedImagePath = "MusicIcon/collect.png",
                 SelectedImagePath = "MusicIcon/collectSelected.png",
             };
-            bjFl.AddChidren(collectIconBtn);
-
+            // bjFl.AddChidren(collectIconBtn);
+            ///鍙瀵硅鍥炬爣
             Button intercomBtnIcon = new Button
             {
                 X = Application.GetRealWidth(84),
@@ -167,6 +180,11 @@
                 Width = Application.GetRealWidth(327),
             };
             bjFl.AddChidren(vv);
+            if (list.Count > 0)
+            {
+                //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�,铏氭嫙涓�涓嚭鏉�
+                list.Add(new VideoMethod.FlVideo { aliasName = Language.StringByID(StringId.menjinerweima), devType = "100" });
+            }
             //鏁扮粍涓暟
             //int value = 15;
             //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱
@@ -187,10 +205,11 @@
             };
             vv.AddChidren(fL);
             int line = 0;
+            #endregion
             for (int i = 1, j = 0; i <= list.Count; i++, j++)
             {
                 var video = list[i - 1];
-
+                #region
                 var fLayout = new FrameLayout
                 {
                     Width = Application.GetRealWidth(50),
@@ -210,7 +229,7 @@
                 };
                 fLayout.AddChidren(iconBtn);
 
-                var iconNameBtn = new Button
+                var deviceNameBtn = new Button
                 {
                     Y = iconBtn.Bottom + Application.GetRealHeight(6),
                     Width = Application.GetRealWidth(50),
@@ -218,9 +237,9 @@
                     TextSize = TextSize.Text10,
                     TextColor = CSS.CSS_Color.TextualColor,
                     TextAlignment = TextAlignment.Center,
-                    Text = video.DeviceName,
+                    Text = video.aliasName,
                 };
-                fLayout.AddChidren(iconNameBtn);
+                fLayout.AddChidren(deviceNameBtn);
 
                 var clickBtn = new Button { Tag = video };
 
@@ -231,11 +250,41 @@
                     j = -1;
                     line += 1;
                 }
-                // GetIconAndText(i, deviceIconBtn, iconNameBtn);
+                getIconAndText(video, iconBtn);
+                #endregion
+                //闂ㄥ彛鏈虹殑鐐瑰嚮浜嬩欢
                 clickBtn.MouseUpEventHandler += (sender, e) =>
                 {
-                    var eSVideoInfo = clickBtn.Tag as ESVideoInfo;
-                    ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo);
+                    var flVideo = clickBtn.Tag as FlVideo;
+                    if (flVideo.devType == "100")
+                    {
+                        //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�
+                        VideoSend.GetQRcode(this, videoClouds, (tag, paw) =>
+                        {
+                            if (tag)
+                            {
+                                //娉ㄦ剰锛氬瘑鐮佹湁鍙兘寤舵椂1鍒嗛挓鐢熸晥
+                                View.ShowDialog showDialog = new View.ShowDialog();
+                                showDialog.QRcode(paw);
+                            }
+                        });
+                    }
+                    else
+                    {
+                        if (string.IsNullOrEmpty(flVideo.uuid))
+                        {
+                            new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.peizhicanshuyouyichang));
+                        }
+                        ESVideoInfo eSVideoInfo = new ESVideoInfo
+                        {
+                            ESVideoUUID = getUuid(flVideo.uuid),
+                            DeviceName = flVideo.aliasName,
+                            roomno = videoClouds.flRoomId,
+                            unitno = videoClouds.flBuildingId,
+                        };
+                        ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo);
+                    }
+
 
                 };
             }
@@ -246,7 +295,9 @@
         /// 绗簩涓晫闈�
         /// </summary>
         /// <param name="view2">鐖舵帶浠�</param>
-        void View2(FrameLayout view2, List<CallView> listCall)
+        /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param>
+        /// <param name="video">褰撳墠鐨勫彲瑙嗗璁�</param>
+        void View2(FrameLayout view2, List<CallView> listCall, VideoClouds video)
         {
 
             var bjFl = new FrameLayout
@@ -270,7 +321,7 @@
                 TextColor = MusicColor.MusicTxet14Color,
                 TextSize = TextSize.Text24,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = "閫氳瘽璁板綍",
+                TextID = StringId.tonghuajilu,
             };
             bjFl.AddChidren(nameBtn);
             /// <summary>
@@ -285,11 +336,11 @@
                 TextColor = MusicColor.SelectedColor,
                 TextSize = TextSize.Text12,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = "*浜戠鐓х墖鍙繚鐣�30澶�"
+                TextID = StringId.baolu30,
             };
             bjFl.AddChidren(regionBtn);
 
-            var vv = new VerticalScrolViewLayout
+            var vv = new VerticalRefreshLayout
             {
                 X = Application.GetRealWidth(16),
                 Y = Application.GetRealHeight(58),
@@ -297,28 +348,175 @@
                 Width = Application.GetRealWidth(295),
             };
             bjFl.AddChidren(vv);
+            vv.BeginHeaderRefreshingAction += () =>
+            {
+                VideoMethod videoMethod = new VideoMethod();
+                var list = videoMethod.GetCall(video.id);
+                RefreshView(vv, list);
+                //鍏抽棴鍒锋柊View锛�
+                vv.EndHeaderRefreshing();
+            };
+            RefreshView(vv, listCall);
+
+        }
+        /// <summary>
+        /// 閫氳瘽璁板綍鍒锋柊鐣岄潰
+        /// </summary>
+        /// <param name="vv">涓婁笅婊戝姩鎺т欢</param>
+        /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param>
+        public void RefreshView(VerticalRefreshLayout vv, List<CallView> listCall)
+        {
+            vv.RemoveAll();
             for (int i = 0; i < listCall.Count; i++)
             {
                 var year = listCall[i];
+                //骞存枃鏈埗鎺т欢
                 View.FrameLayout50 frameLayout50 = new View.FrameLayout50();
                 vv.AddChidren(frameLayout50.FLayoutView());
+                frameLayout50.btnText.Text = year.year + Language.StringByID(StringId.nian);//骞�
                 for (int j = 0; j < year.callList.Count; j++)
                 {
                     var call = year.callList[j];
+                    //闂ㄥ彛鏈虹姸鎬佺埗鎺т欢
                     View.FrameLayout60 frameLayout60 = new View.FrameLayout60();
                     vv.AddChidren(frameLayout60.FLayoutView());
+                    ///鍛煎彨鏃堕棿
+                    frameLayout60.btnTime.Text = getTime(call.callTime);
+                    ///鍛煎彨鐘舵�侊紙0锛氭湭鎺ワ紱1锛氬凡鎺ワ紱2锛氭嫆鎺ワ級锛涙槸鍚﹀紑閿侊紱
+                    frameLayout60.btnStateText.Text = getStateText(call.callStatus) + "," + getUnlockText(call.isUnlock);
+
                 }
 
             }
 
+
+        }
+        /// <summary>
+        /// 鏄剧ず鍥炬爣
+        /// </summary>
+        /// <param name="flVideo"></param>
+        /// <param name="iconBtn">鍥炬爣</param>
+        private void getIconAndText(FlVideo flVideo, Button iconBtn)
+        {
+            //(1瀹ゅ唴鏈�,2瀹ゅ鏈猴紝3鍥村鏈猴紝4绠$悊鏈�,5浜屾纭鏈�)
+            string iconstr = "";
+            switch (flVideo.devType)
+            {
+                case "1":
+                    {
+                        iconstr = "VideoIcon/danyuanji.png";
+                    }
+                    break;
+                case "2":
+                    {
+                        iconstr = "VideoIcon/danyuanji.png";
+                    }
+                    break;
+                case "3":
+                    {
+                        iconstr = "VideoIcon/weiqiangji.png";
+                    }
+                    break;
+                case "4":
+                    {
+                        iconstr = "VideoIcon/weiqiangji.png";
+                    }
+                    break;
+                case "5":
+                    {
+                        iconstr = "VideoIcon/weiqiangji.png";
+                    }
+                    break;
+                case "100":
+                    {
+                        iconstr = "VideoIcon/menjin.png";
+                    }
+                    break;
+                default:
+                    {
+                        iconstr = "VideoIcon/weiqiangji.png";
+                    }
+                    break;
+
+            }
+            iconBtn.UnSelectedImagePath = iconstr;
+
+        }
+        /// <summary>
+        /// 鑾峰彇鏄剧ず鏃堕棿鏂囨湰
+        /// </summary>
+        /// <param name="str">utcTime</param>
+        /// <returns></returns>
+        private string getTime(string str)
+        {
+            var utcTime = Convert.ToDateTime(str);
+            var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
+            return dateTime.ToString("HH") + ":" + dateTime.ToString("mm");
+        }
+        /// <summary>
+        /// 鑾峰彇鍛煎彨鐘舵�佹枃鏈�
+        /// </summary>
+        /// <param name="str">鐘舵�佸��0锛氭湭鎺ワ紱1锛氬凡鎺ワ紱2锛氭嫆鎺�</param>
+        /// <returns></returns>
+        private string getStateText(string str)
+        {
+            string s = "";
+            switch (str)
+            {
+                case "0":
+                    {
+                        s = Language.StringByID(StringId.weijieting);
+                    }
+                    break;
+                case "1":
+                    {
+                        Language.StringByID(StringId.yijieting);
+                    }
+                    break;
+                case "2":
+                    {
+                        Language.StringByID(StringId.yijujue);
+                    }
+                    break;
+            }
+            return s;
+        }
+        /// <summary>
+        /// 鑾峰彇寮�閿佺姸鎬佹枃鏈�
+        /// </summary>
+        /// <param name="if_bool"></param>
+        /// <returns></returns>
+        private string getUnlockText(bool if_bool)
+        {
+            string s = "";
+            if (if_bool)
+            {
+                s = Language.StringByID(StringId.yikaisuo);
+            }
+            else
+            {
+                s = Language.StringByID(StringId.weikaisuo);
+            }
+            return s;
+        }
+        /// <summary>
+        /// 鑾峰彇uuid
+        /// </summary>
+        /// <param name="uuid"></param>
+        /// <returns></returns>
+        private string getUuid(string uuid)
+        {
+            if (uuid.Contains(","))
+            {
+                var uuid1 = uuid.Split(',');
+                return uuid1[0];
+            }
+            else
+            {
+                return uuid;
+            }
         }
 
-        public string getTime(string str)
-        {
-            var dd = Convert.ToDateTime(str);
-            var time = dd.ToString("HH") + ":" + dd.ToString("mm");
-            return time;
-        }
     }
 
 }

--
Gitblit v1.8.0