From 003abaf86b766eb40ef62300ab0c707774c36ba9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 30 三月 2021 20:10:16 +0800
Subject: [PATCH] 2021-3-30-2

---
 HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs |  205 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 148 insertions(+), 57 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
index f49dd0e..ada70a2 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
@@ -1,17 +1,21 @@
 锘縰sing System;
 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()
+        public void Show(List<VideoMethod.FlVideo> listVideo, List<CallView> listCall, VideoClouds video)
         {
-
             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();
@@ -28,8 +32,8 @@
             pageView.AddChidren(view1);
             var view2 = new FrameLayout();
             pageView.AddChidren(view2);
-            View1(view1);
-            View2(view2);
+            View1(view1, listVideo, video);
+            View2(view2, listCall, video);
             Button btn11 = new Button
             {
                 X = Application.GetRealWidth(170),
@@ -78,11 +82,11 @@
 
                 if (pageView.PageIndex == 0)
                 {
-                    topView.topNameBtn.Text = "鍙瀵硅";
+                    topView.topNameBtn.TextID =StringId.keshiduijiang;
                 }
                 else
                 {
-                    topView.topNameBtn.Text = "閫氳瘽璁板綍";
+                    topView.topNameBtn.TextID = StringId.tonghuajilu;
 
                 }
             };
@@ -91,9 +95,9 @@
         /// 绗竴涓晫闈�
         /// </summary>
         /// <param name="view1">鐖舵帶浠�</param>
-        void View1(FrameLayout view1)
+        void View1(FrameLayout view1, List<VideoMethod.FlVideo> list, VideoClouds videoClouds)
         {
-        
+           
             var bjFl = new FrameLayout
             {
                 Y = Application.GetRealHeight(24),
@@ -115,8 +119,9 @@
                 TextColor = MusicColor.MusicTxet14Color,
                 TextSize = TextSize.Text24,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = "鍙瀵硅",
-            };
+                //Text = "鍙瀵硅",
+                TextID= StringId.keshiduijiang,
+        };
             bjFl.AddChidren(nameBtn);
             /// <summary>
             ///  鍖哄煙鍚嶇О
@@ -158,24 +163,30 @@
             };
             bjFl.AddChidren(intercomBtnIcon);
 
