From e7a71b8318fa26b8a85eac86e4c0a129f453d44f Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 08 一月 2020 17:54:16 +0800
Subject: [PATCH] 2019.1.8

---
 ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs |   80 ++++++++++++++++++++++++++++++----------
 1 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs b/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs
index a065ede..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
@@ -112,9 +113,9 @@
             }
             atHome.ButtonClickEvent += (sender, e) =>
             {
-                if(sender.IsSelected)
+                dialog.Close();
+                if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
                 CommonPage.Loading.Start();
@@ -124,10 +125,13 @@
                     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));
                         }
                     });
 
@@ -148,17 +152,26 @@
             }
             withdrawGarriso.ButtonClickEvent += (sender, e) =>
             {
+                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();
@@ -181,17 +194,26 @@
             }
             atHome.ButtonClickEvent += (sender, e) =>
             {
+                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();
@@ -208,17 +230,26 @@
             }
             removeHome.ButtonClickEvent += (sender, e) =>
             {
+                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();
@@ -235,17 +266,26 @@
             }
             withdrawGarriso.ButtonClickEvent += (sender, e) =>
             {
+                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