lss
2021-04-23 8ccc71771efec9434ad3b4a45c5f2ec11326d40f
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;
        }
    }
}