using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class FunctionMainView : FrameLayout
|
{
|
/// <summary>
|
/// name
|
/// </summary>
|
public Button NameButton;
|
/// <summary>
|
/// collect
|
/// </summary>
|
public Button CollectButton;
|
/// <summary>
|
/// Image
|
/// </summary>
|
public Button IconButton;
|
/// <summary>
|
/// ImageBG
|
/// </summary>
|
public Button ImageBG;
|
|
|
/// <summary>
|
/// statu
|
/// </summary>
|
public Button StatuButton;
|
/// <summary>
|
/// switch
|
/// </summary>
|
public Button SwitchButton;
|
|
/// <summary>
|
/// CardBG
|
/// </summary>
|
public Button CardBG;
|
|
/// <summary>
|
/// v_Selected
|
/// </summary>
|
private bool v_Selected;
|
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
try
|
{
|
v_Selected = value;
|
SetStatu(v_Selected);
|
}
|
catch { };
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
|
public FunctionMainView(int x,int y)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetMinRealAverage(487);
|
Height = Application.GetMinRealAverage(348);
|
}
|
|
/// <summary>
|
/// init
|
/// </summary>
|
public void Init()
|
{
|
//var bg = new Button
|
//{
|
// Width = Application.GetMinReal(487),
|
// Height = Application.GetMinReal(348),
|
//UnSelectedImagePath = "Item/FunctionViewBG.png"
|
//};
|
//AddChidren(bg);
|
|
CardBG = new Button
|
{
|
Width = Application.GetMinRealAverage(487),
|
Height = Application.GetMinRealAverage(348),
|
UnSelectedImagePath = "Item/FunctionCardView.png",
|
SelectedImagePath = "Item/FunctionCardViewSelected.png",
|
Gravity=Gravity.CenterHorizontal
|
};
|
AddChidren(CardBG);
|
|
NameButton = new Button()
|
{
|
X=Application.GetMinRealAverage(40),
|
Y = Application.GetMinRealAverage(17),
|
Width = Application.GetMinRealAverage(320),
|
Height = Application.GetMinRealAverage(63),
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
|
TextAlignment=TextAlignment.CenterLeft
|
};
|
AddChidren(NameButton);
|
|
CollectButton = new Button
|
{
|
X = Application.GetMinRealAverage(366),
|
Y = Application.GetMinRealAverage(14),
|
Width = Application.GetMinRealAverage(107),
|
Height = Application.GetMinRealAverage(107),
|
UnSelectedImagePath="Item/Collection1.png",
|
SelectedImagePath="Item/CollectionSelected1.png"
|
};
|
AddChidren(CollectButton);
|
|
var imgFL = new FrameLayout
|
{
|
X = Application.GetMinRealAverage(40),
|
Y = Application.GetMinRealAverage(101),
|
Width = Application.GetMinRealAverage(124),
|
Height = Application.GetMinRealAverage(124)
|
};
|
AddChidren(imgFL);
|
|
ImageBG = new Button()
|
{
|
//X=Application.GetMinRealAverage(40),
|
//Y = Application.GetMinRealAverage(101),
|
Width = Application.GetMinRealAverage(124),
|
Height = Application.GetMinRealAverage(124),
|
Gravity=Gravity.Center,
|
BackgroundColor = ZigbeeColor.Current.GXCForFunctionUnSelectedBackgroundColor,
|
SelectedBackgroundColor = ZigbeeColor.Current.GXCForFunctionBackgroundColor,
|
Radius=(uint)Application.GetMinRealAverage(124/2)
|
};
|
imgFL.AddChidren(ImageBG);
|
|
IconButton = new Button()
|
{
|
//X=Application.GetMinRealAverage(63),
|
//Y = Application.GetMinRealAverage(121),
|
Width = Application.GetMinRealAverage(84),
|
Height = Application.GetMinRealAverage(84),
|
Gravity=Gravity.Center
|
};
|
imgFL.AddChidren(IconButton);
|
|
StatuButton = new Button()
|
{
|
X=Application.GetMinRealAverage(46),
|
Y = Application.GetMinRealAverage(239),
|
Width = Application.GetMinRealAverage(279),
|
Height = Application.GetMinRealAverage(60),
|
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor,
|
TextAlignment=TextAlignment.CenterLeft
|
};
|
AddChidren(StatuButton);
|
|
SwitchButton = new Button
|
{
|
X = Application.GetMinRealAverage(325),
|
Y = Application.GetMinRealAverage(202),
|
Width = Application.GetMinRealAverage(109),
|
Height = Application.GetMinRealAverage(104),
|
UnSelectedImagePath = "Item/Switch1.png",
|
SelectedImagePath = "Item/SwitchSelected1.png"
|
};
|
AddChidren(SwitchButton);
|
}
|
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
NameButton.IsSelected = IconButton.IsSelected = SwitchButton.IsSelected = StatuButton.IsSelected = CardBG.IsSelected = statu;
|
}
|
|
/// <summary>
|
/// SetDeviceImage
|
/// </summary>
|
/// <param name="img"></param>
|
/// <param name="seletedImg"></param>
|
public void SetDeviceImage(string img,string seletedImg)
|
{
|
IconButton.UnSelectedImagePath = img;
|
IconButton.SelectedImagePath = seletedImg;
|
}
|
|
/// <summary>
|
/// SetDeviceName
|
/// </summary>
|
/// <param name="name"></param>
|
public void SetDeviceName(string name)
|
{
|
NameButton.Text = name;
|
}
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatuText(string statu)
|
{
|
StatuButton.Text = statu;
|
}
|
|
/// <summary>
|
/// SetCollect
|
/// </summary>
|
/// <param name="collect"></param>
|
public void SetCollect(bool collect)
|
{
|
CollectButton.IsSelected = collect;
|
}
|
/// <summary>
|
/// CanControl
|
/// </summary>
|
/// <param name="cmd"></param>
|
public void CanControl(bool cmd)
|
{
|
SwitchButton.Visible = cmd;
|
}
|
}
|
}
|