using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class CategoryFunctionForWinRow:FrameLayout
|
{
|
/// <summary>
|
/// name
|
/// </summary>
|
public Button NameBtn;
|
/// <summary>
|
/// Image
|
/// </summary>
|
public Button ImageBtn;
|
/// <summary>
|
/// ImageBG
|
/// </summary>
|
public Button ImageBG;
|
/// <summary>
|
/// ZoneBtn
|
/// </summary>
|
private Button StatuBtn;
|
/// <summary>
|
/// OpenOrUpBtn
|
/// </summary>
|
public Button OpenOrUpBtn;
|
/// <summary>
|
/// OpenOrUpBtn
|
/// </summary>
|
public Button CloseOrDownBtn;
|
/// <summary>
|
/// StopBtn
|
/// </summary>
|
public Button StopBtn;
|
|
/// <summary>
|
/// ClickBtn
|
/// </summary>
|
public Button ClickBtn;
|
/// <summary>
|
/// v_Selected
|
/// </summary>
|
private bool v_Selected;
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
v_Selected = value;
|
try
|
{
|
SetStatu(v_Selected);
|
}
|
catch
|
{
|
|
}
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
/// <summary>
|
/// CategoryFunctionForWinRow
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
public CategoryFunctionForWinRow(int x = 0, int y = 0)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(1022);
|
Height = Application.GetRealHeight(127);
|
//BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
/// <param name="device"></param>
|
public void Init(DeviceUI device)
|
{
|
ImageBG = new Button()
|
{
|
X = Application.GetRealWidth(45),
|
Width = Application.GetMinRealAverage(112),
|
Height = Application.GetMinRealAverage(112),
|
Gravity = Gravity.CenterVertical,
|
Radius = (uint)Application.GetMinRealAverage(112 / 2),
|
BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
|
SelectedBackgroundColor = ZigbeeColor.Current.GXCSelectedBackgroundColor,
|
};
|
AddChidren(ImageBG);
|
|
ImageBtn = new Button()
|
{
|
X = Application.GetRealWidth(63),
|
Width = Application.GetMinRealAverage(78),
|
Height = Application.GetMinRealAverage(78),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = device.IconPath,
|
SelectedImagePath = device.OnlineIconPath,
|
};
|
AddChidren(ImageBtn);
|
|
NameBtn = new Button()
|
{
|
X = Application.GetRealWidth(181),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetRealWidth(400),
|
Height = Application.GetRealHeight(58),
|
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize=14
|
};
|
AddChidren(NameBtn);
|
|
StatuBtn = new Button
|
{
|
X = Application.GetRealWidth(181),
|
Y = Application.GetRealHeight(72),
|
Width = Application.GetRealWidth(400),
|
Height = Application.GetRealHeight(49),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2,
|
TextSize=10
|
};
|
AddChidren(StatuBtn);
|
|
OpenOrUpBtn = new Button
|
{
|
X = Application.GetRealWidth(625),
|
Width = Application.GetMinRealAverage(69),
|
Height = Application.GetMinRealAverage(69),
|
SelectedImagePath = "RollerShade/OpenSelected.png",
|
UnSelectedImagePath = "RollerShade/Open.png",
|
Gravity = Gravity.CenterVertical
|
};
|
AddChidren(OpenOrUpBtn);
|
OpenOrUpBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
(device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(0);
|
};
|
|
StopBtn = new Button
|
{
|
X = Application.GetRealWidth(769),
|
Width = Application.GetMinRealAverage(69),
|
Height = Application.GetMinRealAverage(69),
|
SelectedImagePath = "RollerShade/StopSelected.png",
|
UnSelectedImagePath = "RollerShade/Stop.png",
|
Gravity = Gravity.CenterVertical
|
};
|
AddChidren(StopBtn);
|
StopBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
(device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(2);
|
};
|
|
CloseOrDownBtn = new Button
|
{
|
X = Application.GetRealWidth(896),
|
Width = Application.GetMinRealAverage(69),
|
Height = Application.GetMinRealAverage(69),
|
SelectedImagePath = "RollerShade/CloseSelected.png",
|
UnSelectedImagePath = "RollerShade/Close.png",
|
Gravity = Gravity.CenterVertical
|
};
|
AddChidren(CloseOrDownBtn);
|
CloseOrDownBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
(device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(1);
|
};
|
|
var line = new Button()
|
{
|
X = Application.GetRealWidth(200),
|
Y = Height - 2,
|
Width = Application.GetRealWidth(821),
|
Height = 2,
|
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor,
|
Tag = Tag
|
};
|
AddChidren(line);
|
|
ClickBtn = new Button
|
{
|
Width = Application.GetRealWidth(600)
|
};
|
AddChidren(ClickBtn);
|
}
|
|
/// <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>
|
/// SetZoneText
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetStatuText(string title)
|
{
|
StatuBtn.Text = title;
|
}
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
//OpenOrUpBtn.IsSelected = CloseOrDownBtn.IsSelected = StopBtn.IsSelected = statu;
|
NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu;
|
NameBtn.IsBold = statu;
|
}
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetOnLineStatu(bool statu)
|
{
|
NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu;
|
NameBtn.IsBold = statu;
|
}
|
|
/// <summary>
|
/// HideSwitchBtn
|
/// </summary>
|
/// <param name="statu"></param>
|
public void HideSwitchBtn(bool statu)
|
{
|
|
}
|
|
/// <summary>
|
/// WcdType=4:开合帘
|
/// WcdType=0:卷帘
|
/// </summary>
|
/// <param name="type"></param>
|
public void SetRollerShadeIcon(int type)
|
{
|
if(type==0)
|
{
|
OpenOrUpBtn.UnSelectedImagePath = "RollerShade/Up.png";
|
OpenOrUpBtn.SelectedImagePath = "RollerShade/UpSelected.png";
|
|
CloseOrDownBtn.UnSelectedImagePath = "RollerShade/Down.png";
|
CloseOrDownBtn.SelectedImagePath = "RollerShade/DownSelected.png";
|
}
|
else
|
{
|
OpenOrUpBtn.UnSelectedImagePath = "RollerShade/Open.png";
|
OpenOrUpBtn.SelectedImagePath = "RollerShade/OpenSelected.png";
|
|
CloseOrDownBtn.UnSelectedImagePath = "RollerShade/Close.png";
|
CloseOrDownBtn.SelectedImagePath = "RollerShade/CloseSelected.png";
|
}
|
}
|
}
|
}
|