wei
2021-07-16 65d30e65eb0ee4168871e891984ea565b144c7f4
HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
@@ -13,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;
@@ -36,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),
@@ -108,14 +107,16 @@
            };
            #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
            {
@@ -189,23 +190,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
            {
@@ -215,23 +218,22 @@
            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
                {
                    Width = Application.GetRealWidth(50),
                    Width = Application.GetRealWidth(96),
                    Height = Application.GetRealWidth(48),
                    X = Application.GetRealWidth(31 + (58 + 50) * j),
                    X = Application.GetRealWidth(20 + (26 + 28 + 42) * j),
                    Y = Application.GetRealHeight(20 + (48 + 24) * line),
                };
                fL.AddChidren(fLayout);
                var iconBtn = new Button
                {
                    X = Application.GetRealWidth(11),
                    Gravity=Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(28),
                    Height = Application.GetRealWidth(28),
                    UnSelectedImagePath = "VideoIcon/weiqiangji.png",
@@ -241,12 +243,13 @@
                var deviceNameBtn = new Button
                {
                    Y = iconBtn.Bottom + Application.GetRealHeight(6),
                    Width = Application.GetRealWidth(50),
                    X = Application.GetRealWidth(6),
                    Width = Application.GetRealWidth(96-12),
                    Height = Application.GetRealHeight(14),
                    TextSize = TextSize.Text10,
                    TextColor = CSS.CSS_Color.TextualColor,
                    TextAlignment = TextAlignment.Center,
                    Text = video.aliasName,
                    Text = video.deviceName,
                };
                fLayout.AddChidren(deviceNameBtn);
@@ -264,11 +267,11 @@
                //门口机的点击事件
                clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var flVideo = clickBtn.Tag as FlVideo;
                    if (flVideo.devType == "100")
                    var video2 = clickBtn.Tag as Video;
                    if (video2.devType == "100")
                    {
                        //门禁二维码固定有的
                        VideoSend.GetQRcode(this, videoClouds, (tag, paw) =>
                        VideoSend.GetQRcode(this, video2, (tag, paw) =>
                        {
                            if (tag)
                            {
@@ -280,36 +283,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),
@@ -361,7 +372,7 @@
            vv.BeginHeaderRefreshingAction += () =>
            {
                VideoMethod videoMethod = new VideoMethod();
                var list = videoMethod.GetCall(video.id);
                var list = videoMethod.GetCall();
                RefreshView(vv, list);
                //关闭刷新View;
                vv.EndHeaderRefreshing();
@@ -369,6 +380,7 @@
            RefreshView(vv, listCall);
        }
        /// <summary>
        /// 通话记录刷新界面
        /// </summary>
@@ -406,11 +418,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":
                    {
@@ -461,8 +473,9 @@
        {
            var utcTime = Convert.ToDateTime(str);
            var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
            return dateTime.ToString("HH") + ":" + dateTime.ToString("mm");
            return dateTime.ToString("MM-dd HH:mm");
        }
        /// <summary>
        /// 获取呼叫状态文本
        /// </summary>
@@ -527,6 +540,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;
        }
    }
}