From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs | 146 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 138 insertions(+), 8 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs b/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs index 5ccdaac..a8fb00f 100755 --- a/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs +++ b/ZigbeeApp/Shared/Phone/Device/VideoIntercom/VideoMachine.cs @@ -11,6 +11,9 @@ public VideoMachine() { } + + public static TempPassword tempPassword = null; + public void Show(List<VideoCalss> videoInfosLists) { TopView view = new TopView(); @@ -40,7 +43,7 @@ Width = Application.GetMinRealAverage(81), Height = Application.GetMinRealAverage(81), X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), + Y = Application.GetRealHeight(40), UnSelectedImagePath = "Item/videoIntercom.png", }; fLayout.AddChidren(iconBtn); @@ -105,18 +108,88 @@ eSVideoInfo.RoomName = videoInfos.RoomName; GateWay.Ios.ESVideo.ShowESVideoMonitor(eSVideoInfo); #elif Android - Shared.Phone.VideoPhone.ESVideoInfo eSVideoInfo = new Shared.Phone.VideoPhone.ESVideoInfo(); - eSVideoInfo.DeviceName = videoInfos.DeviceName; - eSVideoInfo.ESVideoUUID = videoInfos.ESVideoUUID; - eSVideoInfo.ESRoomID = videoInfos.ESRoomID; - eSVideoInfo.RoomName = videoInfos.RoomName; - Shared.Phone.VideoPhone.ESVideo.ShowESVideoMonitor(eSVideoInfo); + ((BaseActivity)Application.Activity).AudioRecord((result) => + { + if (result == false) { return; } + Shared.Phone.VideoPhone.ESVideoInfo eSVideoInfo = new Shared.Phone.VideoPhone.ESVideoInfo(); + eSVideoInfo.DeviceName = videoInfos.DeviceName; + eSVideoInfo.ESVideoUUID = videoInfos.ESVideoUUID; + eSVideoInfo.ESRoomID = videoInfos.ESRoomID; + eSVideoInfo.RoomName = videoInfos.RoomName; + Shared.Phone.VideoPhone.ESVideo.ShowESVideoMonitor(eSVideoInfo); + }); #endif }; } + addQRCodeLayout(middle); + } + + private void addQRCodeLayout(VerticalRefreshLayout middle) + { + // + var fLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + + //浜岀淮鐮乮con + var iconBtn = new Button + { + Width = Application.GetMinRealAverage(81), + Height = Application.GetMinRealAverage(81), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(40), + UnSelectedImagePath = "Item/QRCode.png", + }; + fLayout.AddChidren(iconBtn); + + // 鍚嶇О + var nameBtn = new Button + { + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 15, + Y = Application.GetRealHeight(50), + X = Application.GetRealWidth(176), + Height = Application.GetRealHeight(60), + Width = Application.GetRealWidth(400), + Text = "浜岀淮鐮�/涓存椂瀵嗙爜", + }; + fLayout.AddChidren(nameBtn); + + //鍙崇澶� + var nextBtn = new Button + { + Width = Application.GetMinRealAverage(104), + Height = Application.GetMinRealAverage(104), + UnSelectedImagePath = "Item/videoIntercomNext.png", + X = Application.GetRealWidth(743 + 176), + Y = Application.GetRealHeight(30), + }; + fLayout.AddChidren(nextBtn); + + var clickBtn = new Button + { + Height = Application.GetRealHeight(160), + }; + fLayout.AddChidren(clickBtn); + + clickBtn.MouseUpEventHandler += (sen, e) => + { + var qrCode = new TempQRCode(); + UserView.HomePage.Instance.AddChidren(qrCode); + UserView.HomePage.Instance.PageIndex += 1; + qrCode.Show(); + }; + + + middle.AddChidren(fLayout); + } + /// <summary> /// 鍒ゆ柇璐﹀彿鏄惁鏀寔鍙瀵硅 /// </summary> @@ -165,19 +238,21 @@ UserView.HomePage.Instance.AddChidren(videoMachine); UserView.HomePage.Instance.PageIndex += 1; videoMachine.Show(videoList); - + }; } } catch { } } } + /// <summary> /// 鑾峰彇鍙瀵硅鍒楄〃 /// </summary> static async System.Threading.Tasks.Task<List<VideoCalss>> GetVideoInfoList(CloudsVideo clouds) { List<VideoCalss> eSVideoInfosList = new List<VideoCalss>(); + tempPassword = new TempPassword(); var jobject = new JObject(); jobject.Add("cmtID", clouds.FLCommunityID); jobject.Add("unitno", clouds.FLBuildingID); @@ -221,9 +296,57 @@ } eSVideoInfosList.Add(eSVideoInfo); } + + // 鍒濆鍖杢empPassword瀵硅薄 + tempPassword.CommunityID = clouds.FLCommunityID; + tempPassword.FromTime = GetCurrentTimeStamp(); + tempPassword.ValidTime = GetTomorrowTimeStamp(); + tempPassword.Unitno = clouds.FLBuildingID; + tempPassword.Roomno = clouds.FLRoomID; + tempPassword.Code = getCode(); + tempPassword.NumTimes = "5"; + tempPassword.UserKey = clouds.UserKey; + tempPassword.SecretKey= clouds.FLSecretKey; return eSVideoInfosList; } + + /// <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(); + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + return ((long)(DateTime.Now - startTime).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(); + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + return ((long)(DateTime.Now.AddDays(1) - startTime).TotalSeconds).ToString(); // 鐩稿樊绉掓暟 + } + + private static string getCode() + { + Random rand = new Random(); + string code = ""; + for (int ctr = 0; ctr < 6; ctr++) + { + code += rand.Next(10).ToString(); + } + return code; + } } + + public class VideoCalss { /// <summary> @@ -248,6 +371,7 @@ public string RoomName = string.Empty; } + public class CloudsVideo { /// <summary> @@ -273,5 +397,11 @@ public string FLSecretKey = string.Empty; + /// <summary> + /// 涓版灄鍙瀵硅 UserKey + /// </summary> + public string UserKey = string.Empty; + } + } -- Gitblit v1.8.0