From ccdff82fac4bcc1067ec806ade5ae897f1214f4d Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 01 四月 2021 14:41:53 +0800 Subject: [PATCH] 异常捕获 --- HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs | 630 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 413 insertions(+), 217 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs index f49dd0e..9ec50bf 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs @@ -1,17 +1,31 @@ 锘縰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; +using HDL_ON.Entity; + namespace HDL_ON.UI.UI2.FuntionControlView.Video { public class MainView : FrameLayout { + /// <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) public void Show() { + #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(); @@ -78,263 +92,445 @@ 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> + /// <param name="list">闂ㄥ彛鏈哄垪琛�</param> + /// <param name="videoClouds">褰撳墠鐨勫彲瑙嗗璁�</param> void View1(FrameLayout view1) { - - var bjFl = new FrameLayout - { - Y = Application.GetRealHeight(24), - X = Application.GetRealWidth(24), - Height = Application.GetRealHeight(526), - Width = Application.GetRealWidth(327), - BackgroundImagePath = "MusicIcon/playBj.png", - }; - view1.AddChidren(bjFl); - /// <summary> - /// 姹夊瓧 - /// </summary> - Button nameBtn = new Button - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(16), - Width = Application.GetRealWidth(100), - Height = Application.GetRealHeight(33), - TextColor = MusicColor.MusicTxet14Color, - TextSize = TextSize.Text24, - TextAlignment = TextAlignment.CenterLeft, - Text = "鍙瀵硅", - }; - bjFl.AddChidren(nameBtn); - /// <summary> - /// 鍖哄煙鍚嶇О - /// </summary> - Button regionBtn = new Button - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(53), - Width = Application.GetRealWidth(270), - Height = Application.GetRealHeight(17), - TextColor = MusicColor.MusicNoTxetColor, - TextSize = TextSize.Text12, - TextAlignment = TextAlignment.CenterLeft, - Text = "123456" - }; - bjFl.AddChidren(regionBtn); - /// <summary> - ///鏀惰棌鍥炬爣 - /// </summary> - Button collectIconBtn = new Button - { - X = Application.GetRealWidth(273), - Y = Application.GetRealHeight(14), - Width = Application.GetRealWidth(40), - Height = Application.GetRealWidth(40), - UnSelectedImagePath = "MusicIcon/collect.png", - SelectedImagePath = "MusicIcon/collectSelected.png", - }; - bjFl.AddChidren(collectIconBtn); - Button intercomBtnIcon = new Button + new System.Threading.Thread(() => { - X = Application.GetRealWidth(84), - Y = Application.GetRealHeight(118), - Width = Application.GetRealWidth(160), - Height = Application.GetRealWidth(160), - UnSelectedImagePath = "VideoIcon/keshiduijiang.png", - - }; - bjFl.AddChidren(intercomBtnIcon); - - var vv = new VerticalScrolViewLayout { - Y = Application.GetRealHeight(306), - Height = Application.GetRealHeight(220), - Width = Application.GetRealWidth(327), - }; - bjFl.AddChidren(vv); - //鏁扮粍涓暟 - int value = 15; - //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱 - int l = 0; - if (value % 3 == 0) - { - l = value / 3; - } - else - { - - l = (value / 3) + 1; - } - var fL = new FrameLayout - { - Height = Application.GetRealHeight((48 + 24) * l), - - }; - vv.AddChidren(fL); - int line = 0; - for (int i = 1, j = 0; i <= value; i++, j++) - { - var fLayout = new FrameLayout + var list = VideoSend.GetVideoInfoList(FunctionList.List.videoIntercom); + Application.RunOnMainThread(() => { - Width = Application.GetRealWidth(50), - Height = Application.GetRealWidth(48), - X = Application.GetRealWidth(31 + (58 + 50) * j), - Y = Application.GetRealHeight(20 + (48 + 24) * line), + #region 甯冨眬鐣岄潰 + var bjFl = new FrameLayout + { + Y = Application.GetRealHeight(24), + X = Application.GetRealWidth(24), + Height = Application.GetRealHeight(526), + Width = Application.GetRealWidth(327), + BackgroundImagePath = "MusicIcon/playBj.png", + }; + view1.AddChidren(bjFl); + /// <summary> + /// 姹夊瓧 + /// </summary> + Button nameBtn = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(16), + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(33), + TextColor = MusicColor.MusicTxet14Color, + TextSize = TextSize.Text24, + TextAlignment = TextAlignment.CenterLeft, + //Text = "鍙瀵硅", + TextID = StringId.keshiduijiang, + }; + bjFl.AddChidren(nameBtn); + /// <summary> + /// 鍖哄煙鍚嶇О + /// </summary> + Button regionBtn = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(53), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(17), + TextColor = MusicColor.MusicNoTxetColor, + TextSize = TextSize.Text12, + TextAlignment = TextAlignment.CenterLeft, + Text = "123456" + }; + bjFl.AddChidren(regionBtn); + /// <summary> + ///鏀惰棌鍥炬爣 + /// </summary> + Button collectIconBtn = new Button + { + X = Application.GetRealWidth(273), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(40), + Height = Application.GetRealWidth(40), + UnSelectedImagePath = "MusicIcon/collect.png", + SelectedImagePath = "MusicIcon/collectSelected.png", + }; + bjFl.AddChidren(collectIconBtn); + ///鍙瀵硅鍥炬爣 + Button intercomBtnIcon = new Button + { + X = Application.GetRealWidth(84), + Y = Application.GetRealHeight(118), + Width = Application.GetRealWidth(160), + Height = Application.GetRealWidth(160), + UnSelectedImagePath = "VideoIcon/keshiduijiang.png", - }; - fL.AddChidren(fLayout); + }; + bjFl.AddChidren(intercomBtnIcon); - var iconBtn = new Button - { - X = Application.GetRealWidth(11), - Width = Application.GetRealWidth(28), - Height = Application.GetRealWidth(28), - UnSelectedImagePath = "VideoIcon/weiqiangji.png", - }; - fLayout.AddChidren(iconBtn); + 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 = Language.StringByID(StringId.menjinerweima), devType = "100" }); + } + //鏁扮粍涓暟 + //int value = 15; + //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱 + int l = 0; + if (list.Count % 3 == 0) + { + l = list.Count / 3; + } + else + { + l = (list.Count / 3) + 1; + } + var fL = new FrameLayout + { + Height = Application.GetRealHeight((48 + 24) * l), + }; + 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), + Height = Application.GetRealWidth(48), + X = Application.GetRealWidth(31 + (58 + 50) * j), + Y = Application.GetRealHeight(20 + (48 + 24) * line), - var iconNameBtn = new Button - { - Y = iconBtn.Bottom + Application.GetRealHeight(6), - Width = Application.GetRealWidth(50), - Height = Application.GetRealHeight(14), - TextSize = TextSize.Text10, - TextColor = CSS.CSS_Color.TextualColor, - TextAlignment = TextAlignment.Center, - Text="鏌ョ湅鍗曞厓鏈�" - }; - fLayout.AddChidren(iconNameBtn); + }; + fL.AddChidren(fLayout); - var clickBtn = new Button { Tag = i }; - fLayout.AddChidren(clickBtn); - if (i % 3 == 0) - { - //婊′竴琛岄噸缃甹=0鍊�; - j = -1; - line += 1; - } - // GetIconAndText(i, deviceIconBtn, iconNameBtn); - clickBtn.MouseUpEventHandler += (sender, e) => - { + var iconBtn = new Button + { + X = Application.GetRealWidth(11), + Width = Application.GetRealWidth(28), + Height = Application.GetRealWidth(28), + UnSelectedImagePath = "VideoIcon/weiqiangji.png", + }; + fLayout.AddChidren(iconBtn); - ////1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�; - //int if_value = int.Parse(clickBtn.Tag.ToString()); - //if (if_value == 7) - //{ - // Method method = new Method(); - // method.AddControl(this, (control) => - // { - // 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); + var deviceNameBtn = new Button + { + Y = iconBtn.Bottom + Application.GetRealHeight(6), + Width = Application.GetRealWidth(50), + Height = Application.GetRealHeight(14), + TextSize = TextSize.Text10, + TextColor = CSS.CSS_Color.TextualColor, + TextAlignment = TextAlignment.Center, + Text = video.aliasName, + }; + fLayout.AddChidren(deviceNameBtn); - // }); - // } - // else - // { - // DeviceTypeViewClick(if_value); - // } - //} - }; - } + var clickBtn = new Button { Tag = video }; + + fLayout.AddChidren(clickBtn); + if (i % 3 == 0) + { + //婊′竴琛岄噸缃甹=0鍊�; + j = -1; + line += 1; + } + getIconAndText(video, iconBtn); + #endregion + //闂ㄥ彛鏈虹殑鐐瑰嚮浜嬩欢 + clickBtn.MouseUpEventHandler += (sender, e) => + { + var flVideo = clickBtn.Tag as VideoMethod.FlVideo; + if (flVideo.devType == "100") + { + //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨� + VideoSend.GetQRcode(this, FunctionList.List.videoIntercom, (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 = FunctionList.List.videoIntercom.flRoomId, + unitno = FunctionList.List.videoIntercom.flBuildingId, + }; + ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo); + } + }; + } + }); + }) + { IsBackground = true }.Start(); } /// <summary> /// 绗簩涓晫闈� /// </summary> /// <param name="view2">鐖舵帶浠�</param> + /// <param name="listCall">閫氳瘽璁板綍鍒楄〃</param> + /// <param name="video">褰撳墠鐨勫彲瑙嗗璁�</param> void View2(FrameLayout view2) { - - var bjFl = new FrameLayout + new System.Threading.Thread(() => { - Y = Application.GetRealHeight(24), - X = Application.GetRealWidth(24), - Height = Application.GetRealHeight(526), - Width = Application.GetRealWidth(327), - BackgroundImagePath = "MusicIcon/playBj.png", - }; - view2.AddChidren(bjFl); - /// <summary> - /// 姹夊瓧 - /// </summary> - Button nameBtn = new Button - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(16), - Width = Application.GetRealWidth(100), - Height = Application.GetRealHeight(33), - TextColor = MusicColor.MusicTxet14Color, - TextSize = TextSize.Text24, - TextAlignment = TextAlignment.CenterLeft, - Text = "閫氳瘽璁板綍", - }; - bjFl.AddChidren(nameBtn); - /// <summary> - /// 浜戠鐓х墖鍙繚鐣�30澶� - /// </summary> - Button regionBtn = new Button - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(53), - Width = Application.GetRealWidth(270), - Height = Application.GetRealHeight(17), - TextColor = MusicColor.SelectedColor, - TextSize = TextSize.Text12, - TextAlignment = TextAlignment.CenterLeft, - Text = "*浜戠鐓х墖鍙繚鐣�30澶�" - }; - bjFl.AddChidren(regionBtn); - - var vv = new VerticalScrolViewLayout - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(58), - Height = Application.GetRealHeight(458), - Width = Application.GetRealWidth(295), - }; - bjFl.AddChidren(vv); - for (int i = 0; i < 6; i++) - { - - if (i == 0|| i == 2) + var listCall = new HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod().getCall(FunctionList.List.videoIntercom.id); + Application.RunOnMainThread(() => { - View.FrameLayout50 frameLayout50 = new View.FrameLayout50(); - vv.AddChidren(frameLayout50.FLayoutView()); - } - else + var bjFl = new FrameLayout + { + Y = Application.GetRealHeight(24), + X = Application.GetRealWidth(24), + Height = Application.GetRealHeight(526), + Width = Application.GetRealWidth(327), + BackgroundImagePath = "MusicIcon/playBj.png", + }; + view2.AddChidren(bjFl); + /// <summary> + /// 姹夊瓧 + /// </summary> + Button nameBtn = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(16), + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(33), + TextColor = MusicColor.MusicTxet14Color, + TextSize = TextSize.Text24, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.tonghuajilu, + }; + bjFl.AddChidren(nameBtn); + /// <summary> + /// 浜戠鐓х墖鍙繚鐣�30澶� + /// </summary> + Button regionBtn = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(53), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(17), + TextColor = MusicColor.SelectedColor, + TextSize = TextSize.Text12, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.baolu30, + }; + bjFl.AddChidren(regionBtn); + + var vv = new VerticalRefreshLayout + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(58), + Height = Application.GetRealHeight(458), + Width = Application.GetRealWidth(295), + }; + bjFl.AddChidren(vv); + vv.BeginHeaderRefreshingAction += () => + { + VideoMethod videoMethod = new VideoMethod(); + var list = videoMethod.getCall(FunctionList.List.videoIntercom.id); + RefreshView(vv, list); + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + }; + //RefreshView(vv, listCall); + }); + }) + { IsBackground = true }.Start(); + } + /// <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; + } } - } } -- Gitblit v1.8.0