From 0b616cd842c3066767cc6ea8f709c5fd6e0c2d99 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 03 六月 2020 10:10:28 +0800
Subject: [PATCH] 2020-06-03 1.增加极光推送功能。

---
 SmartHome/SmartHome/UI/SimpleControl/MainPage.cs |   70 ++++++++++++++++++++++++++--------
 1 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs b/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
index 9b0d536..9a84137 100644
--- a/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
+++ b/SmartHome/SmartHome/UI/SimpleControl/MainPage.cs
@@ -48,9 +48,9 @@
         public static string sendTime = "";
         public static string recTime = "";
 #if wallon
-        public static string CodeIDString = "202005281";
+        public static string CodeIDString = "202006011";
 #else
-        public static string CodeIDString = "2.505281";
+        public static string CodeIDString = "2.506011";
 #endif
         public static UserInfo LoginUser;
         public static string RequestSource = "1"; //0:Zigbee銆�1:HdlOn銆�2:GraphicsMonitor銆�3:BusproSoft銆�4:AgentWeb
@@ -146,34 +146,70 @@
             }
         }
 
-        static Button btnTipMsg = new Button () {
-            Height = Application.GetRealHeight (126), BackgroundColor = SkinStyle.Current.AddTipButtonColor,
-            Y = Application.GetRealHeight(30),
-            TextAlignment = TextAlignment.Center,
-        };
+        static Button btnTipMsg;
 
         public static void AddTip (string tip, int time = 3000)
         {
+
             if (MainFrameLayout == null) {
                 return;
             }
             Application.RunOnMainThread (() => {
-                btnTipMsg.Text = tip;
-                MainFrameLayout.AddChidren (btnTipMsg);
-                btnTipMsg.MouseUpEventHandler += (sender, e) => {
-                    if (btnTipMsg.Parent != null)
-                        btnTipMsg.RemoveFromParent ();
-                };
-                System.Threading.Tasks.Task.Run (() => {
-                    System.Threading.Thread.Sleep (time);
-                    Application.RunOnMainThread (() => {
+                try {
+                    if (btnTipMsg == null) {
+                        btnTipMsg = new Button () {
+                            Height = Application.GetRealHeight (90),
+                            BackgroundColor = SkinStyle.Current.AddTipButtonColor,
+                            Y = Application.GetRealHeight (36),
+                            TextAlignment = TextAlignment.Center,
+                        };
+                    }
+
+                    btnTipMsg.Text = tip;
+                    MainFrameLayout.AddChidren (btnTipMsg);
+                    btnTipMsg.MouseUpEventHandler += (sender, e) => {
                         if (btnTipMsg.Parent != null)
                             btnTipMsg.RemoveFromParent ();
+                    };
+                    System.Threading.Tasks.Task.Run (() => {
+                        System.Threading.Thread.Sleep (time);
+                        Application.RunOnMainThread (() => {
+                            if (btnTipMsg.Parent != null)
+                                btnTipMsg.RemoveFromParent ();
+                        });
                     });
-                });
+                } catch { }
             });
         }
 
+        //static Button btnTipMsg = new Button () {
+        //    Height = Application.GetRealHeight (126), BackgroundColor = SkinStyle.Current.AddTipButtonColor,
+        //    Y = Application.GetRealHeight(30),
+        //    TextAlignment = TextAlignment.Center,
+        //};
+
+        //public static void AddTip (string tip, int time = 3000)
+        //{
+        //    if (MainFrameLayout == null) {
+        //        return;
+        //    }
+        //    Application.RunOnMainThread (() => {
+        //        btnTipMsg.Text = tip;
+        //        MainFrameLayout.AddChidren (btnTipMsg);
+        //        btnTipMsg.MouseUpEventHandler += (sender, e) => {
+        //            if (btnTipMsg.Parent != null)
+        //                btnTipMsg.RemoveFromParent ();
+        //        };
+        //        System.Threading.Tasks.Task.Run (() => {
+        //            System.Threading.Thread.Sleep (time);
+        //            Application.RunOnMainThread (() => {
+        //                if (btnTipMsg.Parent != null)
+        //                    btnTipMsg.RemoveFromParent ();
+        //            });
+        //        });
+        //    });
+        //}
+
         /// <summary>
         /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
         /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁

--
Gitblit v1.8.0