From cbc156bc38d8b8eae7aef60cb186ab2b52fa701f Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 16 七月 2024 13:59:56 +0800 Subject: [PATCH] 增加全部挂断 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs | 360 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 188 insertions(+), 172 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs index b20ce5f..5099251 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs @@ -72,17 +72,17 @@ }; faceUnlockView.AddChidren(btnFaceUnlockTipText); - var btnFaceUnlockSwitchIcon = new Button() - { - X = Application.GetRealWidth(322), - Y = Application.GetRealHeight(8), - Width = Application.GetMinRealAverage(36), - Height = Application.GetMinRealAverage(36), - UnSelectedImagePath = "Public/Switch_2.png", - SelectedImagePath = "Public/SwitchOn_2.png", - IsSelected = faceUnlockSwitch, - }; - faceUnlockView.AddChidren(btnFaceUnlockSwitchIcon); + //var btnFaceUnlockSwitchIcon = new Button() + //{ + // X = Application.GetRealWidth(322), + // Y = Application.GetRealHeight(8), + // Width = Application.GetMinRealAverage(36), + // Height = Application.GetMinRealAverage(36), + // UnSelectedImagePath = "Public/Switch_2.png", + // SelectedImagePath = "Public/SwitchOn_2.png", + // IsSelected = faceUnlockSwitch, + //}; + //faceUnlockView.AddChidren(btnFaceUnlockSwitchIcon); @@ -90,61 +90,6 @@ bodyView.AddChidren(waitPage); waitPage.Start(""); - btnFaceUnlockSwitchIcon.MouseUpEventHandler = (sender, e) => - { - waitPage.Start(""); - bool changeState = false; - if (!btnFaceUnlockSwitchIcon.IsSelected) - { - btnFaceUnlockSwitchIcon.IsSelected = true; - changeState = true; - } - new System.Threading.Thread(() => - { - try - { - var pack = ApiUtlis.Ins.HttpRequest.SetFaceUnlockCfg(device.deviceId, changeState, faceUnlockSetup.mode); - if (pack != null && pack.Code == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - //鏇存柊鐣岄潰 - btnFaceUnlockSwitchIcon.IsSelected = changeState; - }); - } - else - { - //澶辫触鎻愮ず - Application.RunOnMainThread(() => - { - if (!string.IsNullOrEmpty(pack.message)) - { - var tip = new Tip() - { - MaxWidth = Application.GetRealWidth(300), - Text = $"{pack.message}({pack.Code})", - CloseTime = 3, - Direction = AMPopTipDirection.None - }; - tip.Show(MainPage.BaseView); - } - }); - } - } - catch (Exception ex) - { - MainPage.Log($"btnFaceUnlockSwitchIcon error : {ex.Message}"); - } - finally - { - Application.RunOnMainThread(() => - { - waitPage.Hide(); - }); - } - }) - { IsBackground = true }.Start(); - }; #endregion contentView.AddChidren(new Button() @@ -153,70 +98,195 @@ BackgroundColor = CSS_Color.BackgroundColor, }); - - #region 瑙﹀彂鏂瑰紡 TriggerMode - var triggerModeView = new FrameLayout() + var view = new VerticalScrolViewLayout() { - Height = Application.GetRealHeight(50), - BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + Height = Application.GetRealHeight(300), }; - contentView.AddChidren(triggerModeView); + contentView.AddChidren(view); - var btnTriggerModeRight = new Button() + + //btnFaceUnlockSwitchIcon.MouseUpEventHandler = (sender, e) => + //{ + // waitPage.Start(""); + // bool changeState = false; + // if (!btnFaceUnlockSwitchIcon.IsSelected) + // { + // btnFaceUnlockSwitchIcon.IsSelected = true; + // changeState = true; + // } + // new System.Threading.Thread(() => + // { + // try + // { + // var pack = ApiUtlis.Ins.HttpRequest.SetFaceUnlockCfg(device.deviceId, changeState, faceUnlockSetup.mode); + // if (pack != null && pack.Code == StateCode.SUCCESS) + // { + // Application.RunOnMainThread(() => + // { + // //鏇存柊鐣岄潰 + // faceUnlockSetup.enabled = btnFaceUnlockSwitchIcon.IsSelected = changeState; + // loadSubView(view, faceUnlockSetup); + // }); + // } + // else + // { + // //澶辫触鎻愮ず + // Application.RunOnMainThread(() => + // { + // if (!string.IsNullOrEmpty(pack.message)) + // { + // if (string.IsNullOrEmpty(pack.message)) + // { + // pack.message = Language.StringByID(StringId.OperationFailed); + // } + // var tip = new Tip() + // { + // MaxWidth = Application.GetRealWidth(300), + // Text = $"{pack.message}({pack.Code})", + // CloseTime = 3, + // Direction = AMPopTipDirection.None + // }; + // tip.Show(MainPage.BaseView); + // } + // }); + // } + // } + // catch (Exception ex) + // { + // MainPage.Log($"btnFaceUnlockSwitchIcon error : {ex.Message}"); + // } + // finally + // { + // Application.RunOnMainThread(() => + // { + // waitPage.Hide(); + // }); + // } + // }) + // { IsBackground = true }.Start(); + //}; + + + //new System.Threading.Thread(() => { + // try + // { + // var pack = ApiUtlis.Ins.HttpRequest.GetFaceUnlockCfg(device.deviceId); + // if (pack != null && pack.Code == StateCode.SUCCESS) + // { + // Application.RunOnMainThread(() => + // { + // //鏇存柊鐣岄潰 + // faceUnlockSetup = Newtonsoft.Json.JsonConvert.DeserializeObject<FaceUnlockSetupObj>(pack.Data.ToString()); + // btnFaceUnlockSwitchIcon.IsSelected = faceUnlockSetup.enabled; + // loadSubView(view, faceUnlockSetup); + // }); + // } + // else + // { + // //澶辫触鎻愮ず + // Application.RunOnMainThread(() => + // { + // if (!string.IsNullOrEmpty(pack.message)) + // { + // if (string.IsNullOrEmpty(pack.message)) + // { + // pack.message = Language.StringByID(StringId.OperationFailed); + // } + // var tip = new Tip() + // { + // MaxWidth = Application.GetRealWidth(300), + // Text = $"{pack.message}({pack.Code})", + // CloseTime = 3, + // Direction = AMPopTipDirection.None + // }; + // tip.Show(MainPage.BaseView); + // } + // }); + // } + // } + // catch (Exception ex) + // { + // MainPage.Log($"UnlockSettingPage error : {ex.Message}"); + // } + // finally + // { + // Application.RunOnMainThread(() => + // { + // waitPage.Hide(); + // }); + // } + + //}) + //{ IsBackground = true }.Start(); + + } + + void loadSubView(VerticalScrolViewLayout view, FaceUnlockSetupObj faceUnlockSetup) + { + view.RemoveAll(); + if (faceUnlockSetup.enabled) { - X = Application.GetRealWidth(339), - Gravity = Gravity.CenterVertical, - Width = Application.GetMinRealAverage(16), - Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/Right.png", - }; - triggerModeView.AddChidren(btnTriggerModeRight); + #region 瑙﹀彂鏂瑰紡 TriggerMode + var triggerModeView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + }; + view.AddChidren(triggerModeView); - var btnTriggerModeStateText = new Button() - { - X = Application.GetRealWidth(100), - Width = Application.GetRealWidth(223), - TextAlignment = TextAlignment.CenterRight, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.PromptingColor1, - }; - triggerModeView.AddChidren(btnTriggerModeStateText); + var btnTriggerModeRight = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + triggerModeView.AddChidren(btnTriggerModeRight); - var btnTriggerModeText = new Button() - { - X = Application.GetRealWidth(16), - TextSize = CSS_FontSize.SubheadingFontSize, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.CenterLeft, - TextID = StringId.TriggerMode, - }; - triggerModeView.AddChidren(btnTriggerModeText); + var btnTriggerModeStateText = new Button() + { + X = Application.GetRealWidth(100), + Width = Application.GetRealWidth(223), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + }; + triggerModeView.AddChidren(btnTriggerModeStateText); + btnTriggerModeStateText.TextID = faceUnlockSetup.mode == 0 ? StringId.AutomaticTriggering : StringId.ManualTriggering; - btnTriggerModeText.MouseUpEventHandler = (sender, e) => - { - var page = new VideoDoorlockFaceUnlockTriggerSettingPage(device, faceUnlockSetup); - MainPage.BasePageView.AddChidren(page); - page.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + var btnTriggerModeText = new Button() + { + X = Application.GetRealWidth(16), + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.TriggerMode, + }; + triggerModeView.AddChidren(btnTriggerModeText); - }; - #endregion + btnTriggerModeText.MouseUpEventHandler = (sender, e) => + { + Action<int> updataAction = (faceUnlockSetupMode) => { + btnTriggerModeStateText.TextID = faceUnlockSetupMode == 0 ? StringId.AutomaticTriggering : StringId.ManualTriggering; + }; + var page = new VideoDoorlockFaceUnlockTriggerSettingPage(device, faceUnlockSetup,updataAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - contentView.AddChidren(new Button() - { - Height = 1, - BackgroundColor = CSS_Color.PromptingColor1, - Gravity = Gravity.CenterHorizontal, - }); + }; + #endregion - + view.AddChidren(new Button { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + } #region 浜鸿劯褰曞叆甯姪 var faceEntryHelpView = new FrameLayout() { Height = Application.GetRealHeight(50), BackgroundColor = CSS.CSS_Color.MainBackgroundColor, }; - contentView.AddChidren(faceEntryHelpView); + view.AddChidren(faceEntryHelpView); var btnFaceEntryHelpRight = new Button() { @@ -228,7 +298,7 @@ }; faceEntryHelpView.AddChidren(btnFaceEntryHelpRight); - + var btnFaceEntryHelpText = new Button() { X = Application.GetRealWidth(16), @@ -239,68 +309,14 @@ }; faceEntryHelpView.AddChidren(btnFaceEntryHelpText); - btnFaceEntryHelpText.MouseUpEventHandler = (sender, e) => { + btnFaceEntryHelpText.MouseUpEventHandler = (sender, e) => + { var page = new VideoDoorlockFaceUnlockHelpPage(); MainPage.BasePageView.AddChidren(page); page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion - - - - - - new System.Threading.Thread(() => { - try - { - var pack = ApiUtlis.Ins.HttpRequest.GetFaceUnlockCfg(device.deviceId); - if (pack != null && pack.Code == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - //鏇存柊鐣岄潰 - faceUnlockSetup = Newtonsoft.Json.JsonConvert.DeserializeObject<FaceUnlockSetupObj>(pack.Data.ToString()); - btnFaceUnlockSwitchIcon.IsSelected = faceUnlockSetup.enabled; - - btnTriggerModeStateText.TextID = faceUnlockSetup.mode == 0 ? StringId.AutomaticTriggering : StringId.ManualTriggering; - }); - } - else - { - //澶辫触鎻愮ず - Application.RunOnMainThread(() => - { - if (!string.IsNullOrEmpty(pack.message)) - { - var tip = new Tip() - { - MaxWidth = Application.GetRealWidth(300), - Text = $"{pack.message}({pack.Code})", - CloseTime = 3, - Direction = AMPopTipDirection.None - }; - tip.Show(MainPage.BaseView); - } - }); - } - - - } - catch (Exception ex) - { - MainPage.Log($"UnlockSettingPage error : {ex.Message}"); - } - finally - { - Application.RunOnMainThread(() => - { - waitPage.Hide(); - }); - } - - }) - { IsBackground = true }.Start(); } @@ -314,7 +330,7 @@ /// <summary> /// 寮�鍏� /// </summary> - public bool enabled; + public bool enabled = true; /// <summary> /// 瑙i攣鏂瑰紡 0-鑷姩 1-鎵嬪姩 /// </summary> -- Gitblit v1.8.0