From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 28 四月 2020 15:02:44 +0800 Subject: [PATCH] 2020-04-28-1 --- ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceIconSelectedIMGByLocal.cs | 148 ++++++++++++++++++++++++++++++------------------ 1 files changed, 92 insertions(+), 56 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceIconSelectedIMGByLocal.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceIconSelectedIMGByLocal.cs old mode 100644 new mode 100755 index 1daf1f3..b965863 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceIconSelectedIMGByLocal.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceIconSelectedIMGByLocal.cs @@ -3,88 +3,124 @@ namespace Shared.Phone.Device.CommonForm { - public class DeviceIconSelectedIMGByLocal:FrameLayout + public class DeviceIconSelectedIMGByLocal : FrameLayout { - public Action<string,string > action; + /// <summary> + /// bodyFrameLayout + /// </summary> + private FrameLayout bodyFrameLayout; + /// <summary> + /// action + /// </summary> + public Action<string, string> action; + /// <summary> + /// tempIcon + /// </summary> + private FunctionIconButton tempIcon; + + /// <summary> + /// DeviceIconSelectedIMGByLocal + /// </summary> public DeviceIconSelectedIMGByLocal() { BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; } + + /// <summary> + /// RemoveFromParent + /// </summary> + public override void RemoveFromParent() + { + base.RemoveFromParent(); + } + + /// <summary> + /// Show + /// </summary> public void Show() { - #region topview - var topBGView = new FrameLayout() - { - Height = Application.GetRealHeight(CommonPage.Navigation_Height), - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor - }; - AddChidren(topBGView); - var topView = new FrameLayout() - { - Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y), - Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y), - BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor, - }; - AddChidren(topView); + AddTop(); - var title = new Button() - { - TextAlignment = TextAlignment.Center, - TextID = R.MyInternationalizationString.ChangeDeviceInfo, - TextSize = 20, - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500), - Gravity = Gravity.CenterHorizontal - }; - topView.AddChidren(title); + AddBodyView(); + } - var back = new BackButton { }; - topView.AddChidren(back); - back.MouseUpEventHandler += (sender, e) => + #region Add____________________________________ + + /// <summary> + /// AddTop + /// </summary> + public void AddTop() + { + var top = new TopFrameLayout(); + AddChidren(top); + top.InitTopview(); + top.SetTopTitle(R.MyInternationalizationString.SelectIcon); + top.backButton.MouseUpEventHandler += (sender, e) => { - this.RemoveFromParent(); + RemoveFromParent(); }; - #endregion - #region 閫夋嫨鍥剧墖 + } + /// <summary> + /// AddBodyView + /// </summary> + public void AddBodyView() + { + bodyFrameLayout = new FrameLayout() + { + Y = Application.GetRealHeight(184), + Height = Application.GetRealHeight(1737), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor + }; + AddChidren(bodyFrameLayout); + + //FunctionIconButton var scrollView = new VerticalScrolViewLayout() { - Y=topBGView.Bottom, - Height=Application.GetRealHeight(CommonPage.AppRealHeight-CommonPage.Navigation_Height), - Width=Application.GetRealWidth(CommonPage.AppRealWidth-CommonPage.XLeft*2), - Gravity=Gravity.CenterHorizontal + Height = Application.GetRealHeight(1450), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; - AddChidren(scrollView); - int xWidth = (int)((CommonPage.AppRealWidth - CommonPage.XLeft * 2 - 100) / 3.0); + bodyFrameLayout.AddChidren(scrollView); - int k= 0; - for (int j = 0; j < 8; j++) + int k = 1; + tempIcon = new FunctionIconButton(); + for (int j = 0; j < 5; j++) { var itemView = new FrameLayout() { - Height = Application.GetRealHeight(xWidth + 50) + Height = Application.GetRealHeight(207 + CommonPage.XLeft) }; scrollView.AddChidren(itemView); - for (int i = 1; i <= 3; i++) + for (int i = 0; i < 4; i++) { - var icon = new Device.CommonForm.SelectedStatuButton - { - X = Application.GetRealWidth((xWidth + 50) * (i-1)), - Y = Application.GetRealHeight(50), - Width = Application.GetMinRealAverage(xWidth), - Height = Application.GetMinRealAverage(xWidth), - UnSelectedImagePath = $"DeviceIcon/{k}.png", - SelectedImagePath = $"DeviceIcon/{k}Selected.png" - }; - k++; + var icon = new FunctionIconButton(58 + i * (207 + 46), 58); + icon.Init($"FunctionIcon/{k}Icon.png", $"FunctionIcon/{k}IconSelected.png"); itemView.AddChidren(icon); - icon.MouseUpEventHandler += (sender, e) => + k++; + + EventHandler<MouseEventArgs> selectIcon = (sender, e) => { - action(icon.UnSelectedImagePath,icon.SelectedImagePath); - RemoveFromParent(); + ((sender as Button).Parent as FunctionIconButton).IsSelected = true; + tempIcon.IsSelected = false; + tempIcon = (sender as Button).Parent as FunctionIconButton; }; + icon.ImageBG.MouseUpEventHandler += selectIcon; + icon.ImageBtn.MouseUpEventHandler += selectIcon; } } - #endregion + + var btnConfirm = new UserCenter.BottomClickButton(); + btnConfirm.TextID = R.MyInternationalizationString.Save; + bodyFrameLayout.AddChidren(btnConfirm); + btnConfirm.ButtonClickEvent += (sender, e) => + { + if (tempIcon.ImageBtn != null) + { + action(tempIcon.ImageBtn.UnSelectedImagePath, tempIcon.ImageBtn.SelectedImagePath); + } + RemoveFromParent(); + }; } + + #endregion } } -- Gitblit v1.8.0