using System;
|
using System.Collections.Generic;
|
using Shared;
|
using Shared.Phone;
|
using Shared.R;
|
using Shared.Common;
|
namespace Shared.Phone.Device.Logic
|
{
|
public class EverymonthPage : FrameLayout
|
{
|
|
|
public void Show()
|
{
|
|
this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
|
var topFrameLayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(140),
|
Y = Application.GetRealHeight(80),
|
};
|
AddChidren(topFrameLayout);
|
|
var titleName = new Button
|
{
|
TextID = MyInternationalizationString.cycle,
|
TextSize = 17,
|
TextColor=ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
topFrameLayout.AddChidren(titleName);
|
|
var hdl = new Button
|
{
|
Width = Application.GetRealWidth(154),
|
Height = Application.GetRealHeight(90),
|
X = Application.GetRealWidth(1080-170),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Logo/Logo.png",
|
};
|
//topFrameLayout.AddChidren(hdl);
|
|
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();
|
};
|
|
var titlerl = new RowLayout
|
{
|
Height = Application.GetRealHeight(180),
|
//BackgroundColor = 0xff0f0f0f,
|
Y = Application.GetRealHeight(220),
|
};
|
AddChidren(titlerl);
|
|
titlerl.AddChidren(
|
new Button
|
{
|
X = Application.GetRealWidth(40),
|
//Text = "请选择重复执行周期",
|
TextID = MyInternationalizationString.repeat,
|
TextSize = 17,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
}
|
);
|
|
var middle = new VerticalScrolViewLayout();
|
middle.Y = titlerl.Bottom;
|
middle.Height = Application.GetRealHeight(1920 - 220 - 180);
|
middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
this.AddChidren(middle);
|
|
|
var startdaterow = new RowLayout
|
{
|
Height = Application.GetRealHeight(180),
|
};
|
middle.AddChidren(startdaterow);
|
|
var btnstartdatetext = new Button
|
{
|
TextAlignment = TextAlignment.CenterLeft,
|
Width = Application.GetRealWidth(300),
|
X = Application.GetRealWidth(30),
|
TextID = MyInternationalizationString.startdate,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
startdaterow.AddChidren(btnstartdatetext);
|
|
var btnstartdate = new Button
|
{
|
X = Application.GetRealWidth(330),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = "0",
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
startdaterow.AddChidren(btnstartdate);
|
|
var btnstartback = 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,
|
};
|
startdaterow.AddChidren(btnstartback);
|
|
var enddaterow = new RowLayout
|
{
|
Height = Application.GetRealHeight(180),
|
};
|
middle.AddChidren(enddaterow);
|
var btnenddatetext = new Button
|
{
|
TextAlignment = TextAlignment.CenterLeft,
|
Width = Application.GetRealWidth(300),
|
X = Application.GetRealWidth(30),
|
TextID = MyInternationalizationString.enddate,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
enddaterow.AddChidren(btnenddatetext);
|
|
var btnenddate = new Button
|
{
|
X = Application.GetRealWidth(330),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = "0",
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
};
|
enddaterow.AddChidren(btnenddate);
|
|
var btnendtimeback = 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,
|
};
|
enddaterow.AddChidren(btnendtimeback);
|
|
|
EventHandler<MouseEventArgs> startdateclick = (sender33, e33) =>
|
{
|
var list = new List<string> { };
|
for (int day = 1; day <= 31; day++)
|
{
|
list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day));
|
}
|
//PickerView.Show(list, (obj) =>
|
//{
|
// var day = obj.Split(' ')[0];
|
// if (btnenddate.Tag.ToString() != "0" && int.Parse(btnenddate.Tag.ToString()) < int.Parse(day))
|
// {
|
// var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
|
// Language.StringByID(MyInternationalizationString.monthday),
|
// Language.StringByID(MyInternationalizationString.OK));
|
// alert.Show();
|
// }
|
// else
|
// {
|
// btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
|
// btnstartdate.Tag = day;
|
// if (string.IsNullOrEmpty(btnenddate.Text))
|
// {
|
// btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
|
// btnenddate.Tag = day;
|
// }
|
// Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3;
|
// int a = int.Parse(btnstartdate.Tag.ToString());
|
// int b = int.Parse(btnenddate.Tag.ToString());
|
// string s = "";
|
// for (int i = 32; i > 0; i--)
|
// {
|
// if (i >=a && i <= b)
|
// {
|
// s += "1";
|
// }
|
// else
|
// {
|
// s += "0";
|
// }
|
// }
|
// var intvalue = Convert.ToInt32(s, 2);
|
// Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue;
|
// }
|
//}, Language.StringByID(MyInternationalizationString.complete), "112");
|
};
|
startdaterow.MouseUpEventHandler += startdateclick;
|
btnstartdate.MouseUpEventHandler += startdateclick;
|
btnstartdatetext.MouseUpEventHandler += startdateclick;
|
btnstartback.MouseUpEventHandler += startdateclick;
|
|
|
EventHandler<MouseEventArgs> enddateclick = (sender33, e33) =>
|
{
|
var list = new List<string> { };
|
for (int day = 1; day <= 31; day++)
|
{
|
list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day));
|
}
|
//PickerView.Show(list, (obj) =>
|
//{
|
// var day = obj.Split(' ')[0];
|
// if (btnstartdate.Tag.ToString() != "0" && int.Parse(btnstartdate.Tag.ToString()) > int.Parse(day))
|
// {
|
// var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
|
// Language.StringByID(MyInternationalizationString.monthday),
|
// Language.StringByID(MyInternationalizationString.OK));
|
// alert.Show();
|
// }
|
// else
|
// {
|
// btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
|
// btnenddate.Tag = day;
|
// if (string.IsNullOrEmpty(btnstartdate.Text))
|
// {
|
// btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day);
|
// btnstartdate.Tag = day;
|
// }
|
|
// Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3;
|
// int a = int.Parse(btnstartdate.Tag.ToString());
|
// int b = int.Parse(btnenddate.Tag.ToString());
|
// string s = "";
|
// for (int i = 32; i > 0; i--)
|
// {
|
// if (i >= a && i <= b)
|
// {
|
// s += "1";
|
// }
|
// else
|
// {
|
// s += "0";
|
// }
|
// }
|
// var intvalue = Convert.ToInt32(s, 2);
|
// Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue;
|
|
// }
|
//}, Language.StringByID(MyInternationalizationString.complete), "112");
|
};
|
enddaterow.MouseUpEventHandler += enddateclick;
|
btnenddate.MouseUpEventHandler += enddateclick;
|
btnenddatetext.MouseUpEventHandler += enddateclick;
|
btnendtimeback.MouseUpEventHandler += enddateclick;
|
|
if(Common.Logic.CurrentLogic.TimeAttribute.Repeat==3){
|
if (Common.Logic.CurrentLogic.TimeAttribute.MonthDate != 0)
|
{
|
string len = "";
|
int minvalue = 0;
|
var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2);
|
var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length));
|
for (int j = 31; j >= 0; j--)
|
{
|
len += str.Substring(j, 1);
|
}
|
|
for (int j = 0; j < len.Length; j++)
|
{
|
var strvalue = len.Substring(j, 1);
|
if (strvalue == "1")
|
{
|
minvalue = j + 1;
|
break;
|
}
|
}
|
|
btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day);
|
btnstartdate.Tag = minvalue.ToString();
|
btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + maxvalue.Length.ToString() + Language.StringByID(MyInternationalizationString.day);
|
btnenddate.Tag = maxvalue.Length.ToString();
|
|
|
}
|
}
|
}
|
}
|
|
}
|