using System;
using System.Collections.Generic;
using Shared.Common;
namespace Shared.Phone.Device.CommonForm
{
public class SelectDeviceWithPickViewRow:FrameLayout
{
///
/// ClickButton
///
public Button ClickButton;
///
/// name
///
public Button NameBtn;
///
/// SelectBtn
///
public Button SelectBtn;
///
/// v_Selected
///
private bool v_Selected;
///
/// line
///
private Button line;
///
/// pickerView
///
public UIPickerView pickerView;
///
/// temperatureList
///
public List temperatureList;
///
/// modeList
///
public List modeList;
///
/// fanList
///
public List fanList;
///
/// IsSelected
///
public bool IsSelected
{
set
{
v_Selected = value;
try
{
SetStatu(v_Selected);
}
catch
{
}
}
get
{
return v_Selected;
}
}
///
/// SelectSceneRow
///
///
///
public SelectDeviceWithPickViewRow(int x = 0, int y = 0)
{
X = Application.GetRealWidth(x);
Y = Application.GetRealHeight(y);
Width = Application.GetRealWidth(1080);
Height = Application.GetRealHeight(703);
}
///
/// Init
///
public void Init()
{
NameBtn = new Button()
{
X = Application.GetRealWidth(81),
Width = Application.GetRealWidth(500),
Height = Application.GetRealHeight(80),
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize=14
};
AddChidren(NameBtn);
SelectBtn = new Button()
{
X = Application.GetRealWidth(919),
Width = Application.GetMinRealAverage(104),
Height = Application.GetMinRealAverage(104),
UnSelectedImagePath = "Scene/Selected.png",
Visible = false
};
AddChidren(SelectBtn);
var line1 = new Button()
{
X = Application.GetRealWidth(81),
Y = Application.GetRealHeight(127),
Width = Application.GetRealWidth(919),
Height = 1,
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor,
};
AddChidren(line1);
ClickButton = new Button
{
Height = Application.GetRealHeight(127)
};
AddChidren(ClickButton);
pickerView = new UIPickerView
{
Y = Application.GetRealHeight(138),
Height = Application.GetRealHeight(564),
};
AddChidren(pickerView);
/// 恒温器 Data1(数值): 0加热/1制冷/2自动调节/3 设置工作模式/4 设置加热度数 5/设置制冷度数 6/设置风扇模式
/// 恒温器Data2数值如下:
///【当Data1=0|1|2时,Data2为要变化的度数,单位:0.1℃ 。】
///【若Data1=3,Data2为要设定的空调模式(0-9),0:off,1:auto,3:cool, 4:heat ,5:emergency heating, 6:precooling,7:fan only ,8:dry,9:sleep。】
///【若Data1=4|5,Data2为加热或制冷度数,单位0.01摄氏度。】
///【若Data1=6,Data2为要设定的风扇模式(0-6),0:off,1:low,2:medium,3:high,4:on,5:auto,6:smart】
temperatureList = new List { };
var temperatureStrList = new List { };
modeList = new List { 1,3,4,7,8 };
var modeStrList = new List {
Language.StringByID(R.MyInternationalizationString.Mode_Auto),
Language.StringByID(R.MyInternationalizationString.Mode_Cool),
Language.StringByID(R.MyInternationalizationString.Mode_Heat),
Language.StringByID(R.MyInternationalizationString.Mode_FanOnly),
Language.StringByID(R.MyInternationalizationString.Mode_Dry)
};
fanList = new List { 1, 2, 3 };
var fanStrList = new List {
Language.StringByID(R.MyInternationalizationString.Fan_Low),
Language.StringByID(R.MyInternationalizationString.Fan_Middle),
Language.StringByID(R.MyInternationalizationString.Fan_Height)
};
for (int i = 16; i <= 32; i++)
{
temperatureList.Add(i);
temperatureStrList.Add($"{i} ℃");
}
pickerView.setNPicker(temperatureStrList, modeStrList, fanStrList);
line = new Button()
{
X = Application.GetRealWidth(81),
Y = this.Height - 1,
Width = Application.GetRealWidth(919),
Height = 1,
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor,
};
AddChidren(line);
}
///
/// SetTitle
///
///
public void SetTitle(string title)
{
NameBtn.Text = title;
}
///
/// SetTitle
///
///
public void SetTitle(int title)
{
SetTitle(Language.StringByID(title));
}
///
/// SetStatu
///
///
public void SetStatu(bool statu)
{
SelectBtn.Visible = statu;
}
///
/// hideLine
///
///
public void hideLine(bool statu)
{
line.Visible = !statu;
}
}
}