From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 02 九月 2020 17:35:03 +0800 Subject: [PATCH] 2020-09-02-4 --- ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs | 513 ++++++++++++++++++++------------------------------------ 1 files changed, 187 insertions(+), 326 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs old mode 100644 new mode 100755 index c30b73a..ff9e8ec --- a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs @@ -20,228 +20,130 @@ public void Show() { - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren(new Button - { - Height = Application.GetRealHeight(80), - }); - var topFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(140), - Y = Application.GetRealHeight(80), - }; - AddChidren(topFrameLayout); + #region 鏈�涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.securitymode; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + #endregion - var titleName = new Button - { - TextID = MyInternationalizationString.securitymode, - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - topFrameLayout.AddChidren(titleName); - - var back = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - X = Application.GetRealWidth(20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - - var middle = new VerticalScrolViewLayout(); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight(1920 - 220); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + var middle = new FrameLayout(); + middle.Y = view.topRowLayout.Bottom; + middle.Height = Application.GetRealHeight(Method.H - 184); + middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; this.AddChidren(middle); - if (actionsInfo.ContainsKey("LinkType")) - { - actionsInfo.Remove("LinkType"); - } - if (actionsInfo.ContainsKey("SecurityModeId")) - { - actionsInfo.Remove("SecurityModeId"); - } - if (actionsInfo.ContainsKey("CheckIASStatus")) - { - actionsInfo.Remove("CheckIASStatus"); - } - if (actionsInfo.ContainsKey("IsDelayStart")) - { - actionsInfo.Remove("IsDelayStart"); - } - - actionsInfo.Add("LinkType", 6); - actionsInfo.Add("SecurityModeId", 0); - actionsInfo.Add("CheckIASStatus", 0); - actionsInfo.Add("IsDelayStart", 0); - + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + saveView.frameLayout.Y = middle.Height - Application.GetRealHeight(260); + middle.AddChidren(saveView.Show()); - #region ----甯冮槻 鎾ら槻 鑳佽揩鎾ら槻---- - var defenceRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(defenceRowLayout); - var btndefence = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.defence, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text="甯冮槻", - }; - defenceRowLayout.AddChidren(btndefence); - var defenceSelected = new Button - { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - defenceRowLayout.AddChidren(defenceSelected); + #region ----(鍦ㄥ/绂诲)甯冮槻 鎾ら槻 鑳佽揩鎾ら槻---- + #region 鍦ㄥ甯冮槻 - var withdrawalRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(withdrawalRowLayout); + FunView athomeView = new FunView(); + athomeView.iconBtn.UnSelectedImagePath = "ZigeeLogic/athome.png"; + athomeView.funnameBtn.TextID = MyInternationalizationString.logicathomegarrison; + athomeView.funnextBtn.Width = Application.GetMinRealAverage(60); + athomeView.funnextBtn.Height = Application.GetMinRealAverage(60); + athomeView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; + athomeView.funnextBtn.Visible = false; + middle.AddChidren(athomeView.FunFrameView()); - var btnwithdrawal = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.withdrawal, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text = "鎾ら槻", - }; - withdrawalRowLayout.AddChidren(btnwithdrawal); - var withdrawalSelected = new Button - { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - withdrawalRowLayout.AddChidren(withdrawalSelected); - - var urgentwithdrawalRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(urgentwithdrawalRowLayout); - - var btnurgentwithdrawal = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.urgentwithdrawal, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text = "鑳佽揩鎾ら槻", - }; - urgentwithdrawalRowLayout.AddChidren(btnurgentwithdrawal); - - var urgentwithdrawalSelected = new Button - { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - urgentwithdrawalRowLayout.AddChidren(urgentwithdrawalSelected); #endregion - string strvalue = ""; - ///甯冮槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> copenclick = (seder, e) => - { - defenceSelected.Visible = true; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; - SecurityView(strvalue); + #region 绂诲甯冮槻 + + FunView leaveView= new FunView(); + leaveView.funFrameLayout.Y = athomeView.funFrameLayout.Bottom; + leaveView.iconBtn.UnSelectedImagePath = "ZigeeLogic/leavehome.png"; + leaveView.funnameBtn.TextID = MyInternationalizationString.logicremovehomegarrison; + leaveView.funnextBtn.Width = Application.GetMinRealAverage(60); + leaveView.funnextBtn.Height = Application.GetMinRealAverage(60); + leaveView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; + leaveView.funnextBtn.Visible = false; + middle.AddChidren(leaveView.FunFrameView()); + + + #endregion + + #region 鎾ら槻 + + FunView withdrawalView= new FunView(); + withdrawalView.funFrameLayout.Y = leaveView.funFrameLayout.Bottom; + withdrawalView.iconBtn.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; + withdrawalView.funnameBtn.TextID = MyInternationalizationString.withdrawal; + withdrawalView.funnextBtn.Width = Application.GetMinRealAverage(60); + withdrawalView.funnextBtn.Height = Application.GetMinRealAverage(60); + withdrawalView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; + withdrawalView.funnextBtn.Visible = false; + middle.AddChidren(withdrawalView.FunFrameView()); + + #endregion + + #region 鑳佽揩鎾ら槻 + + FunView urgentwithdView = new FunView(); + urgentwithdView.funFrameLayout.Y = withdrawalView.funFrameLayout.Bottom; + urgentwithdView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//鏈�鍚庝竴琛屽鍔�20楂樺害; + urgentwithdView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///鏀瑰彉鏈�鍚庡姛鑳藉揩绾挎潯棰滆壊 + urgentwithdView.iconBtn.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; + urgentwithdView.funnameBtn.TextID = MyInternationalizationString.urgentwithdrawal; + urgentwithdView.funnextBtn.Width = Application.GetMinRealAverage(60); + urgentwithdView.funnextBtn.Height = Application.GetMinRealAverage(60); + urgentwithdView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; + urgentwithdView.funnextBtn.Visible = false; + middle.AddChidren(urgentwithdView.FunFrameView()); + #endregion + + #endregion + + ///鍦ㄥ甯冮槻鐐瑰嚮浜嬩欢 + athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + athomeView.funnextBtn.Visible = true; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = false; }; - btndefence.MouseUpEventHandler += copenclick; - defenceRowLayout.MouseUpEventHandler += copenclick; + + + ///绂诲甯冮槻鐐瑰嚮浜嬩欢 + leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = true; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = false; + }; ///鎾ら槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> disableclick = (seder, e) => + withdrawalView.clickviewBtn.MouseUpEventHandler+= (seder, e) => { - defenceSelected.Visible = false; - withdrawalSelected.Visible = true; - urgentwithdrawalSelected.Visible = false; - if (actionsInfo.ContainsKey("Password")) - { - actionsInfo.Remove("Password"); - } - actionsInfo.Add("Password", "999999"); - if (actionsInfo.ContainsKey("SecurityModeId")) - { - actionsInfo.Remove("SecurityModeId"); - } - if (actionsInfo.ContainsKey("SecuritySetting")) - { - actionsInfo.Remove("SecuritySetting"); - } - actionsInfo.Add("SecurityModeId", "0"); - actionsInfo.Add("SecuritySetting", "0"); - LogicIfon.AddSecurityactions(actionsInfo); - this.RemoveFromParent(); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = true; + urgentwithdView.funnextBtn.Visible = false; + }; - withdrawalRowLayout.MouseUpEventHandler += disableclick; - btnwithdrawal.MouseUpEventHandler += disableclick; + ///鑳佽揩鎾ら槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> urgentwithdrawalclick = (seder, e) => + urgentwithdView.clickviewBtn.MouseUpEventHandler += (seder, e) => { - defenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = true; - if (actionsInfo.ContainsKey("Password")) - { - actionsInfo.Remove("Password"); - } - if (actionsInfo.ContainsKey("SecuritySetting")) - { - actionsInfo.Remove("SecuritySetting"); - } - actionsInfo.Add("Password", "888888"); - actionsInfo.Add("SecuritySetting", "0"); - LogicIfon.AddSecurityactions(actionsInfo); - this.RemoveFromParent(); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = true; }; - urgentwithdrawalRowLayout.MouseUpEventHandler += urgentwithdrawalclick; - btnurgentwithdrawal.MouseUpEventHandler += urgentwithdrawalclick; + if (IsDeviceEditor) { @@ -249,29 +151,43 @@ { if (actions["LinkType"].ToString() == "6") { - + if (actions["SecuritySetting"].ToString() == "0") { if (actions["Password"].ToString() == "888888") { - defenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = true; + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = true; } else { - defenceSelected.Visible = false; - withdrawalSelected.Visible = true; - urgentwithdrawalSelected.Visible = false; + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = true; + urgentwithdView.funnextBtn.Visible = false; } } else if (actions["SecuritySetting"].ToString() == "1") { - strvalue = actions["SecurityModeId"].ToString(); - defenceSelected.Visible = true; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; + if (actions["SecurityModeId"].ToString() == "1") + { + + athomeView.funnextBtn.Visible = true; + leaveView.funnextBtn.Visible = false; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = false; + } + else + { + athomeView.funnextBtn.Visible = false; + leaveView.funnextBtn.Visible = true; + withdrawalView.funnextBtn.Visible = false; + urgentwithdView.funnextBtn.Visible = false; + + } } break; @@ -281,145 +197,90 @@ } - - } - - void SecurityView(string strvalue) - { - FrameLayout flMain = new FrameLayout { BackgroundColor = 0x00000000 }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender, e) => + saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - flMain.RemoveFromParent(); - }; - - var frameLayout = new FrameLayout - { - Y = Application.GetRealHeight(1920 - 360), - Height = Application.GetRealHeight(360), - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - }; - flMain.AddChidren(frameLayout); - - var athomeRow = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - frameLayout.AddChidren(athomeRow); - - var athomeBtn = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.athome, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - athomeRow.AddChidren(athomeBtn); - - var athomeSelected = new Button - { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - athomeRow.AddChidren(athomeSelected); - - var leavehomeRow = new RowLayout - { - Height = Application.GetRealHeight(180), - Y = athomeRow.Bottom, - }; - frameLayout.AddChidren(leavehomeRow); - var leavehomeBtn = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.leavehome, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - leavehomeRow.AddChidren(leavehomeBtn); - - var leavehomeSelected = new Button - { - X = Application.GetRealWidth(1080 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - leavehomeRow.AddChidren(leavehomeSelected); - - EventHandler<MouseEventArgs> athomeclick = (sender6, e6) => - { - flMain.RemoveFromParent(); - if (actionsInfo.ContainsKey("SecurityModeId")) + if (!athomeView.funnextBtn.Visible && !leaveView.funnextBtn.Visible && !withdrawalView.funnextBtn.Visible && !urgentwithdView.funnextBtn.Visible) { - actionsInfo.Remove("SecurityModeId"); + + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.securitytip), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; } - if (actionsInfo.ContainsKey("SecuritySetting")) + + if (actionsInfo.ContainsKey("LinkType")) { - actionsInfo.Remove("SecuritySetting"); + actionsInfo.Remove("LinkType"); } + if (actionsInfo.ContainsKey("CheckIASStatus")) + { + actionsInfo.Remove("CheckIASStatus"); + } + if (actionsInfo.ContainsKey("IsDelayStart")) + { + actionsInfo.Remove("IsDelayStart"); + } + + actionsInfo.Add("LinkType", 6); + actionsInfo.Add("CheckIASStatus", 0); + actionsInfo.Add("IsDelayStart", 0); + if (actionsInfo.ContainsKey("Password")) { actionsInfo.Remove("Password"); } - actionsInfo.Add("Password", "666666"); - actionsInfo.Add("SecurityModeId", "1"); - actionsInfo.Add("SecuritySetting", "1"); - LogicIfon.AddSecurityactions(actionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - - }; - athomeRow.MouseUpEventHandler += athomeclick; - athomeBtn.MouseUpEventHandler += athomeclick; - athomeSelected.MouseUpEventHandler += athomeclick; - - EventHandler<MouseEventArgs> leavehomeclick = (sender6, e6) => - { - flMain.RemoveFromParent(); - if (actionsInfo.ContainsKey("SecurityModeId")) - { - actionsInfo.Remove("SecurityModeId"); - } if (actionsInfo.ContainsKey("SecuritySetting")) { actionsInfo.Remove("SecuritySetting"); } - if(actionsInfo.ContainsKey("Password")) + if (actionsInfo.ContainsKey("SecurityModeId")) { - actionsInfo.Remove("Password"); + actionsInfo.Remove("SecurityModeId"); } - actionsInfo.Add("Password", "666666"); - actionsInfo.Add("SecurityModeId", "2"); - actionsInfo.Add("SecuritySetting", "1"); + ///鍦ㄥ甯冮槻 + if (athomeView.funnextBtn.Visible) + { + actionsInfo.Add("SecuritySetting", "1"); + actionsInfo.Add("SecurityModeId", "1"); + actionsInfo.Add("Password", "666666"); + + } + ///绂诲甯冮槻 + if (leaveView.funnextBtn.Visible) + { + actionsInfo.Add("SecuritySetting", "1"); + actionsInfo.Add("SecurityModeId", "2"); + actionsInfo.Add("Password", "666666"); + + } + ///鎾ら槻 + if (withdrawalView.funnextBtn.Visible) + { + actionsInfo.Add("SecuritySetting", "0"); + actionsInfo.Add("SecurityModeId", "0"); + actionsInfo.Add("Password", "999999"); + + } + ///绱ц揩鎾ら槻 + if (urgentwithdView.funnextBtn.Visible) + { + actionsInfo.Add("SecuritySetting", "0"); + actionsInfo.Add("SecurityModeId", "0"); + actionsInfo.Add("Password", "888888"); + + } LogicIfon.AddSecurityactions(actionsInfo); + this.RemoveFromParent(); var logicCommunalPage = new LogicCommunalPage(); UserView.HomePage.Instance.AddChidren(logicCommunalPage); UserView.HomePage.Instance.PageIndex += 1; logicCommunalPage.Show(() => { }); + }; - leavehomeRow.MouseUpEventHandler += leavehomeclick; - leavehomeBtn.MouseUpEventHandler += leavehomeclick; - leavehomeSelected.MouseUpEventHandler += leavehomeclick; - - if (strvalue == "1") - { - athomeSelected.Visible = true; - leavehomeSelected.Visible = false; - } - else if (strvalue == "2") - { - leavehomeSelected.Visible = true; - athomeSelected.Visible = false; - - } } + + } } -- Gitblit v1.8.0