陈嘉乐
2021-03-30 5d5a3cbf4aacca721745ff4267b0b4b4b437e548
HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs
@@ -8,12 +8,12 @@
{
    public class MainView : FrameLayout
    {
        public void Show(List<ESVideoInfo> listVideo, List<CallView> listCall)
        public void Show(List<ESVideoInfo> 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();
@@ -31,7 +31,7 @@
            var view2 = new FrameLayout();
            pageView.AddChidren(view2);
            View1(view1, listVideo);
            View2(view2, listCall);
            View2(view2, listCall, video);
            Button btn11 = new Button
            {
                X = Application.GetRealWidth(170),
@@ -80,11 +80,11 @@
                if (pageView.PageIndex == 0)
                {
                    topView.topNameBtn.Text = "可视对讲";
                    topView.topNameBtn.TextID =StringId.keshiduijiang;
                }
                else
                {
                    topView.topNameBtn.Text = "通话记录";
                    topView.topNameBtn.TextID = StringId.tonghuajilu;
                }
            };
@@ -117,8 +117,9 @@
                TextColor = MusicColor.MusicTxet14Color,
                TextSize = TextSize.Text24,
                TextAlignment = TextAlignment.CenterLeft,
                Text = "可视对讲",
            };
                //Text = "可视对讲",
                TextID= StringId.keshiduijiang,
        };
            bjFl.AddChidren(nameBtn);
            /// <summary>
            ///  区域名称
@@ -197,6 +198,7 @@
                    Height = Application.GetRealWidth(48),
                    X = Application.GetRealWidth(31 + (58 + 50) * j),
                    Y = Application.GetRealHeight(20 + (48 + 24) * line),
                    BackgroundColor=0xff357657
                };
                fL.AddChidren(fLayout);
@@ -235,6 +237,10 @@
                clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var eSVideoInfo = clickBtn.Tag as ESVideoInfo;
                    if (string.IsNullOrEmpty(eSVideoInfo.uuid))
                    {
                        new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.peizhicanshuyouyichang));
                    }
                    ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo);
                };
@@ -246,7 +252,7 @@
        /// 第二个界面
        /// </summary>
        /// <param name="view2">父控件</param>
        void View2(FrameLayout view2, List<CallView> listCall)
        void View2(FrameLayout view2, List<CallView> listCall, VideoClouds video)
        {
            var bjFl = new FrameLayout
@@ -270,7 +276,7 @@
                TextColor = MusicColor.MusicTxet14Color,
                TextSize = TextSize.Text24,
                TextAlignment = TextAlignment.CenterLeft,
                Text = "通话记录",
                TextID=StringId.tonghuajilu,
            };
            bjFl.AddChidren(nameBtn);
            /// <summary>
@@ -285,11 +291,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,27 +303,105 @@
                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="str"></param>
        /// <returns></returns>
        public string getTime(string str)
        {
            var dd = Convert.ToDateTime(str);
            var time = dd.ToString("HH") + ":" + dd.ToString("mm");
            return time;
            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;
        }
    }