From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs |  486 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 486 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
new file mode 100755
index 0000000..a292f9d
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
@@ -0,0 +1,486 @@
+锘縰sing System;
+using Shared.Common;
+
+namespace Shared.Phone.Device.Logic.LogicView
+{
+    public class TipView
+    {
+        /// <summary>
+        /// 纭畾妗�
+        /// </summary>
+        /// <param name="action"></param>
+        public static void ShowConfrimTip(Action action)
+        {
+            ///涓绘帶浠�
+            Dialog dialog = new Dialog();
+            dialog.Show();
+            ///鑳屾櫙鐨勭埗鎺т欢
+            FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            dialog.AddChidren(fLayout);
+            fLayout.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///寮规鐖舵帶浠�
+            FrameLayout tipFLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(144),
+                Y = Application.GetRealHeight(706),
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351 + 127),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(17)
+            };
+            fLayout.AddChidren(tipFLayout);
+            ///涓婇潰蹇殑鐖舵帶浠�
+            FrameLayout topFrame = new FrameLayout
+            {
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351),
+            };
+            tipFLayout.AddChidren(topFrame);
+            ///鎻愮ず鎺т欢
+            Button tipBtn = new Button
+            {
+                TextID = R.MyInternationalizationString.Tip,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTipColor,
+                TextSize = 16,
+                Y = Application.GetRealHeight(69),
+                X = Application.GetRealWidth(150),
+                Height = Application.GetRealHeight(63),
+                Width = Application.GetRealWidth(492),
+            };
+            topFrame.AddChidren(tipBtn);
+            ///鑷畾涔夋枃鏈帶浠�
+            Button tipTextBtn = new Button
+            {
+                Text = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"),
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTipTextColor,
+                TextSize = 14,
+                Y = tipBtn.Bottom + Application.GetRealHeight(35),
+                X = Application.GetRealWidth(60),
+                Height = Application.GetRealHeight(115),
+                Width = Application.GetRealWidth(674),
+                IsMoreLines = true,
+            };
+            topFrame.AddChidren(tipTextBtn);
+            ///涓嬮潰蹇殑鐖舵帶浠�
+            FrameLayout bottomFrame = new FrameLayout
+            {
+                Y = topFrame.Bottom,
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(127),
+                Gravity = Gravity.BottomCenter,
+            };
+            tipFLayout.AddChidren(bottomFrame);
+
+            ///鍙栨秷鎺т欢
+            Button cancelBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+                Height = bottomFrame.Height,
+                Width = Application.GetRealWidth(397),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                TextID = R.MyInternationalizationString.cancel,
+            };
+            bottomFrame.AddChidren(cancelBtn);
+            cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
+            ///纭鎺т欢
+            Button okBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                TextSize = 14,
+                X = cancelBtn.Right,
+                Height = bottomFrame.Height,
+                Width = bottomFrame.Width - cancelBtn.Width,
+                BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
+                TextID = R.MyInternationalizationString.confrim,
+            };
+            bottomFrame.AddChidren(okBtn);
+            okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
+            ///鍙栨秷鐐瑰嚮浜嬩欢
+            cancelBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///纭鐐瑰嚮浜嬩欢
+            okBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+                action();
+            };
+        }
+        /// <summary>
+        /// 杈撳叆妗�
+        /// </summary>
+        /// <param name="_if">鏄惁闇�瑕佸彇娑堟寜閽�</param>
+        /// <param name="action"></param>
+        public static void ShowInputTip(bool _if, Action<string> action)
+        {
+
+            ///涓绘帶浠�
+            Dialog dialog = new Dialog();
+            dialog.Show();
+            ///鑳屾櫙鐨勭埗鎺т欢
+            FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            dialog.AddChidren(fLayout);
+            fLayout.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///寮规鐖舵帶浠�
+            FrameLayout tipFLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(144),
+                Y = Application.GetRealHeight(706),
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351 + 127),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(17)
+            };
+            fLayout.AddChidren(tipFLayout);
+            ///涓婇潰蹇殑鐖舵帶浠�
+            FrameLayout topFrame = new FrameLayout
+            {
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351),
+            };
+            tipFLayout.AddChidren(topFrame);
+            ///鎻愮ず鎺т欢
+            Button tipBtn = new Button
+            {
+                Y = Application.GetRealHeight(69),
+                X = Application.GetRealWidth(150),
+                Height = Application.GetRealHeight(63),
+                Width = Application.GetRealWidth(492),
+               TextID = R.MyInternationalizationString.invalidSetting,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTipColor,
+                TextSize = 16,
+
+            };
+            topFrame.AddChidren(tipBtn);
+            ///鏂囨湰1鎺т欢
+            Button Text1Btn = new Button
+            {
+                Y = Application.GetRealHeight(187),
+                X = Application.GetRealWidth(50),
+                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(242 + 94),
+                TextID = R.MyInternationalizationString.lockOpen,
+                TextAlignment = TextAlignment.CenterRight,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+
+            };
+            topFrame.AddChidren(Text1Btn);
+            ///杈撳叆鏂囨湰妗�
+            EditText editTime = new EditText()
+            {
+                X = Application.GetRealWidth(409),
+                Y = Application.GetRealHeight(173),
+                Height = Application.GetRealHeight(81),
+                Width = Application.GetRealWidth(132),
+                Radius = (uint)Application.GetMinRealAverage(17),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                TextAlignment = TextAlignment.Center,
+                TextSize = 14,
+                Text = "12",
+                IsNumberKeyboardType=true,//鍙緭鍏ユ暟瀛楃殑灞炴��
+            };
+            topFrame.AddChidren(editTime);
+            ///鏂囨湰2鎺т欢
+            Button Text2Btn = new Button
+            {
+                Y = Application.GetRealHeight(187),
+                X = Application.GetRealWidth(564),
+                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(51 + 100),
+                TextID = R.MyInternationalizationString.hour,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+
+            };
+            topFrame.AddChidren(Text2Btn);
+
+            ///涓嬮潰蹇殑鐖舵帶浠�
+            FrameLayout bottomFrame = new FrameLayout
+            {
+                Y = topFrame.Bottom,
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(127),
+                Gravity=Gravity.BottomCenter,
+            };
+            tipFLayout.AddChidren(bottomFrame);
+            ///鍙栨秷鎺т欢
+            Button cancelBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+                Height = bottomFrame.Height,
+                Width = Application.GetRealWidth(397),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                TextID = R.MyInternationalizationString.cancel,
+            };
+            bottomFrame.AddChidren(cancelBtn);
+            ///纭鎺т欢
+            Button okBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                TextSize = 14,
+                X = cancelBtn.Right,
+                Height = bottomFrame.Height,
+                Width = bottomFrame.Width - cancelBtn.Width,
+                BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
+                TextID = R.MyInternationalizationString.confrim,
+            };
+            bottomFrame.AddChidren(okBtn);
+
+            if (_if) {
+                cancelBtn.X = Application.GetRealWidth(0);
+                cancelBtn.Width = Application.GetRealWidth(0);
+                okBtn.X = Application.GetRealWidth(0);
+                okBtn.Width = Application.GetRealWidth(792);
+                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
+            }
+            else
+            {
+                cancelBtn.X = Application.GetRealWidth(0);
+                cancelBtn.Width = Application.GetRealWidth(397);
+                okBtn.X = Application.GetRealWidth(397);
+                okBtn.Width = bottomFrame.Width - cancelBtn.Width;
+                cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
+                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
+
+            }
+            ///鍙栨秷鐐瑰嚮浜嬩欢
+            cancelBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///纭鐐瑰嚮浜嬩欢
+            okBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (string.IsNullOrEmpty(editTime.Text))
+                {
+                    ShowErrorTip(Language.StringByID(R.MyInternationalizationString.timeNull),true);
+                    return;
+                }
+                if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12|| int.Parse(editTime.Text)>(int.MaxValue-1))
+                {  ///闄愬埗杈撳叆鏁板瓧鑼冨洿;
+                    string str = Language.StringByID(R.MyInternationalizationString.less) + Language.StringByID(R.MyInternationalizationString.or) + Language.StringByID(R.MyInternationalizationString.more);
+                    ShowErrorTip(str, true);
+                    return;
+
+
+                }
+                action(editTime.Text);
+                dialog.Close();
+
+            };
+
+        }
+        /// <summary>
+        ///  閿欒鎻愮ず妗�
+        /// </summary>
+        public static void ShowErrorTip(string tipText,bool _if )
+        {
+            ///涓绘帶浠�
+            Dialog dialog = new Dialog();
+            dialog.Show();
+            ///鑳屾櫙鐨勭埗鎺т欢
+            FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            dialog.AddChidren(fLayout);
+            fLayout.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///寮规鐖舵帶浠�
+            FrameLayout tipFLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(144),
+                Y = Application.GetRealHeight(706),
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351 + 127),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(17)
+            };
+            fLayout.AddChidren(tipFLayout);
+            ///涓婇潰蹇殑鐖舵帶浠�
+            FrameLayout topFrame = new FrameLayout
+            {
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(351),
+            };
+            tipFLayout.AddChidren(topFrame);
+            ///鎻愮ず鎺т欢
+            Button tipBtn = new Button
+            {
+                Y = Application.GetRealHeight(69),
+                X = Application.GetRealWidth(150),
+                Height = Application.GetRealHeight(63),
+                Width = Application.GetRealWidth(492),
+                TextID = R.MyInternationalizationString.tip,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTipColor,
+                TextSize = 16,
+
+            };
+            topFrame.AddChidren(tipBtn);
+            ///鏂囨湰鎺т欢
+            Button Text1Btn = new Button
+            {
+                Y = Application.GetRealHeight(187),
+                X = Application.GetRealWidth(50),
+                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(792-100),
+                Text= tipText,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+
+            };
+            topFrame.AddChidren(Text1Btn);
+
+            ///涓嬮潰蹇殑鐖舵帶浠�
+            FrameLayout bottomFrame = new FrameLayout
+            {
+                Y = topFrame.Bottom,
+                Width = Application.GetRealWidth(792),
+                Height = Application.GetRealHeight(127),
+                Gravity = Gravity.BottomCenter,
+            };
+            tipFLayout.AddChidren(bottomFrame);
+            ///鍙栨秷鎺т欢
+            Button cancelBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+                Height = bottomFrame.Height,
+                Width = Application.GetRealWidth(397),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                TextID = R.MyInternationalizationString.cancel,
+            };
+            bottomFrame.AddChidren(cancelBtn);
+            ///纭鎺т欢
+            Button okBtn = new Button
+            {
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                TextSize = 14,
+                X = cancelBtn.Right,
+                Height = bottomFrame.Height,
+                Width = bottomFrame.Width - cancelBtn.Width,
+                BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
+                TextID = R.MyInternationalizationString.confrim,
+            };
+            bottomFrame.AddChidren(okBtn);
+
+            if (_if)
+            {
+                cancelBtn.X = Application.GetRealWidth(0);
+                cancelBtn.Width = Application.GetRealWidth(0);
+                okBtn.X = Application.GetRealWidth(0);
+                okBtn.Width = Application.GetRealWidth(792);
+                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
+            }
+            else
+            {
+                cancelBtn.X = Application.GetRealWidth(0);
+                cancelBtn.Width = Application.GetRealWidth(397);
+                okBtn.X = Application.GetRealWidth(397);
+                okBtn.Width = bottomFrame.Width - cancelBtn.Width;
+                cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
+                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
+
+            }
+            ///鍙栨秷鐐瑰嚮浜嬩欢
+            cancelBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+            ///纭鐐瑰嚮浜嬩欢
+            okBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+            };
+        }
+        /// <summary>
+        ///  闂敊鎻愮ず妗�
+        /// </summary>
+        public static void ShowFlashTip(string tipText,int timeValue=1)
+        {
+            ///涓绘帶浠�
+            Dialog dialog = new Dialog();
+            dialog.Show();
+            ///鑳屾櫙鐨勭埗鎺т欢
+            FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            dialog.AddChidren(fLayout);
+            fLayout.MouseUpEventHandler += (sender,e) => {
+                dialog.Close();
+
+            };
+            ///寮规鐖舵帶浠�
+            FrameLayout tipFLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(230),
+                Y = Application.GetRealHeight(717),
+                Width = Application.GetRealWidth(622),
+                Height = Application.GetRealHeight(317),
+                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(17)
+            };
+            fLayout.AddChidren(tipFLayout);
+
+            ///鎻愮ず鎺т欢
+            Button tipBtn = new Button
+            {
+                Y = Application.GetRealHeight(58),
+                X = Application.GetRealWidth(150),
+                Height = Application.GetRealHeight(63),
+                Width = Application.GetRealWidth(622 - 300),
+                TextID = R.MyInternationalizationString.tip,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicTipColor,
+                TextSize = 16,
+
+            };
+            tipFLayout.AddChidren(tipBtn);
+            ///鏂囨湰鎺т欢
+            Button Text1Btn = new Button
+            {
+                Y = Application.GetRealHeight(156),
+                X = Application.GetRealWidth(50),
+                Height = Application.GetRealHeight(58),
+                Width = Application.GetRealWidth(622 - 100),
+                Text = tipText,
+                TextAlignment = TextAlignment.Center,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+            };
+            tipFLayout.AddChidren(Text1Btn);
+           
+            new System.Threading.Thread(() =>
+            {
+                System.Threading.Thread.Sleep(timeValue*1000);
+                Application.RunOnMainThread(() =>
+                {
+                    dialog.Close();
+                });
+            })
+            { IsBackground = true }.Start();
+        }
+    }
+}
+
+

--
Gitblit v1.8.0