From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs | 104 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 32 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs b/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs index b34e77b..fac3c75 100644 --- a/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs +++ b/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs @@ -1,5 +1,6 @@ 锘縰sing System; using Shared.Common; +using Shared.Phone.Device.CommonForm; using Shared.Phone.UserCenter; namespace Shared.Phone.UserView @@ -43,7 +44,7 @@ var bg = new Button { - X = Application.GetRealWidth(485), + X = Application.GetRealWidth(495), Y = Application.GetRealHeight(161), Width = Application.GetRealWidth(449), Height = Application.GetRealHeight(495), @@ -53,7 +54,7 @@ var bg1 = new FrameLayout { - X = Application.GetRealWidth(485), + X = Application.GetRealWidth(495), Y = Application.GetRealHeight(161), Width = Application.GetRealWidth(449), Height = Application.GetRealHeight(495), @@ -110,11 +111,11 @@ atHome.IsSelected = true; tempRow = atHome; } - atHome.ClickBtn.MouseUpEventHandler += (sender, e) => + atHome.ButtonClickEvent += (sender, e) => { - if((sender as Button).IsSelected) + dialog.Close(); + if (sender.IsSelected) { - dialog.Close(); return; } CommonPage.Loading.Start(); @@ -124,13 +125,16 @@ Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); - dialog.Close(); if(result == GarrisonMode.AtHome) { - + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); } }); - + }) { IsBackground = true }.Start(); }; @@ -146,19 +150,28 @@ withdrawGarriso.IsSelected = true; tempRow = withdrawGarriso; } - withdrawGarriso.ClickBtn.MouseUpEventHandler += (sender, e) => + withdrawGarriso.ButtonClickEvent += (sender, e) => { - if ((sender as Button).IsSelected) + dialog.Close(); + if (sender.IsSelected) { - dialog.Close(); return; } - new System.Threading.Thread(() => + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => { - var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); + var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); Application.RunOnMainThread(() => { - dialog.Close(); + CommonPage.Loading.Hide(); + if (result == 1) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); + } }); }) { IsBackground = true }.Start(); @@ -179,19 +192,28 @@ { atHome.IsSelected = true; } - atHome.ClickBtn.MouseUpEventHandler += (sender, e) => + atHome.ButtonClickEvent += (sender, e) => { - if ((sender as Button).IsSelected) + dialog.Close(); + if (sender.IsSelected) { - dialog.Close(); return; } - new System.Threading.Thread(() => + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => { - var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); + var result =await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); Application.RunOnMainThread(() => { - dialog.Close(); + CommonPage.Loading.Hide(); + if (result == GarrisonMode.AtHome) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); + } }); }) { IsBackground = true }.Start(); @@ -206,19 +228,28 @@ { removeHome.IsSelected = true; } - removeHome.ClickBtn.MouseUpEventHandler += (sender, e) => + removeHome.ButtonClickEvent += (sender, e) => { - if ((sender as Button).IsSelected) + dialog.Close(); + if (sender.IsSelected) { - dialog.Close(); return; } - new System.Threading.Thread(() => + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => { - var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); + var result =await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); Application.RunOnMainThread(() => { - dialog.Close(); + CommonPage.Loading.Hide(); + if (result == GarrisonMode.RemoveHome) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); + } }); }) { IsBackground = true }.Start(); @@ -233,19 +264,28 @@ { withdrawGarriso.IsSelected = true; } - withdrawGarriso.ClickBtn.MouseUpEventHandler += (sender, e) => + withdrawGarriso.ButtonClickEvent += (sender, e) => { - if ((sender as Button).IsSelected) + dialog.Close(); + if (sender.IsSelected) { - dialog.Close(); return; } - new System.Threading.Thread(() => + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => { - var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); + var result =await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); Application.RunOnMainThread(() => { - dialog.Close(); + CommonPage.Loading.Hide(); + if (result == 1) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); + } }); }) { IsBackground = true }.Start(); -- Gitblit v1.8.0