From 5da99fed2eb0d08b6338064da5f998891252c7b8 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 18 五月 2020 16:39:59 +0800
Subject: [PATCH] 2020-05-18-2
---
ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 407 insertions(+), 21 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
index f20ec2d..9c80179 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
@@ -5,12 +5,23 @@
{
public class TipView
{
-
-
- public void ShowTip(FrameLayout fLayout)
+ /// <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),
@@ -18,17 +29,17 @@
Width = Application.GetRealWidth(792),
Height = Application.GetRealHeight(351 + 127),
BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ Radius = (uint)Application.GetRealHeight(17)
};
fLayout.AddChidren(tipFLayout);
- tipFLayout.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft| HDLUtils.RectCornerTopRight| HDLUtils.RectCornerBottomLeft| HDLUtils.RectCornerBottomRight);
-
+ ///涓婇潰蹇殑鐖舵帶浠�
FrameLayout topFrame = new FrameLayout
{
Width = Application.GetRealWidth(792),
Height = Application.GetRealHeight(351),
};
tipFLayout.AddChidren(topFrame);
-
+ ///鎻愮ず鎺т欢
Button tipBtn = new Button
{
TextID = R.MyInternationalizationString.Tip,
@@ -41,11 +52,10 @@
Width = Application.GetRealWidth(492),
};
topFrame.AddChidren(tipBtn);
-
-
+ ///鑷畾涔夋枃鏈帶浠�
Button tipTextBtn = new Button
{
- Text=Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"),
+ Text = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"),
TextAlignment = TextAlignment.Center,
TextColor = ZigbeeColor.Current.LogicTipTextColor,
TextSize = 14,
@@ -56,45 +66,421 @@
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 = Application.GetRealHeight(127),
+ Height = bottomFrame.Height,
Width = Application.GetRealWidth(397),
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
- Text="123",
+ TextID = R.MyInternationalizationString.cancel,
};
bottomFrame.AddChidren(cancelBtn);
- cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft );
+ cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
+ ///纭鎺т欢
Button okBtn = new Button
{
TextAlignment = TextAlignment.Center,
TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
TextSize = 14,
X = cancelBtn.Right,
- Height = Application.GetRealHeight(127),
- Width = bottomFrame.Width- cancelBtn.Width,
+ Height = bottomFrame.Height,
+ Width = bottomFrame.Width - cancelBtn.Width,
BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
- Text = "456",
+ TextID = R.MyInternationalizationString.confrim,
};
bottomFrame.AddChidren(okBtn);
okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
- cancelBtn.MouseUpEventHandler += (sender,e) => {
- fLayout.RemoveFromParent();
+ ///鍙栨秷鐐瑰嚮浜嬩欢
+ 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)
+ { ///闄愬埗杈撳叆鏁板瓧鑼冨洿;
+ 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