JLChen
2020-06-03 0b616cd842c3066767cc6ea8f709c5fd6e0c2d99
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>
        /// 请求服务器方法
        /// 指定一个Url,和请求方法,数据,Cookie,得到响应的数据