using System; using Shared.Common; namespace Shared.Phone.Device.CommonForm { public class CategoryFunctionRow : FrameLayout { /// /// name /// public Button NameBtn; /// /// Image /// public Button ImageBtn; /// /// ImageBG /// public Button ImageBG; /// /// SwitchBtn /// public Button SwitchBtn; /// /// ZoneBtn /// private Button StatuBtn; /// /// ClickBtn /// public Button ClickBtn; /// /// v_Selected /// private bool v_Selected; /// /// IsSelected /// public bool IsSelected { set { v_Selected = value; try { SetStatu(v_Selected); } catch { } } get { return v_Selected; } } /// /// FunctionRow /// /// /// public CategoryFunctionRow(int x = 0, int y = 0) { X = Application.GetRealWidth(x); Y = Application.GetRealHeight(y); Width = Application.GetRealWidth(1022); Height = Application.GetRealHeight(127-2); //BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; } /// /// Init /// /// /// public void Init(string imagePath, string selectedImagePath) { 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, Tag = Tag }; AddChidren(ImageBG); ImageBtn = new Button() { X = Application.GetRealWidth(63), Width = Application.GetMinRealAverage(78), Height = Application.GetMinRealAverage(78), Gravity = Gravity.CenterVertical, UnSelectedImagePath = imagePath, SelectedImagePath = selectedImagePath, Tag = Tag }; AddChidren(ImageBtn); NameBtn = new Button() { X = Application.GetRealWidth(181), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(58), TextColor = ZigbeeColor.Current.GXCTextBlackColor, SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, TextAlignment = TextAlignment.CenterLeft, TextSize=14, Tag = Tag }; 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); SwitchBtn = new Button() { X = Application.GetRealWidth(896), Width = Application.GetMinRealAverage(78), Height = Application.GetMinRealAverage(78), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Item/Switch.png", SelectedImagePath = "Item/SwitchSelected.png", Tag = Tag }; AddChidren(SwitchBtn); var line = new Button() { X = Application.GetRealWidth(181), Y = Height - 1, Width = Application.GetRealWidth(821), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor, Tag = Tag }; AddChidren(line); ClickBtn = new Button { Width=Application.GetRealWidth(890) }; AddChidren(ClickBtn); } /// /// SetTitle /// /// public void SetTitle(string title) { NameBtn.Text = title; } /// /// SetTitle /// /// public void SetTitle(int title) { SetTitle(Language.StringByID(title)); } /// /// SetZoneText /// /// public void SetStatuText(string title) { StatuBtn.Text = title; } /// /// SetStatu /// /// public void SetStatu(bool statu) { SwitchBtn.IsSelected = statu; NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu; NameBtn.IsBold = statu; } /// /// SetStatu /// /// public void SetOnLineStatu(bool statu) { NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu; } /// /// HideSwitchBtn /// /// public void HideSwitchBtn(bool statu) { SwitchBtn.Visible = !statu; } /// /// SetDeviceIcon /// /// /// public void SetDeviceIcon(string imagePath, string selectedImagePath) { ImageBtn.UnSelectedImagePath = imagePath; ImageBtn.SelectedImagePath = selectedImagePath; } } }