using System; using Shared.Common; namespace Shared.Phone.Device.CommonForm { public class SelectFunctionView : FrameLayout { /// /// name /// private Button NameBtn; /// /// Image /// private Button ImageBtn; /// /// ImageBG /// private Button ImageBG; /// /// SwitchBtn /// private Button SelectBtn; /// /// 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; } } /// /// SelectFunctionView /// /// /// public SelectFunctionView(int x = 0, int y = 0) { X = Application.GetRealWidth(x); Y = Application.GetRealHeight(y); Width = Application.GetRealWidth(1022); Height = Application.GetRealHeight(127); } /// /// 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), Width = Application.GetRealWidth(500), Height = Application.GetRealHeight(80), Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.GXCTextBlackColor, SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, TextAlignment = TextAlignment.CenterLeft, Tag = Tag }; AddChidren(NameBtn); SelectBtn = new Button() { X = Application.GetRealWidth(896), Width = Application.GetMinRealAverage(70), Height = Application.GetMinRealAverage(70), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Room/ItemUnSelected_Black.png", SelectedImagePath = "Room/ItemSelected.png", Tag = Tag }; AddChidren(SelectBtn); var line = new Button() { X = Application.GetRealWidth(180), Y = this.Height - 1, Width = Application.GetRealWidth(841), Height = 1, BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor, Tag = Tag }; AddChidren(line); ClickBtn = new Button { }; AddChidren(ClickBtn); } /// /// SetTitle /// /// public void SetTitle(string title) { NameBtn.Text = title; } /// /// SetTitle /// /// public void SetTitle(int title) { SetTitle(Language.StringByID(title)); } /// /// SetStatu /// /// private void SetStatu(bool statu) { NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = SelectBtn.IsSelected = statu; } } }