using System;
|
using System.Collections.Generic;
|
using Shared;
|
using Shared.Common;
|
using Shared.Phone;
|
using Shared.R;
|
using ZigBee.Device;
|
namespace Shared.Phone.Device.Logic
|
{
|
public class TimePoint : FrameLayout
|
{
|
public TimePoint()
|
{
|
Tag = "Logic";
|
}
|
public bool IsDeviceEditor;
|
Dictionary<string, string> timeifon=new Dictionary<string, string>();
|
Button beforeClickButton = new Button();
|
TimeView timeview = new TimeView
|
{
|
Height = Application.GetRealHeight(600),
|
BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
|
Width = Application.GetRealWidth(1080),
|
};
|
public string StartMin;
|
public string StartHour;
|
public string AdjustTime;
|
public string DateType;
|
public void Show(Dictionary<string, string> dictionary)
|
{
|
|
int TypeValue = int.Parse(dictionary["DateType"]);
|
timeifon.Add("Type", "0");
|
timeifon.Add("IsValid", "1");
|
timeifon.Add("RemindTime", "0");
|
timeifon.Add("EnDelay", "0");
|
timeifon.Add("DelayTime", "0");
|
timeifon.Add("DateType", TypeValue.ToString());
|
DateType = dictionary["DateType"];
|
|
if (TypeValue == 0)
|
{
|
timeifon.Add("StartHour", dictionary["StartHour"]);
|
timeifon.Add("StartMin", dictionary["StartMin"]);
|
StartHour = dictionary["StartHour"];
|
StartMin= dictionary["StartMin"];
|
}
|
else
|
{
|
timeifon.Add("AdjustTime", dictionary["AdjustTime"]);
|
AdjustTime = dictionary["AdjustTime"];
|
|
}
|
|
|
this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
|
this.AddChidren(new Button
|
{
|
Height = Application.GetRealHeight(80),
|
});
|
|
var topFrameLayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(140),
|
Y = Application.GetRealHeight(80),
|
};
|
AddChidren(topFrameLayout);
|
|
var titleName = new Button
|
{
|
Text = Language.StringByID(MyInternationalizationString.addtime),
|
TextSize = 17,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth(150),
|
};
|
topFrameLayout.AddChidren(titleName);
|
|
var back = new Button
|
{
|
Width = Application.GetRealWidth(110),
|
Height = Application.GetRealHeight(110),
|
X = Application.GetRealWidth(20),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "ZigeeLogic/Back.png",
|
};
|
topFrameLayout.AddChidren(back);
|
back.MouseDownEventHandler += (sender, e) =>
|
{
|
RemoveFromParent();
|
IsDeviceEditor = false;
|
};
|
|
var middle = new VerticalScrolViewLayout();
|
middle.Y = topFrameLayout.Bottom;
|
middle.Height = Application.GetRealHeight(1920 - 220 - 200);
|
middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
this.AddChidren(middle);
|
|
SelectedTimeTypeView(middle,TypeValue);
|
|
|
}
|
/// <summary>
|
/// 显示选中时间的处理方法
|
/// </summary>
|
/// <param name="middle">Middle.</param>
|
/// <param name="TypeValue">Type value.</param>
|
void SelectedTimeTypeView(VerticalScrolViewLayout middle, int TypeValue)
|
{
|
middle.RemoveAll();
|
#region -----立即执行
|
var row = new RowLayout
|
{
|
Height = Application.GetRealHeight(250),
|
};
|
middle.AddChidren(row);
|
|
var btnTextTitle = new Button
|
{
|
Height = Application.GetRealHeight(50),
|
Width = Application.GetRealWidth(800),
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(40),
|
//Text = "请选择时间类型",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextID=MyInternationalizationString.Selectedtimetype,
|
};
|
row.AddChidren(btnTextTitle);
|
|
var btnTypeTextTitle = new Button
|
{
|
Y = Application.GetRealHeight(20 + 50),
|
//Text = "类型",
|
TextID = MyInternationalizationString.type,
|
X = Application.GetRealWidth(40),
|
TextAlignment = TextAlignment.CenterLeft,
|
Height = Application.GetRealHeight(180),
|
Width = Application.GetRealWidth(400),
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
row.AddChidren(btnTypeTextTitle);
|
|
var btnTypeText = new Button
|
{
|
Y = Application.GetRealHeight(20 + 50),
|
X = Application.GetRealWidth(1080 - 500 - 40),
|
//Text = "立即执行",
|
TextID = MyInternationalizationString.immediateexecution,
|
TextAlignment = TextAlignment.CenterRight,
|
Height = Application.GetRealHeight(180),
|
Width = Application.GetRealWidth(500),
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
row.AddChidren(btnTypeText);
|
#endregion
|
|
#region -----时刻
|
var rowSelectedTimeType = new RowLayout
|
{
|
Height = Application.GetRealHeight(180),
|
};
|
middle.AddChidren(rowSelectedTimeType);
|
|
var btnTimeText = new Button
|
{
|
//Text = "时刻",
|
TextID = MyInternationalizationString.moment,
|
TextAlignment = TextAlignment.CenterLeft,
|
Width = Application.GetRealWidth(150),
|
X = Application.GetRealWidth(40),
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
rowSelectedTimeType.AddChidren(btnTimeText);
|
|
|
///显示时间类型的控件
|
var btnTimeTpye = new Button
|
{
|
X = Application.GetRealWidth(300),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
rowSelectedTimeType.AddChidren(btnTimeTpye);
|
|
var btnTimeTpyeBack = new Button
|
{
|
Width = Application.GetRealWidth(110),
|
Height = Application.GetRealHeight(110),
|
UnSelectedImagePath = "ZigeeLogic/next.png",
|
SelectedImagePath = "ZigeeLogic/NextSelecte.png",
|
X = Application.GetRealWidth(1080 - 140),
|
Gravity = Gravity.CenterVertical,
|
};
|
rowSelectedTimeType.AddChidren(btnTimeTpyeBack);
|
EventHandler<MouseEventArgs> timetpyeclick = (sedner, e) =>
|
{
|
TimeTypeView(middle, TypeValue);
|
};
|
rowSelectedTimeType.MouseUpEventHandler += timetpyeclick;
|
btnTimeText.MouseUpEventHandler += timetpyeclick;
|
btnTimeTpye.MouseUpEventHandler += timetpyeclick;
|
btnTimeTpyeBack.MouseUpEventHandler += timetpyeclick;
|
|
#endregion
|
|
string textvalue = "";
|
switch (TypeValue)
|
{
|
case 0:
|
{
|
btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.logiccustom);
|
textvalue = timeifon["StartHour"] + ":" + timeifon["StartMin"];
|
}
|
break;
|
case 1:
|
{
|
btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunrise);
|
if (int.Parse(timeifon["AdjustTime"]) > 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else if (int.Parse(timeifon["AdjustTime"]) < 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(timeifon["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else
|
{
|
textvalue =Language.StringByID(MyInternationalizationString.nothing);
|
}
|
}
|
break;
|
case 2:
|
{
|
btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunset);
|
if (int.Parse(timeifon["AdjustTime"]) > 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else if (int.Parse(timeifon["AdjustTime"]) < 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(timeifon["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else
|
{
|
textvalue =Language.StringByID(MyInternationalizationString.nothing);
|
}
|
}
|
break;
|
case 3:
|
{
|
btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.noon);
|
if (int.Parse(timeifon["AdjustTime"]) > 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else if (int.Parse(timeifon["AdjustTime"]) < 0)
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(timeifon["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
|
}
|
else
|
{
|
textvalue = Language.StringByID(MyInternationalizationString.nothing);
|
}
|
}
|
break;
|
}
|
|
if (TypeValue == 0)
|
{
|
|
#region -----自定义时间
|
var rowTimeView = new RowLayout
|
{
|
Height = Application.GetRealHeight(600),
|
};
|
middle.AddChidren(rowTimeView);
|
|
rowTimeView.AddChidren(timeview);
|
#endregion
|
}
|
else
|
{
|
|
#region -----提前/延时
|
var rowDelayType = new RowLayout
|
{
|
Height = Application.GetRealHeight(180),
|
};
|
middle.AddChidren(rowDelayType);
|
|
var btnDelayTimeText = new Button
|
{
|
//Text = "提前/延时",
|
TextID = MyInternationalizationString.Advancedelay,
|
TextAlignment = TextAlignment.CenterLeft,
|
Width = Application.GetRealWidth(250),
|
X = Application.GetRealWidth(40),
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
rowDelayType.AddChidren(btnDelayTimeText);
|
///显示时间类型的控件
|
var btnDelayTime = new Button
|
{
|
X = Application.GetRealWidth(300),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
Text = textvalue,
|
};
|
rowDelayType.AddChidren(btnDelayTime);
|
|
var btnDelayTimeBack = new Button
|
{
|
Width = Application.GetRealWidth(110),
|
Height = Application.GetRealHeight(110),
|
UnSelectedImagePath = "ZigeeLogic/next.png",
|
SelectedImagePath = "ZigeeLogic/NextSelecte.png",
|
X = Application.GetRealWidth(1080 - 140),
|
Gravity = Gravity.CenterVertical,
|
};
|
rowDelayType.AddChidren(btnDelayTimeBack);
|
|
EventHandler<MouseEventArgs> timeclick = (sedner, e) =>
|
{
|
DelayView(middle, textvalue, TypeValue);
|
};
|
rowDelayType.MouseUpEventHandler += timeclick;
|
btnDelayTimeText.MouseUpEventHandler += timeclick;
|
btnDelayTime.MouseUpEventHandler += timeclick;
|
btnDelayTimeBack.MouseUpEventHandler += timeclick;
|
|
#endregion
|
}
|
|
|
var fra = new FrameLayout
|
{
|
Y = middle.Bottom,
|
Height = Application.GetRealHeight(200),
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
this.AddChidren(fra);
|
var btnsave = new Button
|
{
|
X = Application.GetRealWidth(290),
|
Height = Application.GetRealHeight(150),//194
|
Width = Application.GetRealWidth(500),
|
Radius = (uint)Application.GetRealHeight(50),
|
BackgroundColor = ZigbeeColor.Current.LogicButtonBlueColor,
|
TextID = MyInternationalizationString.Save,
|
};
|
fra.AddChidren(btnsave);
|
btnsave.MouseUpEventHandler += (sender, e) =>
|
{
|
if (TypeValue == 0)
|
{
|
if (timeifon.ContainsKey("AdjustTime"))
|
{
|
timeifon.Remove("AdjustTime");
|
}
|
if (timeifon.ContainsKey("StartHour"))
|
{
|
timeifon.Remove("StartHour");
|
}
|
if (timeifon.ContainsKey("StartMin"))
|
{
|
timeifon.Remove("StartMin");
|
}
|
timeifon.Add("StartHour", timeview.Hour.ToString());
|
timeifon.Add("StartMin", timeview.Minute.ToString());
|
}
|
|
if (IsDeviceEditor)
|
{
|
for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
|
{
|
if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "0")
|
{
|
|
if (Common.Logic.CurrentLogic.Conditions[i]["DateType"] == "0")
|
{
|
if (Common.Logic.CurrentLogic.Conditions[i]["StartHour"] == StartHour && Common.Logic.CurrentLogic.Conditions[i]["StartMin"] == StartMin)
|
{
|
Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
|
Common.Logic.CurrentLogic.Conditions.Insert(i, timeifon);
|
}
|
}
|
else
|
{
|
if (Common.Logic.CurrentLogic.Conditions[i]["DateType"] == DateType && Common.Logic.CurrentLogic.Conditions[i]["AdjustTime"] == AdjustTime)
|
{
|
Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
|
Common.Logic.CurrentLogic.Conditions.Insert(i, timeifon);
|
}
|
}
|
}
|
}
|
IsDeviceEditor = false;
|
}
|
else
|
{
|
Common.Logic.CurrentLogic.Conditions.Add(timeifon);
|
}
|
|
var logicCommunalPage = new LogicCommunalPage { };
|
UserView.HomePage.Instance.AddChidren(logicCommunalPage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
logicCommunalPage.Show(() => { });
|
|
};
|
}
|
/// <summary>
|
/// 处理选中时间类型的方法
|
/// </summary>
|
/// <param name="middle">Middle.</param>
|
void TimeTypeView(VerticalScrolViewLayout middle,int TypeValue)
|
{
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
flMain.MouseUpEventHandler += (sender12, e12) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
|
var fraview = new FrameLayout {
|
Width = Application.GetRealWidth(1080 - 80),
|
Height = Application.GetRealHeight(160*6),
|
Y = Application.GetRealHeight(1920 - 50 - 960),
|
X = Application.GetRealWidth(40),
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(40),
|
};
|
flMain.AddChidren(fraview);
|
|
var textBtn = new Button {
|
Width = Application.GetRealWidth(1080 - 80),
|
Height = Application.GetRealHeight(120),
|
TextAlignment=TextAlignment.Center,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextID=MyInternationalizationString.selectcommontimetype,
|
};
|
fraview.AddChidren(textBtn);
|
|
var timetypeframelayout = new VerticalScrolViewLayout
|
{
|
Width = Application.GetRealWidth(1080 - 80),
|
Height = Application.GetRealHeight(160*4),
|
Y = textBtn.Bottom,
|
};
|
fraview.AddChidren(timetypeframelayout);
|
|
|
var cancelBtn = new Button
|
{
|
Width = Application.GetRealWidth(1080 - 80),
|
Height = Application.GetRealHeight(160),
|
TextAlignment = TextAlignment.Center,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextID = MyInternationalizationString.cancel,
|
Y = timetypeframelayout.Bottom+Application.GetRealHeight(40),
|
BackgroundColor= ZigbeeColor.Current.LogicTopViewBackgroundColor,
|
};
|
fraview.AddChidren(cancelBtn);
|
cancelBtn.MouseUpEventHandler += (sender,e) => {
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
|
List<string> timetypelist = new List<string> {
|
Language.StringByID(MyInternationalizationString.sunrise),
|
Language.StringByID(MyInternationalizationString.sunset),
|
Language.StringByID(MyInternationalizationString.noon),
|
Language.StringByID(MyInternationalizationString.logiccustom),
|
};
|
|
foreach (var typename in timetypelist)
|
{
|
|
var timerowlayout = new RowLayout
|
{
|
Height = Application.GetRealHeight(160),
|
};
|
timetypeframelayout.AddChidren(timerowlayout);
|
|
var btntimetext = new Button
|
{
|
Text = typename,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment=TextAlignment.CenterLeft,
|
X=Application.GetRealWidth(40),
|
};
|
timerowlayout.AddChidren(btntimetext);
|
|
|
EventHandler<MouseEventArgs> timesclick = (sender, e) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
int a = 0;
|
if(btntimetext.Text==Language.StringByID(MyInternationalizationString.logiccustom)){
|
a = 0;
|
}
|
else if(btntimetext.Text == Language.StringByID(MyInternationalizationString.sunrise)){
|
a = 1;
|
}
|
else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.sunset)) {
|
a = 2;
|
}
|
else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.noon)) {
|
a = 3;
|
|
}
|
if (a == TypeValue)
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
return;
|
}
|
|
if (timeifon.ContainsKey("StartHour"))
|
{
|
timeifon.Remove("StartHour");
|
}
|
if (timeifon.ContainsKey("StartMin"))
|
{
|
timeifon.Remove("StartMin");
|
}
|
if (timeifon.ContainsKey("AdjustTime"))
|
{
|
timeifon.Remove("AdjustTime");
|
}
|
if (timeifon.ContainsKey("DateType"))
|
{
|
timeifon.Remove("DateType");
|
}
|
timeifon.Add("DateType", a.ToString());
|
if (a == 0)
|
{
|
timeifon.Add("StartHour", "12");
|
timeifon.Add("StartMin", "0");
|
}
|
else
|
{
|
timeifon.Add("AdjustTime", "0");
|
}
|
|
SelectedTimeTypeView(middle, a);
|
|
};
|
timerowlayout.MouseUpEventHandler += timesclick;
|
btntimetext.MouseUpEventHandler += timesclick;
|
|
}
|
}
|
/// <summary>
|
/// 选中延时时间的处理方法
|
/// </summary>
|
/// <param name="middle">Middle.</param>
|
void DelayView(VerticalScrolViewLayout middle,string timename,int TypeValue)
|
{
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
flMain.MouseUpEventHandler += (sender12, e12) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
|
var fraDelay = new FrameLayout
|
{
|
Width = Application.GetRealWidth(1080 - 80),
|
X = Application.GetRealWidth(40),
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(50),
|
Height=Application.GetRealHeight(1260-250),
|
Y=Application.GetRealHeight(1920-1260+250),
|
};
|
flMain.AddChidren(fraDelay);
|
|
var titleTextfra = new FrameLayout
|
{
|
Height = Application.GetRealHeight(180),
|
};
|
fraDelay.AddChidren(titleTextfra);
|
|
|
var btnTxet = new Button
|
{
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
Height = Application.GetRealHeight(180),
|
Width = Application.GetRealWidth(400),
|
//Text = "请选择时间",
|
TextID=MyInternationalizationString.selectedtime,
|
X = Application.GetRealWidth(300),
|
};
|
titleTextfra.AddChidren(btnTxet);
|
|
|
var btnSave = new Button
|
{
|
Width = Application.GetRealWidth(200),
|
Height = Application.GetRealHeight(180),
|
Text = Language.StringByID(MyInternationalizationString.complete),
|
TextColor = ZigbeeColor.Current.LogicTextBlueColor,
|
X = Application.GetRealWidth(1000 - 200),
|
};
|
titleTextfra.AddChidren(btnSave);
|
|
|
var timetypeframelayout = new VerticalScrolViewLayout
|
{
|
Width = Application.GetRealWidth(1080 - 80),
|
Height = Application.GetRealHeight(900-250+20),
|
Y =titleTextfra.Bottom,
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
fraDelay.AddChidren(timetypeframelayout);
|
|
var cancel = new Button
|
{
|
Height = Application.GetRealHeight(160),
|
TextID = MyInternationalizationString.cancel,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextSize = 16,
|
BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
|
Y =fraDelay.Height- Application.GetRealHeight(160),
|
|
};
|
fraDelay.AddChidren(cancel);
|
cancel.MouseUpEventHandler += (sender, e) =>
|
{
|
flMain.RemoveFromParent();
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
};
|
|
List<string> timevaluelist = new List<string> {
|
Language.StringByID(MyInternationalizationString.advance)+"10"+ Language.StringByID(MyInternationalizationString.logicminute),
|
Language.StringByID(MyInternationalizationString.advance)+"5"+ Language.StringByID(MyInternationalizationString.logicminute),
|
Language.StringByID(MyInternationalizationString.advance)+"1"+ Language.StringByID(MyInternationalizationString.logicminute),
|
Language.StringByID(MyInternationalizationString.nothing),
|
Language.StringByID(MyInternationalizationString.delayed)+"1"+ Language.StringByID(MyInternationalizationString.logicminute),
|
Language.StringByID(MyInternationalizationString.delayed)+"5"+ Language.StringByID(MyInternationalizationString.logicminute),
|
Language.StringByID(MyInternationalizationString.delayed)+"10"+ Language.StringByID(MyInternationalizationString.logicminute),
|
};
|
string strvalue = "";
|
foreach (var typename in timevaluelist)
|
{
|
var timerowlayout = new RowLayout
|
{
|
Height = Application.GetRealHeight(130),
|
LineColor=ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
timetypeframelayout.AddChidren(timerowlayout);
|
|
var btntimetext = new Button
|
{
|
Text = typename,
|
Gravity = Gravity.Center,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
SelectedBackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
|
};
|
timerowlayout.AddChidren(btntimetext);
|
if (timename == typename)
|
{
|
beforeClickButton.IsSelected = false;
|
beforeClickButton = btntimetext;
|
btntimetext.IsSelected = true;
|
strvalue = btntimetext.Text;
|
}
|
|
EventHandler<MouseEventArgs> timesclick = (sender, e) =>
|
{
|
strvalue = btntimetext.Text;
|
beforeClickButton.IsSelected = false;
|
beforeClickButton = btntimetext;
|
btntimetext.IsSelected = true;
|
};
|
timerowlayout.MouseUpEventHandler += timesclick;
|
btntimetext.MouseUpEventHandler += timesclick;
|
|
}
|
|
btnSave.MouseUpEventHandler += (sender2, e2) =>
|
{
|
flMain.RemoveFromParent();
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
if (timeifon.ContainsKey("StartHour"))
|
{
|
timeifon.Remove("StartHour");
|
}
|
if (timeifon.ContainsKey("StartMin"))
|
{
|
timeifon.Remove("StartMin");
|
}
|
if (timeifon.ContainsKey("AdjustTime"))
|
{
|
timeifon.Remove("AdjustTime");
|
}
|
switch (strvalue)
|
{
|
case "提前10分钟":
|
{
|
timeifon.Add("AdjustTime", "-10");
|
}
|
break;
|
case "提前5分钟":
|
{
|
timeifon.Add("AdjustTime", "-5");
|
}
|
break;
|
case "提前1分钟":
|
{
|
timeifon.Add("AdjustTime", "-1");
|
}
|
break;
|
case "无":
|
{
|
timeifon.Add("AdjustTime", "0");
|
}
|
break;
|
case "延时1分钟":
|
{
|
timeifon.Add("AdjustTime", "1");
|
}
|
break;
|
case "延时5分钟":
|
{
|
timeifon.Add("AdjustTime", "5");
|
}
|
break;
|
case "延时10分钟":
|
{
|
timeifon.Add("AdjustTime", "10");
|
}
|
break;
|
|
}
|
SelectedTimeTypeView(middle, TypeValue);
|
};
|
}
|
}
|
}
|