HDL-ON_Android/Assets/Language.ini
@@ -609,6 +609,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time 2532=Visitor Invitation Record @@ -731,7 +734,7 @@ 1095=Select Date 1096=Generate 1097=Temporary password has been copied 1098=Clear Password? 1098=Do you want to delete the temporary password? 1099=The expire time must be later than the effective time 1100=Unlock Method 1101=It'll synchronize with actual lock, confirm to delete? @@ -1886,7 +1889,9 @@ 622=验收 623=经纬度 624=触发范围 625=住宅解绑 626=住宅解绑之后,住宅将会从你的账号中移除,确定要操作吗? 627=设置的时间需要晚于当前时间 2532=访客邀请记录 @@ -2018,8 +2023,8 @@ 1095=选择日期 1096=生成 1097=临时密码已经复制 1098=清除当前临时密码? 1099=生效时间必须大于失效时间 1098=是否删除临时密码? 1099=生效时间必须早于失效时间 1100=开锁方式管理 1101=删除操作将被同步于实体锁上{0}是否还需要删除? 1102=确认删除 @@ -3163,6 +3168,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time 2532=Visitor Invitation Record @@ -4434,6 +4442,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time @@ -5695,6 +5706,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time HDL-ON_Android/HDL-ON_Android.csproj
@@ -226,6 +226,7 @@ <Compile Include="Zxing\CustomCaptureActivity.cs" /> <Compile Include="Zxing\ScanActivity.cs" /> <Compile Include="LeChengVideo\LeTest.cs" /> <Compile Include="Other\LocationUtils.cs" /> </ItemGroup> <ItemGroup> <AndroidAsset Include="Assets\agconnect-services.json" /> HDL-ON_Android/Other/LocationUtils.cs
New file @@ -0,0 +1,25 @@ using System; using System.Threading.Tasks; using Xamarin.Essentials; namespace HDL_ON_Android { public static class LocationUtils { public static async Task<Location> GetCurrentLocationAsync() { try { var request = new GeolocationRequest(GeolocationAccuracy.Medium); var location = await Geolocation.GetLocationAsync(request); return location; } catch (Exception ex) { // 处理异常 Console.WriteLine($"获取位置信息失败: {ex.Message}"); return null; } } } } HDL-ON_Android/SplashActivity.cs
@@ -252,20 +252,22 @@ HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider"); //Shared.Application.IsGpsEnable = true; bool isfirst = true; //bool isfirst = true; //获取经纬度 Shared.Application.LocationAction = (lon, lat) => { try { if (isfirst) { //只触发一次 //Shared.Application.LocationAction = null; new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", ".")); } isfirst = false; //if (isfirst) //{ // //只触发一次 // //Shared.Application.LocationAction = null; // new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", ".")); //} //isfirst = false; ///监听经纬度 HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.Current.AppLatAndLonEvent(lon, lat); //关闭定位服务 @@ -279,6 +281,8 @@ }; } /// <summary> /// /// </summary> HDL-ON_iOS/Resources/Language.ini
@@ -609,6 +609,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time 2532=Visitor Invitation Record @@ -731,7 +734,7 @@ 1095=Select Date 1096=Generate 1097=Temporary password has been copied 1098=Clear Password? 1098=Do you want to delete the temporary password? 1099=The expire time must be later than the effective time 1100=Unlock Method 1101=It'll synchronize with actual lock, confirm to delete? @@ -1886,7 +1889,9 @@ 622=验收 623=经纬度 624=触发范围 625=住宅解绑 626=住宅解绑之后,住宅将会从你的账号中移除,确定要操作吗? 627=设置的时间需要晚于当前时间 2532=访客邀请记录 @@ -2018,8 +2023,8 @@ 1095=选择日期 1096=生成 1097=临时密码已经复制 1098=清除当前临时密码? 1099=生效时间必须大于失效时间 1098=是否删除临时密码? 1099=生效时间必须早于失效时间 1100=开锁方式管理 1101=删除操作将被同步于实体锁上{0}是否还需要删除? 1102=确认删除 @@ -3163,6 +3168,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time 2532=Visitor Invitation Record @@ -4434,6 +4442,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time @@ -5695,6 +5706,9 @@ 622=ACCEPTANCE 623=Latitude and longitude 624=Triggered range 625=Residential unbound 626=After unbinding the residence, the residence will be removed from your account. Are you sure you want to proceed? 627=The set time needs to be later than the current time HDL-ON_iOS/ViewController.cs
@@ -26,7 +26,7 @@ { base.ViewDidLoad(); HDL_ON.MainPage.Show(); HDL_ON.MainPage.ShowAsync(); try { HDL_ON/Common/R.cs
@@ -5,6 +5,18 @@ public static class StringId { /// <summary> /// 设置的时间需要晚于当前时间 /// </summary> public const int TempPwdSettingTip = 627; /// <summary> /// 住宅回滚提示 /// </summary> public const int RollBackTipMsg = 626; /// <summary> /// 住宅回滚 /// </summary> public const int RollBack = 625; /// <summary> /// 触发范围 /// </summary> public const int TriggeredRange = 624; HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -708,7 +708,21 @@ var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.APi_Post_GetHoserDeliverUrl, jsonString); return revertObj; } /// <summary> /// 住宅交付回滚 /// </summary> /// <returns></returns> public ResponsePackNew RollBack() { var d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("communityId", DB_ResidenceData.Instance.CurrentRegion.communityId); d.Add("flowRecordContent", "onPro交付回滚"); d.Add("projectFlowRecordActionEnum", "DELIVERY_ROLLBACK"); var jsonString = HttpUtil.GetSignRequestJson(d); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.APi_Post_UpdateProjectDebugStatus, jsonString); return revertObj; } /// <summary> /// 获取网关信息 @@ -1542,6 +1556,7 @@ MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString(); MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString(); MainPage.CityWeatherAction?.Invoke(); HDL_ON.UI.HomePage.LoadEvent_RefreshAir(); break; } catch (Exception ex) @@ -1551,14 +1566,6 @@ } System.Threading.Thread.Sleep(5000); } Shared.Application.RunOnMainThread(() => { try { HDL_ON.UI.HomePage.LoadEvent_RefreshAir(); } catch { } }); }); } ///// <summary> @@ -3044,8 +3051,49 @@ //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); return listSortLog; } /// <summary> /// 获取门锁临时密码 /// </summary> /// <param name="deviceId"></param> /// <returns></returns> public ResponsePackNew GetDoorTempPassword(string deviceId) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", deviceId); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetTempPasswrod, requestJson); } /// <summary> /// 创建门锁临时密码 /// </summary> /// <param name="deviceId"></param> /// <returns></returns> public ResponsePackNew CreateDoorTempPassword(string deviceId,string beginTime,string endTime) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", deviceId); d.Add("beginTime", beginTime); d.Add("endTime", endTime); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CreateTempPasswrod, requestJson); } /// <summary> /// 删除门锁临时密码 /// </summary> /// <returns></returns> public ResponsePackNew DelDoorTempPassword(string deviceId, string pwdId) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceId", deviceId); d.Add("pwdId", pwdId); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DelTempPasswrod, requestJson); } #endregion #endregion #region ■ 音箱语言控制相关_________________________ /// <summary> HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@ /// 固定域名,正式环境 /// 公共域名就近解析 /// </summary> public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; const string APP_KEY = "HDL-HOME-APP-TEST"; const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm HDL_ON/DAL/Server/NewAPI.cs
@@ -114,7 +114,10 @@ /// 获取住宅交付链接 /// </summary> public const string APi_Post_GetHoserDeliverUrl = "/home-wisdom/app/home/obtainDeliveryUrl"; /// <summary> /// 更新项目状态 (交付、验收、撤销交付、验收未通过、重新调试、交付回滚等操作) /// </summary> public const string APi_Post_UpdateProjectDebugStatus = "/smart-footstone/mgmt/community/project/updateProjectDebugStatus"; /// <summary> /// 获取住宅分页 /// </summary> @@ -881,6 +884,19 @@ /// 门锁的历史记录 /// </summary> public const string API_POST_DoorHistory = "/home-wisdom/app/device/door/logs"; /// <summary> /// 获取临时密码 /// </summary> public const string Api_Post_GetTempPasswrod = "/home-wisdom/app/device/door/getTempPwds"; /// <summary> /// 创建临时密码 /// </summary> public const string Api_Post_CreateTempPasswrod = "/home-wisdom/app/device/door/createTempPwd"; /// <summary> /// 删除门锁临时密码 /// </summary> public const string Api_Post_DelTempPasswrod = "/home-wisdom/app/device/door/tempPwdDel"; #endregion HDL_ON/Entity/ResponseEntity/RegionInfoRes.cs
@@ -56,6 +56,10 @@ /// </summary> public string id { get; set; } /// <summary> /// 项目id /// </summary> public string communityId = string.Empty; /// <summary> /// 住宅名称 /// </summary> public string homeName { get; set; } HDL_ON/UI/MainPage.cs
@@ -219,6 +219,37 @@ { } #if __ANDROID__ new System.Threading.Thread(async () => { int i = 0; while (i < 10) { try { var location_android = await HDL_ON_Android.LocationUtils.GetCurrentLocationAsync(); if (location_android != null) { MainPage.cityInfo.lat = location_android.Latitude.ToString(); MainPage.cityInfo.lon = location_android.Longitude.ToString(); new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(MainPage.cityInfo.lon.Replace(",", "."), MainPage.cityInfo.lat.ToString().Replace(",", ".")); i = 100; Application.RunOnMainThread(() => { HomePage.LoadEvent_RefreshAir(); }); } else { i++; } } catch (Exception ex) { Log($"经纬度获取异常: {ex.Message}"); } } }) { IsBackground = true }.Start(); #endif } /// <summary> HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -247,9 +247,10 @@ Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().RefreshDeviceList(); } //跳转大华摄像头 Shared.Application.currentVC.NavigationController.NavigationBar.BarTintColor = UIKit.UIColor.LightGray; Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().RefreshDeviceList(); Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().ToMonitorViewWithDeviceId(function.extDevId, function.name, Shared.Application.currentVC); Shared.Application.currentVC.NavigationController.NavigationBar.Hidden = false; //Shared.Application.currentVC.NavigationController.NavigationBar.Hidden = false; #else FunctionList.List.GetIpCamImouList(); if (string.IsNullOrEmpty(Com.Utils.HdlToLcUtils.Instance.SubAccessToken)) HDL_ON/UI/UI0-Stan/Controls/BottomControls/BottomTimeSelectControl.cs
@@ -95,7 +95,7 @@ //初始化底层控件 var frameWhiteBack = base.InitBaseControl(); frameWhiteBack.Height = Application.GetRealHeight(contentView); //frameWhiteBack.Y = frameWhiteBack.Parent.Height - Application.GetRealHeight(297 + 20); //frameWhiteBack.Y = Application.GetRealHeight(667 - contentView + 60); //取消 base.btnCancel.ButtonClickEvent += (sender, e) => HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs
@@ -115,8 +115,15 @@ } catch (Exception ex) { //出现未知错误 HdlMessageLogic.Current.ShowAppProgramIsError(ex); if (ex.Message == "stop") { //自定义中断关闭页面,召元写的太复杂,只能用这种方式强行中断方法运行 2023-06-01 09:22:46 } else { //出现未知错误 HdlMessageLogic.Current.ShowAppProgramIsError(ex); } } } HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/ResidentialManagePage.cs
@@ -1,4 +1,5 @@ using System; using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -554,26 +555,94 @@ switch (DB_ResidenceData.Instance.CurrentRegion.deliverStatus) { case "To_Be_Debugged"://待调试 btnHouseStatusTipTitle.Text += Language.StringByID(StringId.To_Be_Debugged); btnHouseStatusTipTitle.Text += " : "+ Language.StringByID(StringId.To_Be_Debugged); break; case "Debugging"://调试中 btnHouseStatusTipTitle.Text += Language.StringByID(StringId.Debugging); btnHouseStatusTipTitle.Text += " : " + Language.StringByID(StringId.Debugging); break; case "INITIAL_TATE"://初始态 btnHouseStatusTipTitle.Text += Language.StringByID(StringId.INITIAL_TATE); btnHouseStatusTipTitle.Text += " : " + Language.StringByID(StringId.INITIAL_TATE); break; case "ACCEPTANCE"://验收 btnHouseStatusTipTitle.Text += Language.StringByID(StringId.ACCEPTANCE); btnHouseStatusTipTitle.Text += " : " + Language.StringByID(StringId.ACCEPTANCE); var btnRollBack = new Button() { Y = Application.GetRealHeight(623), Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.AuxiliaryColor2, TextID = StringId.RollBack, BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(btnRollBack); if (MainPage.Increase) { btnRollBack.Y = Application.GetRealHeight(613); btnRollBack.Height = Application.GetRealHeight(50); bodyView.AddChidren(new Button() { Y = Application.GetRealHeight(663), Height = Application.GetRealHeight(20), BackgroundColor = CSS_Color.MainBackgroundColor }); } btnRollBack.MouseUpEventHandler += (sender, e) => { Action okAction = () => { var waitPage = new Loading(); this.AddChidren(waitPage); waitPage.Start(""); new System.Threading.Thread(() => { try { var pack = Common.ApiUtlis.Ins.HttpRequest.RollBack(); Application.RunOnMainThread(() => { if (pack != null) { if (pack.Code == StateCode.SUCCESS) { Common.ApiUtlis.Ins.HttpRequest.GetHomePager(); } else { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } } }); } catch (Exception ex) { MainPage.Log($"住宅回滚异常:{ex.Message}"); } finally { Application.RunOnMainThread(() => { try { waitPage.Hide(); waitPage.RemoveFromParent(); waitPage = null; } catch { } }); } }) { IsBackground = true }.Start(); }; new ConfirmDialog().ShowDialog(StringId.Tip, StringId.RollBackTipMsg, okAction); }; break; case "To_Be_Accepted"://待验收 btnHouseStatusTipTitle.Text += Language.StringByID(StringId.To_Be_Accepted); btnHouseStatusTipTitle.Text += " : " + Language.StringByID(StringId.To_Be_Accepted); break; default: btnHouseStatusTipTitle.Text += Language.StringByID(StringId.INITIAL_TATE); btnHouseStatusTipTitle.Text += " : " + Language.StringByID(StringId.INITIAL_TATE); break; } #endregion HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockPage.cs
@@ -6,6 +6,7 @@ using HDL_ON.UI.CSS; using HDL_ON.Entity; using HDL_ON.DriverLayer; using HDL_ON.DAL.Server; namespace HDL_ON.UI { @@ -73,6 +74,8 @@ /// </summary> private Dictionary<string, string> dicText = new Dictionary<string, string>(); #endregion #region ■ 初始化_____________________________ @@ -117,6 +120,48 @@ this.RefreshFormStatu(); //读取设备状态 Control.Ins.SendReadCommand(device); // 获取临时密码 GetTempPwd(); } /// <summary> /// 获取临时密码 /// </summary> private void GetTempPwd() { return; new System.Threading.Thread(() => { try { var pack = Common.ApiUtlis.Ins.HttpRequest.GetDoorTempPassword(device.deviceId); if (pack != null) { Application.RunOnMainThread(() => { if (pack.Code == StateCode.SUCCESS) { var tempPasswrodObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DoorTempPassword>>(pack.Data.ToString()); if (tempPasswrodObj.Count > 0) { doorLockData.TempPassword = tempPasswrodObj[0].pwd; doorLockData.StartTimeTick = tempPasswrodObj[0].beginTime; doorLockData.EndTimeTick = tempPasswrodObj[0].endTime; doorLockData.PwdId = tempPasswrodObj[0].pwdId; this.InitTempPasswordControl(); } } }); } } catch (Exception ex) { MainPage.Log($"获取临时密码异常:{ex.Message}"); } }) { IsBackground = true }.Start(); } /// <summary> @@ -185,37 +230,43 @@ frameTempPsw.Visible = false; FrameWhiteCentet1.AddChidren(frameTempPsw); ////声音 //this.btnVoice = new IconViewControl(24); //btnVoice.UnSelectedImagePath = "FunctionIcon/DoorLock/Voice.png"; //btnVoice.X = Application.GetRealWidth(23); //btnVoice.Y = Application.GetRealHeight(410); //FrameWhiteCentet1.AddChidren(btnVoice); //声音 this.btnVoice = new IconViewControl(24); btnVoice.UnSelectedImagePath = "FunctionIcon/DoorLock/Voice.png"; btnVoice.X = Application.GetRealWidth(23); btnVoice.Y = Application.GetRealHeight(410); FrameWhiteCentet1.AddChidren(btnVoice); ////声音的滑动条 //this.seekBarVoiceControl = new SeekBarImageControl(215); //seekBarVoiceControl.Gravity = Gravity.CenterHorizontal; //FrameWhiteCentet1.AddChidren(seekBarVoiceControl); //seekBarVoiceControl.Y = btnVoice.Y - (seekBarVoiceControl.Height - btnVoice.Height) / 2; ////绑定PageLayout控件 //seekBarVoiceControl.BindPageLayout(); //声音的滑动条 this.seekBarVoiceControl = new SeekBarImageControl(215); seekBarVoiceControl.Gravity = Gravity.CenterHorizontal; FrameWhiteCentet1.AddChidren(seekBarVoiceControl); seekBarVoiceControl.Y = btnVoice.Y - (seekBarVoiceControl.Height - btnVoice.Height) / 2; //绑定PageLayout控件 seekBarVoiceControl.BindPageLayout(); ////声音百分比 //this.btnVoicePersent = new NormalViewControl(Application.GetRealWidth(50), btnVoice.Height, false); //btnVoicePersent.X = seekBarVoiceControl.Right + Application.GetRealWidth(8) - seekBarVoiceControl.SeekBarPadding; //btnVoicePersent.Y = btnVoice.Y; //btnVoicePersent.TextColor = CSS_Color.PromptingColor1; //btnVoicePersent.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; //btnVoicePersent.Text = "100%"; //FrameWhiteCentet1.AddChidren(btnVoicePersent); //声音百分比 this.btnVoicePersent = new NormalViewControl(Application.GetRealWidth(50), btnVoice.Height, false); btnVoicePersent.X = seekBarVoiceControl.Right + Application.GetRealWidth(8) - seekBarVoiceControl.SeekBarPadding; btnVoicePersent.Y = btnVoice.Y; btnVoicePersent.TextColor = CSS_Color.PromptingColor1; btnVoicePersent.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnVoicePersent.Text = "100%"; FrameWhiteCentet1.AddChidren(btnVoicePersent); //seekBarVoiceControl.ProgressChangedEvent += (div, value) => //{ // btnVoicePersent.Text = value + "%"; // if (div == 1) // { // } //}; seekBarVoiceControl.ProgressChangedEvent += (div, value) => { btnVoicePersent.Text = value + "%"; //if (div == 1) //{ //} }; seekBarVoiceControl.OnStopTrackingTouchEvent = (sender, e) => { var dic = new Dictionary<string, string>(); dic.Add("door_volume", e.ToString()); Control.Ins.SendWriteCommand(this.device, dic); }; //初始化开锁菜单(一键开锁,临时密码开锁) this.InitUnLockMenuControl(); @@ -229,7 +280,7 @@ private void InitUnLockMenuControl() { //如果是成员,则只有一键开锁 if (true)// DB_ResidenceData.Instance.CurrentRegion.isOtherShare == true) if ( DB_ResidenceData.Instance.CurrentRegion.isOtherShare == true) { //一键开锁 var btnOneKey = new NormalViewControl(100, 25, true); @@ -556,32 +607,34 @@ this.frameTempPsw.AddChidren(btnDelete); btnDelete.ButtonClickEvent += (sender, e) => { //清除当前临时密码? HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.ClearTempPsswordMsg), () => if (Convert.ToInt64(this.doorLockData.EndTimeTick) < DateTime.Now.Ticks) { //清空临时密码 this.doorLockData.TempPassword = string.Empty; this.doorLockData.StatrtTime = string.Empty; this.doorLockData.EndTime = string.Empty; //重新初始化临时密码控件 this.InitTempPasswordControl(); }); DelTempPwd(); } else { //清除当前临时密码? HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.ClearTempPsswordMsg), () => { DelTempPwd(); }); } }; //复制临时密码图标 var btnCopy = new IconViewControl(28); btnCopy.UnSelectedImagePath = "FunctionIcon/DoorLock/Shard.png"; btnCopy.X = this.frameTempPsw.Width - btnCopy.IconSize - btnDelete.X; btnCopy.Y = btnDelete.Y; this.frameTempPsw.AddChidren(btnCopy); btnCopy.ButtonClickEvent += (sender, e) => { //临时密码已经复制 HdlCommonLogic.Current.SetTextToShearPlate(this.doorLockData.TempPassword, Language.StringByID(StringId.TempPsswordHasBeenCopy)); }; ////复制临时密码图标 //var btnCopy = new IconViewControl(28); //btnCopy.UnSelectedImagePath = "FunctionIcon/DoorLock/Shard.png"; //btnCopy.X = this.frameTempPsw.Width - btnCopy.IconSize - btnDelete.X; //btnCopy.Y = btnDelete.Y; //this.frameTempPsw.AddChidren(btnCopy); //btnCopy.ButtonClickEvent += (sender, e) => //{ // //临时密码已经复制 // HdlCommonLogic.Current.SetTextToShearPlate(this.doorLockData.TempPassword, Language.StringByID(StringId.TempPsswordHasBeenCopy)); //}; //生效时间 var frameEffective = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.EffectiveTime), this.doorLockData.StatrtTime); var frameEffective = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.EffectiveTime), this.doorLockData.StartTime); frameEffective.X = Application.GetRealWidth(24); frameEffective.Y = Application.GetRealHeight(180); @@ -600,6 +653,61 @@ btnLine.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; this.frameTempPsw.AddChidren(btnLine); } } /// <summary> /// 删除临时密码 /// </summary> private void DelTempPwd() { var waitPage = new Loading(); this.AddChidren(waitPage); waitPage.Start(""); new System.Threading.Thread(() => { try { var pack = Common.ApiUtlis.Ins.HttpRequest.DelDoorTempPassword(device.deviceId, doorLockData.PwdId); if (pack != null) { Application.RunOnMainThread(() => { if (pack.Code == StateCode.SUCCESS) { //清空临时密码 this.doorLockData.TempPassword = string.Empty; this.doorLockData.StartTimeTick = string.Empty; this.doorLockData.EndTimeTick = string.Empty; this.doorLockData.PwdId = string.Empty; //重新初始化临时密码控件 this.InitTempPasswordControl(); } else { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } }); } } catch (Exception ex) { MainPage.Log($"删除门锁临时密码异常: {ex.Message}"); } finally { Application.RunOnMainThread(() => { try { waitPage.Hide(); waitPage.RemoveFromParent(); waitPage = null; } catch { } }); } }) { IsBackground = true }.Start(); } /// <summary> @@ -657,12 +765,13 @@ //生效时间 var effectiveTime = Language.StringByID(StringId.EffectiveTime); contr.AddRowMenu(effectiveTime, startTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) => contr.AddRowMenu(effectiveTime + ": " + startTime.ToString("yyyy.MM.dd HH:mm"),"", (btnView, btnValue) => { //关掉界面,然后重新调起来 contr.Close(); var form = new DoorLockSelectTimePage(); form.TimeCheck = true; form.AddForm(startTime); form.SelectFinshEvent += (selectTime) => { @@ -673,12 +782,13 @@ //失效时间 var failTime = Language.StringByID(StringId.FailureTime); contr.AddRowMenu(failTime, endTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) => contr.AddRowMenu(failTime+": "+ endTime.ToString("yyyy.MM.dd HH:mm"),"", (btnView, btnValue) => { //关掉界面,然后重新调起来 contr.Close(); var form = new DoorLockSelectTimePage(); form.TimeCheck = true; form.AddForm(endTime); form.SelectFinshEvent += (selectTime) => { @@ -698,12 +808,32 @@ //关掉界面 contr.Close(); //生成临时密码 this.doorLockData.TempPassword = "987654"; this.doorLockData.StatrtTime = startTime.ToString("yyyy.MM.dd HH:mm"); this.doorLockData.EndTime = endTime.ToString("yyyy.MM.dd HH:mm"); //重新初始化临时密码控件 this.InitTempPasswordControl(); new System.Threading.Thread(() => { var pack = Common.ApiUtlis.Ins.HttpRequest.CreateDoorTempPassword(device.deviceId, Utlis.DateTimeToUnix(startTime).ToString(), Utlis.DateTimeToUnix(endTime).ToString()); if (pack != null) { if (pack.Code == StateCode.SUCCESS) { // 获取临时密码 GetTempPwd(); } else { Application.RunOnMainThread(() => { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); }); } } }) { IsBackground = true }.Start(); ////生成临时密码 //this.doorLockData.TempPassword = "987654"; //this.doorLockData.StatrtTime = startTime.ToString("yyyy.MM.dd HH:mm"); //this.doorLockData.EndTime = endTime.ToString("yyyy.MM.dd HH:mm"); ////重新初始化临时密码控件 //this.InitTempPasswordControl(); } }; @@ -1001,7 +1131,7 @@ } } //音量 else if (data.key == "volume") else if (data.key == "door_volume") { var value = data.state; if (value != string.Empty) @@ -1065,13 +1195,62 @@ /// <summary> /// 临时密码生效时间(2020.03.17 13:27) /// </summary> public string StatrtTime = string.Empty; public string StartTime { get { try { if(string.IsNullOrEmpty(StartTimeTick)) { return string.Empty; } return Utlis.UnixToDateTime(Convert.ToInt64(StartTimeTick)).ToString("yyyy.MM.dd HH:mm"); }catch(Exception ex) { MainPage.Log($"临时密码生效时间转换异常: {ex.Message}"); return string.Empty; } } } public string StartTimeTick = string.Empty; /// <summary> /// 临时密码失效时间(2020.03.17 13:27) /// </summary> public string EndTime = string.Empty; public string EndTime { get { try { if (string.IsNullOrEmpty(EndTimeTick)) { return string.Empty; } return Utlis.UnixToDateTime(Convert.ToInt64(EndTimeTick)).ToString("yyyy.MM.dd HH:mm"); } catch (Exception ex) { MainPage.Log($"临时密码生效时间转换异常: {ex.Message}"); return string.Empty; } } } public string EndTimeTick = string.Empty; /// <summary> /// 临时密码id /// </summary> public string PwdId = string.Empty; } /// <summary> /// 门锁临时密码 /// </summary> private class DoorTempPassword { public string pwdId = string.Empty; public string pwd = string.Empty; public string beginTime = string.Empty; public string endTime = string.Empty; } #endregion } } HDL_ON/UI/UI2/FuntionControlView/DoorLock/DoorLockSelectTimePage.cs
@@ -22,6 +22,12 @@ /// 选择的时间 /// </summary> private DateTime selectDateTime; /// <summary> /// 时间校验 /// 是否需要校验时间大于当前时间 /// </summary> public bool TimeCheck = false; #endregion @@ -51,18 +57,44 @@ this.ClearBodyFrame(); //选择日期 var rowDate = new RowLayoutControl(); var rowDate = new FrameLayout() { Height = Application.GetRealHeight(50), }; rowDate.BackgroundColor = CSS_Color.MainBackgroundColor; bodyFrameLayout.AddChidren(rowDate); rowDate.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectDate), 300); rowDate.frameTable.AddRightArrow(); rowDate.frameTable.AddBottomLine(); var btnDay = rowDate.frameTable.AddMostRightView(this.selectDateTime.ToString("yyyy.MM.dd"), 300); rowDate.frameTable.ButtonClickEvent += (sender, e) => var btnDateLeft = new Button() { TextID = StringId.SelectDate, TextAlignment = TextAlignment.CenterLeft, Width = Application.GetRealWidth(300), X = Application.GetRealWidth(16), TextColor = CSS_Color.FirstLevelTitleColor, }; rowDate.AddChidren(btnDateLeft); var btnDateRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; rowDate.AddChidren(btnDateRight); rowDate.AddChidren(new Button() { X = Application.GetRealWidth(16),Y = Application.GetRealHeight(49), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); var btnDay = new Button() { Width = Application.GetRealWidth(327), TextAlignment = TextAlignment.CenterRight, Text = selectDateTime.ToString("yyyy.MM.dd"), TextColor = CSS_Color.FirstLevelTitleColor, }; rowDate.AddChidren(btnDay); EventHandler<MouseEventArgs> dateEvent = (sender, e) => { //显示日期选择的底部弹窗 var contr = new BottomDateSelectControl(); contr.InitControl(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, 1, 1); contr.InitControl(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, 0, 1); contr.FinishEvent += (div, year, month, day) => { //覆盖时间 @@ -73,21 +105,50 @@ } }; }; btnDateLeft.MouseUpEventHandler = dateEvent; btnDateRight.MouseUpEventHandler = dateEvent; btnDay.MouseUpEventHandler = dateEvent; //选择时间 var rowTime = new RowLayoutControl(); rowTime.Y = rowDate.Bottom; rowTime.BackgroundColor = CSS_Color.MainBackgroundColor; var rowTime = new FrameLayout() { Y = rowDate.Bottom, Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyFrameLayout.AddChidren(rowTime); rowTime.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectTime), 300); rowTime.frameTable.AddRightArrow(); var btnTime = rowTime.frameTable.AddMostRightView(this.selectDateTime.ToString("HH:mm"), 300); rowTime.frameTable.ButtonClickEvent += (sender, e) => rowTime.AddChidren(new Button() { X = Application.GetRealWidth(16),Y = Application.GetRealHeight(49), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); var btnTimeLeft = new Button() { TextID = StringId.SelectTime, TextAlignment = TextAlignment.CenterLeft, Width = Application.GetRealWidth(300), X = Application.GetRealWidth(16), TextColor = CSS_Color.FirstLevelTitleColor, }; rowTime.AddChidren(btnTimeLeft); var btnTimeRight = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; rowTime.AddChidren(btnTimeRight); var btnTime = new Button() { Width = Application.GetRealWidth(327), TextAlignment = TextAlignment.CenterRight, Text = selectDateTime.ToString("HH:mm"), TextColor = CSS_Color.FirstLevelTitleColor, }; rowTime.AddChidren(btnTime); EventHandler<MouseEventArgs> timeEvent = (sender, e) => { //显示日期选择的底部弹窗 var contr = new BottomTimeSelectControl(); contr.RowCount = 5; contr.InitControl(this.selectDateTime.Hour, this.selectDateTime.Minute, -1); contr.RowCount = 4; contr.InitControl(this.selectDateTime.Hour, this.selectDateTime.Minute,250); contr.FinishEvent += (div, hour, minute) => { //覆盖时间 @@ -98,6 +159,9 @@ } }; }; btnTimeLeft.MouseUpEventHandler = timeEvent; btnTimeRight.MouseUpEventHandler = timeEvent; btnTime.MouseUpEventHandler = timeEvent; } #endregion @@ -109,6 +173,14 @@ /// </summary> public override void CloseFormBefore() { if (TimeCheck) { if (DateTime.Now > this.selectDateTime) { new PublicAssmebly().TipMsg(StringId.Tip, StringId.TempPwdSettingTip); throw new Exception("stop"); } } base.CloseFormBefore(); //调用回调事件 this.SelectFinshEvent?.Invoke(this.selectDateTime); HDL_ON/UI/UI2/FuntionControlView/Music/View/PlayView.cs
@@ -214,7 +214,6 @@ SeekBarViewHeight = Application.GetRealWidth(8),//进度条的高度 ProgressChangeDelayTime = 300,//0.3秒发送一次 SeekBarPadding = Application.GetRealWidth(20), }; /// <summary>