-            var vv = new VerticalScrolViewLayout {
+            var vv = new VerticalScrolViewLayout
+            {
                 Y = Application.GetRealHeight(306),
                 Height = Application.GetRealHeight(220),
                 Width = Application.GetRealWidth(327),
             };
             bjFl.AddChidren(vv);
+            if (list.Count > 0)
+            {
+                //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�,铏氭嫙涓�涓嚭鏉�
+                list.Add(new VideoMethod.FlVideo { aliasName = "闂ㄧ浜岀淮鐮�", devType = "10" });
+            }
             //鏁扮粍涓暟
-            int value = 15;
+            //int value = 15;
             //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱
             int l = 0;
-            if (value % 3 == 0)
+            if (list.Count % 3 == 0)
             {
-                l = value / 3;
+                l = list.Count / 3;
             }
             else
             {
 
-                l = (value / 3) + 1;
+                l = (list.Count / 3) + 1;
             }
             var fL = new FrameLayout
             {
@@ -184,8 +195,10 @@
             };
             vv.AddChidren(fL);
             int line = 0;
-            for (int i = 1, j = 0; i <= value; i++, j++)
+            
+            for (int i = 1, j = 0; i <= list.Count; i++, j++)
             {
+                var video = list[i - 1];
                 var fLayout = new FrameLayout
                 {
                     Width = Application.GetRealWidth(50),
@@ -213,11 +226,12 @@
                     TextSize = TextSize.Text10,
                     TextColor = CSS.CSS_Color.TextualColor,
                     TextAlignment = TextAlignment.Center,
-                    Text="鏌ョ湅鍗曞厓鏈�"
+                    Text = video.aliasName,
                 };
                 fLayout.AddChidren(iconNameBtn);
 
-                var clickBtn = new Button { Tag = i };
+                var clickBtn = new Button { Tag = video };
+
                 fLayout.AddChidren(clickBtn);
                 if (i % 3 == 0)
                 {
@@ -228,35 +242,28 @@
                 // GetIconAndText(i, deviceIconBtn, iconNameBtn);
                 clickBtn.MouseUpEventHandler += (sender, e) =>
                 {
+                    var flVideo = clickBtn.Tag as VideoMethod.FlVideo;
+                    if (string.IsNullOrEmpty(flVideo.uuid))
+                    {
+                        new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.peizhicanshuyouyichang));
+                    }
+                    ESVideoInfo eSVideoInfo = new ESVideoInfo
+                    {
+                        ESVideoUUID = flVideo.uuid,
+                        DeviceName = flVideo.aliasName,
+                        roomno = videoClouds.flRoomId,
+                        unitno= videoClouds.flBuildingId,
+                    };
+                    ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo);
 
-                    ////1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�;
-                    //int if_value = int.Parse(clickBtn.Tag.ToString());
-                    //if (if_value == 7)
+                    //VideoSend.GetQRcode(this, videoClouds, (tag,paw) =>
                     //{
-                    //    Method method = new Method();
-                    //    method.AddControl(this, (control) =>
+                    //    if (tag)
                     //    {
-                    //        AddButton addButton = new AddButton();
-                    //        MainPage.BasePageView.AddChidren(addButton);
-                    //        addButton.Show(control);
-                    //        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                    //    });
-                    //}
-                    //else
-                    //{
-                    //    if (DeviceTypeList.Count == 0)
-                    //    {
-                    //        GetDeviceTypeList(true, () =>
-                    //        {
-                    //            DeviceTypeViewClick(if_value);
-
-                    //        });
+                    //        View.ShowDialog showDialog = new View.ShowDialog();
+                    //        showDialog.QRcode(paw);
                     //    }
-                    //    else
-                    //    {
-                    //        DeviceTypeViewClick(if_value);
-                    //    }
-                    //}
+                    //});
                 };
             }
 
@@ -266,9 +273,9 @@
         /// 绗簩涓晫闈�
         /// </summary>
         /// <param name="view2">鐖舵帶浠�</param>
-        void View2(FrameLayout view2)
+        void View2(FrameLayout view2, List<CallView> listCall, VideoClouds video)
         {
-            
+
             var bjFl = new FrameLayout
             {
                 Y = Application.GetRealHeight(24),
@@ -290,7 +297,7 @@
                 TextColor = MusicColor.MusicTxet14Color,
                 TextSize = TextSize.Text24,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = "閫氳瘽璁板綍",
+                TextID=StringId.tonghuajilu,
             };
             bjFl.AddChidren(nameBtn);
             /// <summary>
@@ -305,11 +312,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),
@@ -317,24 +324,108 @@
                 Width = Application.GetRealWidth(295),
             };
             bjFl.AddChidren(vv);
-            for (int i = 0; i < 6; i++)
+            vv.BeginHeaderRefreshingAction += () =>
             {
+                VideoMethod videoMethod = new VideoMethod();
+                var list = videoMethod.getCall(video.id);
+                RefreshView(vv, list);
+                //鍏抽棴鍒锋柊View锛�
+                vv.EndHeaderRefreshing();
+            };
+            RefreshView(vv, listCall);
 
-                if (i == 0|| i == 2)
+        }
+        /// <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++)
                 {
-                    View.FrameLayout50 frameLayout50 = new View.FrameLayout50();
-                    vv.AddChidren(frameLayout50.FLayoutView());
-                }
-                else
-                {
+                    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="str"></param>
+        /// <returns></returns>
+        public 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>
+        public 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>
+        public string getUnlockText(bool if_bool)
+        {
+            string s = "";
+            if (if_bool)
+            {
+                s = Language.StringByID(StringId.yikaisuo);
+            }
+            else
+            {
+                s = Language.StringByID(StringId.weikaisuo);
+            }
+            return s;
+        }
+
+
     }
 
 }

--
Gitblit v1.8.0