From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs | 109 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 76 insertions(+), 33 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
index 3a601d5..2e82ac8 100755
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
@@ -4,12 +4,12 @@
namespace Shared.Phone.Device.CommonForm
{
- public class SelectTime: UserCenter.FrameLayoutBase
+ public class SelectTime : FrameLayoutBase
{
public Action<int> TimeAction;
Button TempSelectBtn;
-
+
Button TempTimeBtn;
public int TempTime;
@@ -47,28 +47,28 @@
var cancle = new Button
{
- X=Application.GetRealWidth(80),
- Width=Application.GetRealWidth(300),
+ X = Application.GetRealWidth(80),
+ Width = Application.GetRealWidth(300),
TextAlignment = TextAlignment.CenterLeft,
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
- TextID=R.MyInternationalizationString.Cancel,
- TextSize=14
+ TextID = R.MyInternationalizationString.Cancel,
+ TextSize = 14
};
topView.AddChidren(cancle);
var title = new Button
{
Width = Application.GetRealWidth(300),
- Gravity=Gravity.CenterHorizontal,
+ Gravity = Gravity.CenterHorizontal,
TextColor = ZigbeeColor.Current.GXCTextBlackColor2,
- TextID=R.MyInternationalizationString.Delay,
+ TextID = R.MyInternationalizationString.Delay,
TextSize = 16
};
topView.AddChidren(title);
- var confrim=new Button
+ var confrim = new Button
{
- X = Application.GetRealWidth(CommonFormResouce.AppRealWidth-80-300),
+ X = dialog.Width - Application.GetRealWidth(80 - 300),
Width = Application.GetRealWidth(300),
TextAlignment = TextAlignment.CenterRight,
TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
@@ -88,7 +88,7 @@
var timeLayout = new VerticalScrolViewLayout
{
Y = Application.GetRealHeight(207),
- Height = Application.GetRealHeight(703 + 127 * 2 + 12+12),
+ Height = Application.GetRealHeight(703 + 127 * 2 + 12 + 12),
ScrollEnabled = false,
VerticalScrollBarEnabled = false,
};
@@ -101,13 +101,13 @@
var notOpen = new Button
{
X = Application.GetRealWidth(80),
- Y=Application.GetRealHeight(1200),
- Width=Application.GetRealWidth(800),
- Height=Application.GetRealHeight(80),
+ Y = Application.GetRealHeight(1200),
+ Width = Application.GetRealWidth(800),
+ Height = Application.GetRealHeight(80),
TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
TextID = R.MyInternationalizationString.NotOpen,
TextAlignment = TextAlignment.CenterLeft,
- TextSize=14
+ TextSize = 14
};
backgroundFL.AddChidren(notOpen);
@@ -124,7 +124,7 @@
tList.Add(60 * 30);
tList.Add(60 * 60);
- foreach(var t in tList)
+ foreach (var t in tList)
{
AddTime(timeLayout, t);
}
@@ -138,28 +138,28 @@
{
var row = new FrameLayout
{
- Height = Application.GetRealHeight(127+12),
+ Height = Application.GetRealHeight(127 + 12),
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
};
verticalScrolView.AddChidren(row);
var trow = new FrameLayout
{
- Y=Application.GetRealHeight(12),
+ Y = Application.GetRealHeight(12),
Height = Application.GetRealHeight(127),
- BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
};
row.AddChidren(trow);
var timeBtn = new Button
{
X = Application.GetRealWidth(80),
- Width=Application.GetRealWidth(500),
+ Width = Application.GetRealWidth(500),
TextAlignment = TextAlignment.CenterLeft,
TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
- IsSelected=false,
- TextSize=14
+ IsSelected = false,
+ TextSize = 14
};
trow.AddChidren(timeBtn);
@@ -167,10 +167,10 @@
{
X = Application.GetRealWidth(942),
Width = this.GetPictrueRealSize(60),
- Height=this.GetPictrueRealSize(60),
- Gravity=Gravity.CenterVertical,
- UnSelectedImagePath="Item/ItemSelected.png",
- Visible=false
+ Height = this.GetPictrueRealSize(60),
+ Gravity = Gravity.CenterVertical,
+ UnSelectedImagePath = "Item/ItemSelected.png",
+ Visible = false
};
trow.AddChidren(selectBtn);
@@ -179,12 +179,12 @@
Y = row.Height - 1,
Width = Application.GetRealWidth(919),
Height = 1,
- Gravity=Gravity.CenterHorizontal,
+ Gravity = Gravity.CenterHorizontal,
BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2
};
row.AddChidren(Line);
-
+
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
{
TempTimeBtn.IsSelected = false;
@@ -202,7 +202,7 @@
timeBtn.MouseUpEventHandler += eventHandler;
trow.MouseUpEventHandler += eventHandler;
- timeBtn.Text =CommonFormResouce.GetTimeString(timess);
+ timeBtn.Text = this.GetTimeString(timess);
if (timess == TempTime)
{
@@ -215,11 +215,54 @@
}
/// <summary>
+ /// 鑾峰彇鍦烘櫙寤舵椂瀛楃涓�
+ /// </summary>
+ /// <param name="second"></param>
+ /// <returns></returns>
+ private string GetTimeString(int second)
+ {
+ if (second == 0)
+ {
+ return null;
+ }
+ string timeStr = string.Empty;
+ int hour = second / 3600;
+ int minu = second % 3600 / 60;
+ int sec = second % 60;
+ if (hour > 0)
+ {
+ timeStr += $"{hour}{Language.StringByID(R.MyInternationalizationString.Hour)}";
+ if (minu > 0)
+ {
+ timeStr += $"{minu}{Language.StringByID(R.MyInternationalizationString.Minute)}";
+ }
+ if (sec > 0)
+ {
+ timeStr += $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+ }
+ return timeStr;
+ }
+ else if (minu > 0)
+ {
+ timeStr += $"{minu}{Language.StringByID(R.MyInternationalizationString.Minute)}";
+ if (sec > 0)
+ {
+ timeStr += $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+ }
+ return timeStr;
+ }
+ else
+ {
+ return $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+ }
+ }
+
+ /// <summary>
/// Close
/// </summary>
/// <param name="sender"></param>
/// <param name="mouseEventArgs"></param>
- private void Close(object sender,MouseEventArgs mouseEventArgs)
+ private void Close(object sender, MouseEventArgs mouseEventArgs)
{
RemoveFromParent();
}
@@ -229,7 +272,7 @@
/// </summary>
/// <param name="sender"></param>
/// <param name="mouseEventArgs"></param>
- private void Confrim_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+ private void Confrim_MouseEvent(object sender, MouseEventArgs mouseEventArgs)
{
TimeAction.Invoke(TempTime);
RemoveFromParent();
@@ -240,11 +283,11 @@
/// </summary>
/// <param name="sender"></param>
/// <param name="mouseEventArgs"></param>
- private void NotOpen_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+ private void NotOpen_MouseEvent(object sender, MouseEventArgs mouseEventArgs)
{
TimeAction.Invoke(0);
RemoveFromParent();
}
-
+
}
}
--
Gitblit v1.8.0