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/DAL/Server/NewAPI.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs | 76 +++++++++++- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 8 HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs | 41 +++++- HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs | 24 +++ .vs/HDL_APP_Project/xs/UserPrefs.xml | 56 ++++++++- HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs | 90 +++++++++++++++ 8 files changed, 267 insertions(+), 34 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 8790f74..ab2b70a 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,11 +1,55 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="../../Application.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs" Line="64" Column="15" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs" Line="253" Column="56" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs" Line="30" Column="23" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs" Line="71" Column="49" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="686" Column="1" /> + <File FileName="../../TempQRCode.cs" Line="125" Column="48" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs" Line="100" Column="39" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs" Line="118" Column="50" /> + <File FileName="HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs" Line="63" Column="29" /> + <File FileName="../../Application.cs" Line="1" Column="1" /> </Files> + <Pads> + <Pad Id="ProjectPad"> + <State name="__root__"> + <Node name="HDL_APP_Project" expanded="True"> + <Node name="HDL_ON" expanded="True"> + <Node name="Common" expanded="True" /> + <Node name="DAL" expanded="True"> + <Node name="ThirdPartySdk" expanded="True" /> + </Node> + <Node name="UI" expanded="True"> + <Node name="UI0-Stan" expanded="True"> + <Node name="Controls" expanded="True"> + <Node name="NormalControls" expanded="True" /> + </Node> + </Node> + <Node name="UI2" expanded="True"> + <Node name="4-PersonalCenter" expanded="True"> + <Node name="PirDevice" expanded="True" /> + </Node> + <Node name="FuntionControlView" expanded="True"> + <Node name="Music" expanded="True"> + <Node name="View" expanded="True" /> + </Node> + <Node name="Video" expanded="True"> + <Node name="View" expanded="True" /> + <Node name="MainView.cs" selected="True" /> + </Node> + </Node> + </Node> + </Node> + </Node> + <Node name="HDL-ON_Android" expanded="True" /> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="Resources" expanded="True" /> + </Node> + </Node> + </State> + </Pad> + </Pads> </MonoDevelop.Ide.Workbench> <MonoDevelop.Ide.DebuggingService.PinnedWatches /> <DisabledProjects> @@ -14,7 +58,7 @@ <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> - <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> + <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index 4c3f714..dfb9735 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -571,6 +571,10 @@ /// 鑾峰彇闂ㄥ彛鏈哄垪琛� /// </summary> public const string API_POST_FL_List = "http://112.74.164.111:180/api.php/Device/getmonitorUUID"; + /// <summary> + /// 鍔ㄦ�佸瘑鐮�/浜岀淮鐮佸紑閿� + /// </summary> + public const string API_POST_FL_QRcode = "http://112.74.164.111:180/api.php/Device/setdynamicpwd"; #endregion diff --git a/HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs b/HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs index 48c6056..1466184 100644 --- a/HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs +++ b/HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs @@ -59,8 +59,6 @@ /// <param name="mESVideoInfo"></param> public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo) { - this.esVideoInfo = mESVideoInfo; - #if __IOS__ int roomID = 0; int.TryParse(mESVideoInfo.roomno, out roomID); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index c35e8b5..1c50a75 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -260,10 +260,10 @@ { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - - var view = new UI2.FuntionControlView.Video.VideoMethod();// AddThirdPartyBrandListpage(); // BrandListPage(); - view.MianView(); - + HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod videoMethod = new UI2.FuntionControlView.Video.VideoMethod(); + videoMethod.getVideo((device)=> { + videoMethod.MianView(this, device); + }, this,true); return; var page = new BrandListPage();// AddThirdPartyBrandListpage(); // BrandListPage(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs index 647a483..ada70a2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/MainView.cs @@ -2,13 +2,15 @@ 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(List<ESVideoInfo> listVideo, List<CallView> listCall, VideoClouds video) + public void Show(List<VideoMethod.FlVideo> listVideo, List<CallView> listCall, VideoClouds video) { this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); @@ -30,7 +32,7 @@ pageView.AddChidren(view1); var view2 = new FrameLayout(); pageView.AddChidren(view2); - View1(view1, listVideo); + View1(view1, listVideo, video); View2(view2, listCall, video); Button btn11 = new Button { @@ -93,9 +95,9 @@ /// 绗竴涓晫闈� /// </summary> /// <param name="view1">鐖舵帶浠�</param> - void View1(FrameLayout view1, List<ESVideoInfo> list) + void View1(FrameLayout view1, List<VideoMethod.FlVideo> list, VideoClouds videoClouds) { - + var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), @@ -168,6 +170,11 @@ Width = Application.GetRealWidth(327), }; bjFl.AddChidren(vv); + if (list.Count > 0) + { + //闂ㄧ浜岀淮鐮佸浐瀹氭湁鐨�,铏氭嫙涓�涓嚭鏉� + list.Add(new VideoMethod.FlVideo { aliasName = "闂ㄧ浜岀淮鐮�", devType = "10" }); + } //鏁扮粍涓暟 //int value = 15; //鍏堣绠楁暟鎹墍闇�瑕佺殑寰堥珮搴︼紱 @@ -188,17 +195,16 @@ }; vv.AddChidren(fL); int line = 0; + for (int i = 1, j = 0; i <= list.Count; i++, j++) { var video = list[i - 1]; - 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), - BackgroundColor=0xff357657 }; fL.AddChidren(fLayout); @@ -220,7 +226,7 @@ TextSize = TextSize.Text10, TextColor = CSS.CSS_Color.TextualColor, TextAlignment = TextAlignment.Center, - Text = video.DeviceName, + Text = video.aliasName, }; fLayout.AddChidren(iconNameBtn); @@ -236,13 +242,28 @@ // GetIconAndText(i, deviceIconBtn, iconNameBtn); clickBtn.MouseUpEventHandler += (sender, e) => { - var eSVideoInfo = clickBtn.Tag as ESVideoInfo; - if (string.IsNullOrEmpty(eSVideoInfo.uuid)) + 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); + //VideoSend.GetQRcode(this, videoClouds, (tag,paw) => + //{ + // if (tag) + // { + // View.ShowDialog showDialog = new View.ShowDialog(); + // showDialog.QRcode(paw); + // } + //}); }; } @@ -403,6 +424,8 @@ } return s; } + + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs index b38522d..39d18e8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoMethod.cs @@ -19,7 +19,7 @@ Loading loading = new Loading(); frameLayout.AddChidren(loading); loading.Start(); - List<ESVideoInfo> listESVideoInfo = new List<ESVideoInfo>(); + List<VideoMethod.FlVideo> listESVideoInfo = new List<VideoMethod.FlVideo>(); List<CallView> listCall = new List<CallView>(); new System.Threading.Thread(() => { @@ -203,7 +203,12 @@ } - + /// <summary> + /// 闅忔満瀵嗙爜6浣� + /// </summary> + /// <returns></returns> public static string getCode() { Random rand = new Random(); string code = ""; for (int ctr = 0; ctr < 6; ctr++) { code += rand.Next(10).ToString(); } return code; } + /// <summary> /// 鑾峰彇褰撳墠鏃堕棿鎴� /// </summary> /// <returns></returns> public static string GetCurrentTimeStamp() { TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); return Convert.ToInt64(ts.TotalSeconds).ToString(); } + /// <summary> /// 鑾峰彇褰撳墠鏃堕棿鎴� /// </summary> /// <returns></returns> public static string GetTomorrowTimeStamp() { //褰撳墠鏃堕棿鐨勫悗涓�澶� TimeSpan ts = DateTime.Now.AddDays(1) - new DateTime(1970, 1, 1, 0, 0, 0, 0); return Convert.ToInt64(ts.TotalSeconds).ToString(); } [Serializable] public class VideoClouds { @@ -296,6 +301,19 @@ public List<Call> callList = new List<Call>(); } - + [Serializable] + public class FlVideo + { + /// <summary> + /// 璁惧鍚嶇О + /// </summary> + public string aliasName = string.Empty; + /// <summary> + /// 璁惧绫诲瀷锛�(1瀹ゅ唴鏈�,2瀹ゅ鏈猴紝3鍥村鏈猴紝4绠$悊鏈�,5浜屾纭鏈�) + /// </summary> + public string devType = string.Empty; + public string uuid = string.Empty; + } + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs index e0dde18..9539a84 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/VideoSend.cs @@ -6,7 +6,6 @@ using HDL_ON.UI.UI2.PersonalCenter.PirDevice; using Newtonsoft.Json.Linq; using Shared; -using static HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod; namespace HDL_ON.UI.UI2.FuntionControlView.Video { @@ -39,9 +38,9 @@ /// <summary> /// 鑾峰彇闂ㄥ彛鏈哄垪琛�(1瀹ゅ唴鏈�,2瀹ゅ鏈猴紝3鍥村鏈猴紝4绠$悊鏈�,5浜屾纭鏈�) /// </summary> - public static List<ESVideoInfo> GetVideoInfoList(VideoClouds video) + public static List<VideoMethod.FlVideo> GetVideoInfoList(VideoMethod.VideoClouds video) { - List<ESVideoInfo> eSVideoInfosList = new List<ESVideoInfo>(); + List<VideoMethod.FlVideo> eSVideoInfosList = new List<VideoMethod.FlVideo>(); var jobject = new JObject(); jobject.Add("cmtID", video.flCmtId); jobject.Add("unitno", video.flBuildingId); @@ -69,26 +68,83 @@ } foreach (var videoInfo in list) { - ESVideoInfo eSVideoInfo = new ESVideoInfo(); - eSVideoInfo.DeviceName = videoInfo["aliasName"]; + VideoMethod.FlVideo flVideo = new VideoMethod.FlVideo(); + flVideo.aliasName = videoInfo["aliasName"]; if (videoInfo["uuid"].Contains(",")) { var uuid = videoInfo["uuid"].Split(','); - eSVideoInfo.ESVideoUUID = uuid[0]; + flVideo.uuid = uuid[0]; } else { - eSVideoInfo.ESVideoUUID = videoInfo["uuid"]; + flVideo.uuid = videoInfo["uuid"]; } - eSVideoInfo.uuid = videoInfo["uuid"]; - eSVideoInfo.roomno = video.flRoomId; - eSVideoInfosList.Add(eSVideoInfo); + flVideo.devType = videoInfo["devType"]; + //eSVideoInfo.roomno = video.flRoomId; + eSVideoInfosList.Add(flVideo); } } catch { } return eSVideoInfosList; } /// <summary> + /// 涓婃姤鍔ㄦ�佸紑閿佸瘑鐮� + /// </summary> + public static void GetQRcode(FrameLayout frame, VideoMethod.VideoClouds video,Action<bool,string>action) + { + ///鏍囪鏄惁鎴愬姛 + bool if_bool = false; + //涓存椂瀵嗙爜 + string pwd = VideoMethod.getCode(); + var jobject = new JObject(); jobject.Add("communityID", video.flCmtId);//绀惧尯ID + jobject.Add("fromTime", VideoMethod.GetCurrentTimeStamp());//寮�濮嬫椂闂� + jobject.Add("validTime", VideoMethod.GetTomorrowTimeStamp());//鏈夋晥鏃堕棿 + jobject.Add("unitno", video.flBuildingId);//鍗曞厓鍙� + jobject.Add("roomno", video.flRoomId);//鎴块棿鍙� + jobject.Add("code", pwd); jobject.Add("userKey", video.flSecretKey); jobject.Add("timestamp", VideoMethod.GetCurrentTimeStamp()); jobject.Add("secretKey", video.flSecretKey); jobject.Add("method", "setdynamicpwd"); jobject.Add("numTimes", "5"); + //鍔犺浇log + Loading loading = new Loading(); + frame.AddChidren(loading); + loading.Start(); + new System.Threading.Thread(() => + { + try + { + var str = HttpWebRequest(NewAPI.API_POST_FL_QRcode, jobject.ToString(), "POST"); + if (!string.IsNullOrEmpty(str)) + { + try + { + var json = JObject.Parse(str); + if (json != null) + { + var stateCode = json["resCode"].ToString(); + if (stateCode != "0") + { + if_bool = true; + } + } + } + catch { + + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + action(if_bool, pwd); + + }); + } + + }) + { IsBackground = true }.Start(); + } + /// <summary> /// 璇锋眰鏈嶅姟鍣ㄧ殑鏂规硶(鏀寔璇锋眰鏂瑰紡涓篜OST/GET) /// </summary> /// <param name="getUrl">璇锋眰鐨勫湴鍧�</param> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs index ff1806d..6e15f59 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs @@ -87,5 +87,95 @@ } + + /// <summary> + /// 鐢熸垚浜岀淮鐮� + /// </summary> + /// <param name="str1">鏍囬</param> + public void QRcode(string str1) + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + FrameLayout frameLayout = new FrameLayout { }; + dialog.AddChidren(frameLayout); + FrameLayout whiteView = new FrameLayout() + { + X = Application.GetRealWidth(56), + Y = Application.GetRealHeight(199), + Width = Application.GetRealWidth(282), + Height = Application.GetRealHeight(316), + BackgroundColor = MusicColor.WhiteColor, + Radius = (uint)Application.GetRealHeight(16), + }; + frameLayout.AddChidren(whiteView); + //涓存椂瀵嗙爜 + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(32), + Height = Application.GetRealHeight(22), + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + IsBold = true, + Text = "涓存椂瀵嗙爜", + }; + whiteView.AddChidren(btnTitle); + //瀵嗙爜 + Button btnpaw = new Button() + { + X=Application.GetRealWidth(100), + Y = Application.GetRealHeight(62), + Height = Application.GetRealHeight(32), + Width = Application.GetRealWidth(82), + TextColor = MusicColor.SelectedColor, + TextSize =24, + TextAlignment = TextAlignment.Center, + IsBold = true, + Text = str1, + }; + whiteView.AddChidren(btnpaw); + Button iconBtn = new Button + { + X = Application.GetRealWidth(194), + Y = Application.GetRealHeight(68), + Width = Application.GetRealWidth(20), + Height = Application.GetRealWidth(20), + UnSelectedImagePath = "VideoIcon/hangup.png", + }; + whiteView.AddChidren(iconBtn); + //浜岀淮鐮� + int codeWidth = Application.GetRealWidth(142); + ImageView codeImage = new ImageView() + { + X = Application.GetRealWidth(70), + Y = Application.GetRealHeight(142), + Height = codeWidth, + Width = codeWidth, + ImageBytes = Scan.BytesFromText(str1, codeWidth, codeWidth), + }; + whiteView.AddChidren(codeImage); + dialog.Show(); + iconBtn.MouseUpEventHandler += (sender, e) => + { + iconBtn.IsSelected = !iconBtn.IsSelected; + if (iconBtn.IsSelected) + { + btnpaw.Text = "******"; + } + else + { + btnpaw.Text = str1; + + } + }; + frameLayout.MouseUpEventHandler += (sender, e) => + { + dialog.Close(); + }; + + } + } } -- Gitblit v1.8.0