using System;
|
using System.Collections.Generic;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class SelectDeviceWithPickViewRow:FrameLayout
|
{
|
/// <summary>
|
/// ClickButton
|
/// </summary>
|
public Button ClickButton;
|
/// <summary>
|
/// name
|
/// </summary>
|
public Button NameBtn;
|
/// <summary>
|
/// SelectBtn
|
/// </summary>
|
public Button SelectBtn;
|
/// <summary>
|
/// v_Selected
|
/// </summary>
|
private bool v_Selected;
|
/// <summary>
|
/// line
|
/// </summary>
|
private Button line;
|
/// <summary>
|
/// pickerView
|
/// </summary>
|
public UIPickerView pickerView;
|
/// <summary>
|
/// temperatureList
|
/// </summary>
|
public List<int> temperatureList;
|
/// <summary>
|
/// modeList
|
/// </summary>
|
public List<int> modeList;
|
/// <summary>
|
/// fanList
|
/// </summary>
|
public List<int> fanList;
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
v_Selected = value;
|
try
|
{
|
SetStatu(v_Selected);
|
}
|
catch
|
{
|
|
}
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
/// <summary>
|
/// SelectSceneRow
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
public SelectDeviceWithPickViewRow(int x = 0, int y = 0)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(1080);
|
Height = Application.GetRealHeight(703);
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
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,
|
};
|
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);
|
|
ClickButton = new Button
|
{
|
Height = Application.GetRealHeight(127)
|
};
|
AddChidren(ClickButton);
|
|
pickerView = new UIPickerView
|
{
|
Y = Application.GetRealHeight(138),
|
Height = Application.GetRealHeight(564),
|
};
|
AddChidren(pickerView);
|
/// <para>恒温器 Data1(数值): 0加热/1制冷/2自动调节/3 设置工作模式/4 设置加热度数 5/设置制冷度数 6/设置风扇模式</para>
|
/// <para> 恒温器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】 </para>
|
temperatureList = new List<int> { };
|
var temperatureStrList = new List<string> { };
|
modeList = new List<int> { 1,3,4,7,8 };
|
var modeStrList = new List<string> {
|
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<int> { 1, 2, 3 };
|
var fanStrList = new List<string> {
|
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 - 2,
|
Width = Application.GetRealWidth(919),
|
Height = 2,
|
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor,
|
};
|
AddChidren(line);
|
}
|
/// <summary>
|
/// SetTitle
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTitle(string title)
|
{
|
NameBtn.Text = title;
|
}
|
/// <summary>
|
/// SetTitle
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTitle(int title)
|
{
|
SetTitle(Language.StringByID(title));
|
}
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
SelectBtn.Visible = statu;
|
}
|
/// <summary>
|
/// hideLine
|
/// </summary>
|
/// <param name="statu"></param>
|
public void hideLine(bool statu)
|
{
|
line.Visible = !statu;
|
}
|
|
}
|
}
|