From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 07 五月 2020 10:40:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm
---
ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 250 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
new file mode 100755
index 0000000..5530536
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
@@ -0,0 +1,250 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared.Common;
+
+namespace Shared.Phone.Device.CommonForm
+{
+ public class SelectTime: UserCenter.FrameLayoutBase
+ {
+ public Action<int> TimeAction;
+
+ Button TempSelectBtn;
+
+ Button TempTimeBtn;
+
+ public int TempTime;
+
+ /// <summary>
+ /// Init
+ /// </summary>
+ public void Init()
+ {
+ var dialog = new FrameLayout()
+ {
+ BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
+ };
+ AddChidren(dialog);
+
+ dialog.MouseUpEventHandler += (sender, e) =>
+ {
+ RemoveFromParent();
+ };
+
+ var backgroundFL = new FrameLayout
+ {
+ Y = Application.GetRealHeight(596),
+ Height = Application.GetRealHeight(1325),
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+ };
+ backgroundFL.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+ dialog.AddChidren(backgroundFL);
+
+ var topView = new FrameLayout
+ {
+ Height = Application.GetRealHeight(138)
+ };
+ backgroundFL.AddChidren(topView);
+
+ var cancle = new Button
+ {
+ X=Application.GetRealWidth(80),
+ Width=Application.GetRealWidth(300),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+ TextID=R.MyInternationalizationString.Cancel,
+ TextSize=14
+ };
+ topView.AddChidren(cancle);
+
+ var title = new Button
+ {
+ Width = Application.GetRealWidth(300),
+ Gravity=Gravity.CenterHorizontal,
+ TextColor = ZigbeeColor.Current.GXCTextBlackColor2,
+ TextID=R.MyInternationalizationString.Delay,
+ TextSize = 16
+ };
+ topView.AddChidren(title);
+
+ var confrim=new Button
+ {
+ X = Application.GetRealWidth(CommonFormResouce.AppRealWidth-80-300),
+ Width = Application.GetRealWidth(300),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
+ TextID = R.MyInternationalizationString.Complete,
+ TextSize = 14
+ };
+ topView.AddChidren(confrim);
+
+ var Line = new FrameLayout()
+ {
+ Y = topView.Height - 1,
+ Height = 1,
+ BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+ };
+ topView.AddChidren(Line);
+
+ var timeLayout = new VerticalScrolViewLayout
+ {
+ Y = Application.GetRealHeight(207),
+ Height = Application.GetRealHeight(703 + 127 * 2 + 12+12),
+ ScrollEnabled = false,
+ VerticalScrollBarEnabled = false,
+ };
+ backgroundFL.AddChidren(timeLayout);
+
+ TempSelectBtn = new Button();
+ TempTimeBtn = new Button();
+
+
+ var notOpen = new Button
+ {
+ X = Application.GetRealWidth(80),
+ Y=Application.GetRealHeight(1200),
+ Width=Application.GetRealWidth(400),
+ Height=Application.GetRealHeight(80),
+ TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
+ TextID = R.MyInternationalizationString.NotOpen,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextSize=14
+ };
+ backgroundFL.AddChidren(notOpen);
+
+ cancle.MouseUpEventHandler += Close;
+ confrim.MouseUpEventHandler += Confrim_MouseEvent;
+ notOpen.MouseUpEventHandler += NotOpen_MouseEvent;
+
+ var tList = new List<int>();
+ tList.Add(15);
+ tList.Add(30);
+ tList.Add(60);
+ tList.Add(60 * 5);
+ tList.Add(60 * 15);
+ tList.Add(60 * 30);
+ tList.Add(60 * 60);
+
+ foreach(var t in tList)
+ {
+ AddTime(timeLayout, t);
+ }
+ }
+
+ /// <summary>
+ /// AddTime
+ /// </summary>
+ /// <param name="verticalScrolView"></param>
+ private void AddTime(VerticalScrolViewLayout verticalScrolView, int timess)
+ {
+ var row = new FrameLayout
+ {
+ Height = Application.GetRealHeight(127+12),
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+ };
+ verticalScrolView.AddChidren(row);
+
+ var trow = new FrameLayout
+ {
+ Y=Application.GetRealHeight(12),
+ Height = Application.GetRealHeight(127),
+ BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor
+ };
+ row.AddChidren(trow);
+
+ var timeBtn = new Button
+ {
+ X = Application.GetRealWidth(80),
+ Width=Application.GetRealWidth(500),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
+ SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ IsSelected=false,
+ TextSize=14
+ };
+ trow.AddChidren(timeBtn);
+
+ var selectBtn = new Button
+ {
+ X = Application.GetRealWidth(942),
+ Width = this.GetPictrueRealSize(60),
+ Height=this.GetPictrueRealSize(60),
+ Gravity=Gravity.CenterVertical,
+ UnSelectedImagePath="Item/ItemSelected.png",
+ Visible=false
+ };
+ trow.AddChidren(selectBtn);
+
+ var Line = new FrameLayout()
+ {
+ Y = row.Height - 1,
+ Width = Application.GetRealWidth(919),
+ Height = 1,
+ Gravity=Gravity.CenterHorizontal,
+ BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2
+ };
+ row.AddChidren(Line);
+
+
+ EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+ {
+ TempTimeBtn.IsSelected = false;
+ TempSelectBtn.Visible = false;
+
+ timeBtn.IsSelected = true;
+ selectBtn.Visible = true;
+
+ TempTimeBtn = timeBtn;
+ TempSelectBtn = selectBtn;
+
+ TempTime = timess;
+ };
+
+ timeBtn.MouseUpEventHandler += eventHandler;
+ trow.MouseUpEventHandler += eventHandler;
+
+ timeBtn.Text =CommonFormResouce.GetTimeString(timess);
+
+ if (timess == TempTime)
+ {
+ timeBtn.IsSelected = true;
+ selectBtn.Visible = true;
+ TempTimeBtn = timeBtn;
+ TempSelectBtn = selectBtn;
+ }
+
+ }
+
+ /// <summary>
+ /// Close
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="mouseEventArgs"></param>
+ private void Close(object sender,MouseEventArgs mouseEventArgs)
+ {
+ RemoveFromParent();
+ }
+
+ /// <summary>
+ /// Confrim_MouseEvent
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="mouseEventArgs"></param>
+ private void Confrim_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+ {
+ TimeAction.Invoke(TempTime);
+ RemoveFromParent();
+ }
+
+ /// <summary>
+ /// NotOpen_MouseEvent
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="mouseEventArgs"></param>
+ private void NotOpen_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+ {
+ TimeAction.Invoke(0);
+ RemoveFromParent();
+ }
+
+ }
+}
--
Gitblit v1.8.0