| | |
| | | public VideoMachine() |
| | | { |
| | | } |
| | | |
| | | public static TempPassword tempPassword = null; |
| | | |
| | | public void Show(List<VideoCalss> videoInfosLists) |
| | | { |
| | | TopView view = new TopView(); |
| | |
| | | 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); |
| | |
| | | |
| | | } |
| | | |
| | | addQRCodeLayout(middle); |
| | | |
| | | } |
| | | |
| | | private void addQRCodeLayout(VerticalRefreshLayout middle) |
| | | { |
| | | // |
| | | var fLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | |
| | | //二维码icon |
| | | 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> |
| | |
| | | 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); |
| | |
| | | } |
| | | eSVideoInfosList.Add(eSVideoInfo); |
| | | } |
| | | |
| | | // 初始化tempPassword对象 |
| | | 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> |
| | |
| | | public string RoomName = string.Empty; |
| | | |
| | | } |
| | | |
| | | public class CloudsVideo |
| | | { |
| | | /// <summary> |
| | |
| | | |
| | | public string FLSecretKey = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 丰林可视对讲 UserKey |
| | | /// </summary> |
| | | public string UserKey = string.Empty; |
| | | |
| | | } |
| | | |
| | | } |