From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 八月 2021 13:21:21 +0800 Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 256 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs new file mode 100644 index 0000000..0b9a0d1 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -0,0 +1,256 @@ +锘縰sing System; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView +{ + public class SwitchView + { + + /// <summary> + /// 涓绘帶浠� + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.view, + Y = Application.GetRealHeight(515), + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(44 * 44), + Width = Application.GetRealWidth(343), + Radius = (uint)Application.GetRealHeight(12) + }; + /// <summary> + /// 鍙栨秷 + /// </summary> + public Button btnCancel = new Button + { + TextAlignment = TextAlignment.Center, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textRedColor, + TextID = StringId.cancelSelected, + Y = Application.GetRealHeight(611), + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + BackgroundColor = CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12) + }; + /// <summary> + /// 寮� + /// </summary> + public Button btnOn = new Button + { + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.onLogic, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + + }; + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + Y = Application.GetRealHeight(43), + }; + /// <summary> + /// 鍏� + /// </summary> + public Button btnOff = new Button + { + Y = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.offLogic, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + }; + /// <summary> + /// 绾�1 + /// </summary> + public Button btnLine1 = new Button + { + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + Y = Application.GetRealHeight(43 + 44), + }; + /// <summary> + /// 鏆傚仠 + /// </summary> + public Button btnStop = new Button + { + Y = Application.GetRealHeight(44 + 44), + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.stop, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + }; + + + + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <param name="frame">鐖舵帶浠�</param> + /// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param> + ///<param name="stateVuale">涔嬪墠鐨勭姸鎬佸��</param> + /// <param name="action">杩斿洖鍥炶皟</param> + /// <returns></returns> + public void FLayoutView(FrameLayout frame, int i,string stateVuale,Action<string>action) + { + frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); + frameLayout.Height = Application.GetRealHeight(44 * i); + frame.AddChidren(frameLayout); + frame.AddChidren(btnCancel); + frameLayout.AddChidren(btnOn); + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnOff); + if (i > 2) + { + /// 鍒ゆ柇鏄惁瑕佹槸鏄剧ず"鏆傚仠"鎸夐挳 + frameLayout.AddChidren(btnLine1); + frameLayout.AddChidren(btnStop); + } + //鍙栨秷鐐瑰嚮浜嬩欢 + btnCancel.MouseUpEventHandler += (sender1, e1) => + { + frame.RemoveFromParent(); + }; + + + ///鏄剧ず涔嬪墠鐘舵�� + if (stateVuale != "") + { + if (stateVuale ==btnOn.Text) + { + btnOn.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (stateVuale == btnOff.Text) + { + btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (stateVuale == btnStop.Text) + { + btnStop.TextColor = CSS.CSS_Color.textConfirmColor; + } + } + + //寮�-鐐瑰嚮浜嬩欢 + btnOn.MouseUpEventHandler += (sender2, e2) => + { + action("on"); + frame.RemoveFromParent(); + }; + //鍏�-鐐瑰嚮浜嬩欢 + btnOff.MouseUpEventHandler += (sender3, e3) => + { + action("off"); + frame.RemoveFromParent(); + }; + //鏆傚仠-鐐瑰嚮浜嬩欢 + btnStop.MouseUpEventHandler += (sender3, e3) => + { + action("stop"); + frame.RemoveFromParent(); + }; + + } + + + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <param name="frame">鐖舵帶浠�</param> + /// <param name="text1">鐖舵帶浠�</param> + /// <param name="text2">鏄剧ず閫夋嫨View鏁伴噺</param> + ///<param name="stateVuale">涔嬪墠鐨勭姸鎬佸��</param> + /// <param name="action">杩斿洖鍥炶皟</param> + /// <returns></returns> + public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action,bool tag=true) + { + int i = 2; + frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); + frameLayout.Height = Application.GetRealHeight(44 * i); + frame.AddChidren(frameLayout); + frame.AddChidren(btnCancel); + btnOn.TextID = text1; + btnOff.TextID = text2; + frameLayout.AddChidren(btnOn); + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnOff); + //鍙栨秷鐐瑰嚮浜嬩欢 + btnCancel.MouseUpEventHandler += (sender1, e1) => + { + frame.RemoveFromParent(); + }; + + ///鏄剧ず涔嬪墠鐘舵�� + if (stateVuale != "") + { + if (stateVuale == btnOn.Text) + { + btnOn.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (stateVuale == btnOff.Text) + { + btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + + } + + //鐐瑰嚮浜嬩欢 + btnOn.MouseUpEventHandler += (sender2, e2) => + { + action(btnOn.TextID); + if (tag) + { + frame.RemoveFromParent(); + } + }; + //鐐瑰嚮浜嬩欢 + btnOff.MouseUpEventHandler += (sender3, e3) => + { + action(btnOff.TextID); + if (tag) + { + frame.RemoveFromParent(); + } + }; + + + } + + + ///// <summary> + ///// View鐨勬柟娉� + ///// </summary> + ///// <param name="frame">鐖舵帶浠�</param> + ///// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param> + ///// <returns></returns> + //public void FLayoutView(FrameLayout frame, int i) + //{ + // frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); + // frameLayout.Height = Application.GetRealHeight(44 * i); + // frame.AddChidren(frameLayout); + // frame.AddChidren(btnCancel); + // frameLayout.AddChidren(btnOn); + // frameLayout.AddChidren(btnLine); + // frameLayout.AddChidren(btnOff); + // if (i > 2) + // { + // /// 鍒ゆ柇鏄惁瑕佹槸鏄剧ず"鏆傚仠"鎸夐挳 + // frameLayout.AddChidren(btnLine1); + // frameLayout.AddChidren(btnStop); + // } + // btnCancel.MouseUpEventHandler += (sender1, e1) => + // { + // frame.RemoveFromParent(); + // }; + //} + } +} -- Gitblit v1.8.0