From 74a9ba8e9a2df9c39f9c2eb212a5ac889a055cd4 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 03 十二月 2019 10:47:51 +0800
Subject: [PATCH] 优化UI细节(请合并最新代码)
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs | 152 +++++++++++++++-----------------------------------
1 files changed, 46 insertions(+), 106 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs
index a28b1ef..5e7e106 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs
@@ -29,17 +29,13 @@
/// </summary>
private FrameCaptionInputControl btnDeviceName = null;
/// <summary>
- /// 璁惧Mac鍦板潃
+ /// 璁惧鐨勬煇涓�鍥炶矾
/// </summary>
- private string deviceMac = string.Empty;
+ private CommonDevice deviceObj = null;
/// <summary>
/// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧
/// </summary>
private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>();
- /// <summary>
- /// 璁惧鍏蜂綋绫诲瀷鐨勪俊鎭�
- /// </summary>
- private DeviceEnumInfo deviceEnumInfo = null;
#endregion
@@ -48,13 +44,10 @@
/// <summary>
/// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
/// </summary>
- /// <param name="i_deviceMac">璁惧Mac鍦板潃</param>
- public void ShowForm(string i_deviceMac)
+ /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param>
+ public void ShowForm(CommonDevice i_device)
{
- this.deviceMac = i_deviceMac;
- var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
- //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
- this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
+ this.deviceObj = i_device;
//璁剧疆澶撮儴淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPanelSettion));
@@ -75,18 +68,18 @@
this.ClearBodyFrame();
//鍒濆鍖栨甯�
- this.InitFrameTable();
+ var tableContr = new InformationEditorControl();
+ this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 708, 1028);
+
//鍒濆鍖栬澶囧洖璺浘鏍�
this.InitDeviceEpointIcon();
+ //鍒濆鍖栨甯冨畬鎴�
+ tableContr.FinishInitControl(bodyFrameLayout, this.listview);
+ tableContr = null;
+
//淇濆瓨
var btnFinish = new BottomClickButton();
- //鍊熺敤Y杞村潗鏍�(璁╄繖涓尯鍩熶笉鑳界偣鍑昏彍鍗�)
- var frameBack = new FrameLayout();
- frameBack.Y = btnFinish.Yaxis;
- frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis;
- bodyFrameLayout.AddChidren(frameBack);
-
btnFinish.TextID = R.MyInternationalizationString.uSave;
bodyFrameLayout.AddChidren(btnFinish);
btnFinish.ButtonClickEvent += async (sender, e) =>
@@ -97,7 +90,7 @@
this.ShowProgressBar();
foreach (var epoint in dicDeviceSaveName.Keys)
{
- var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint);
+ var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint);
if (device == null || dicDeviceSaveName[epoint] == string.Empty)
{
//涓嶈兘鍏佽绌虹櫧鍚嶅瓧
@@ -165,47 +158,21 @@
};
//鎵�灞炲尯鍩�
- List<string> listRoomName = Common.Room.CurrentRoom.GetRoomListNameByDevice(nowSelectDevice);
- caption = Language.StringByID(R.MyInternationalizationString.uBelongArea);
- nameValue = Common.Room.CurrentRoom.GetRoomName(listRoomName);
- var btnBeloneArea = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2);
- listview.AddChidren(btnBeloneArea);
- btnBeloneArea.InitControl();
+ var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
+ listview.AddChidren(rowBeloneArea);
+ rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uBelongArea), nowSelectDevice);
//搴曠嚎
- btnBeloneArea.AddBottomLine();
- //鍙崇澶�
- btnBeloneArea.AddRightArrow();
- btnBeloneArea.ButtonClickEvent += (sender, e) =>
+ rowBeloneArea.AddBottomLine();
+ rowBeloneArea.SelectRoomEvent += (roomKeys) =>
{
- var form = new SelectRoomForm();
- form.AddForm(listRoomName);
- form.ActionSelectRoom = (list) =>
- {
- //鍙樻洿鎴块棿
- Common.Room.CurrentRoom.ChangedRoom(nowSelectDevice, list);
-
- btnBeloneArea.Text = Common.Room.CurrentRoom.GetRoomName(list);
- listRoomName.Clear();
- listRoomName.AddRange(list);
- };
+ //鍙樻洿鎴块棿
+ Common.Room.CurrentRoom.ChangedRoom(nowSelectDevice, roomKeys);
};
//娣诲姞缁戝畾鐩爣琛�
this.AddBindRow();
//娣诲姞鑳屽厜鐏
this.AddBackLightRow();
-
- //鍊熺敤Y杞村潗鏍�
- var btnTemp = new BottomClickButton();
- var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount;
- if (bodyFrameLayout.Height - btnTemp.Yaxis + realHeight > listview.Height)
- {
- //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
- var frameTemp = new FrameLayout();
- frameTemp.Height = bodyFrameLayout.Height - btnTemp.Yaxis + Application.GetRealHeight(115);
- listview.AddChidren(frameTemp);
- }
- btnTemp = null;
}
#endregion
@@ -241,7 +208,7 @@
{
menuCount = 2;
}
- var frame = new TopRightMenuControl(this, menuCount);
+ var frame = new TopRightMenuControl(menuCount);
if (canTest == true)
{
//瀹氫綅
@@ -328,7 +295,8 @@
/// </summary>
private void InitDeviceEpointIcon()
{
- var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+ bool hadDevice = false;
+ var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
var listOffSwitch = new List<CommonDevice>();
foreach (var device in listDevice)
{
@@ -336,6 +304,11 @@
{
//鍙骞叉帴鐐�
listOffSwitch.Add(device);
+ if (device.DeviceEpoint == deviceObj.DeviceEpoint)
+ {
+ //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾
+ hadDevice = true;
+ }
}
}
//鎺掑簭
@@ -347,6 +320,11 @@
}
return -1;
});
+ if (hadDevice == false)
+ {
+ //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓�
+ this.deviceObj = listOffSwitch[0];
+ }
var frameBorder = new FrameLayout();
frameBorder.Y = Application.GetRealHeight(150);
@@ -383,7 +361,7 @@
/// <param name="device">璁惧瀵硅薄</param>
/// <param name="isFirst">鏄惁鏄涓�涓�</param>
/// <returns></returns>
- private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device,bool isFirst)
+ private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device)
{
//涓嶄娇鐢ㄧ偣鍑荤壒鏁�
frame.UseClickStatu = false;
@@ -391,7 +369,7 @@
var btnIcon = new NormalViewControl(Application.GetMinRealAverage(52), Application.GetMinRealAverage(52), false);
btnIcon.Name = "btn" + device.DeviceEpoint;
btnIcon.Gravity = Gravity.Center;
- btnIcon.Radius = (uint)Application.GetMinRealAverage(6);
+ btnIcon.Radius = 6;
btnIcon.BorderWidth = 2;
btnIcon.BorderColor = 0xff979797;
frame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
@@ -402,7 +380,7 @@
this.DeviceEpointSelectEvent(btnIcon, null);
};
- if (isFirst == true)
+ if (device.DeviceEpoint == deviceObj.DeviceEpoint)
{
//鍒濆鍖栬彍鍗曡
this.DeviceEpointSelectEvent(btnIcon, null);
@@ -428,7 +406,7 @@
frame1.Gravity = Gravity.CenterHorizontal;
frameBack.AddChidren(frame1);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame1, listDevice[0], true);
+ this.InitDeviceIcon(frame1, listDevice[0]);
//鎸夐敭2
var frame2 = new FrameLayoutControl();
@@ -438,7 +416,7 @@
frame2.Gravity = Gravity.CenterHorizontal;
frameBack.AddChidren(frame2);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame2, listDevice[1], false);
+ this.InitDeviceIcon(frame2, listDevice[1]);
}
#endregion
@@ -460,7 +438,7 @@
frame1.Gravity = Gravity.CenterHorizontal;
frameBack.AddChidren(frame1);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame1, listDevice[0], true);
+ this.InitDeviceIcon(frame1, listDevice[0]);
//鎸夐敭2
var frame2 = new FrameLayoutControl();
@@ -470,7 +448,7 @@
frame2.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame2);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame2, listDevice[1], false);
+ this.InitDeviceIcon(frame2, listDevice[1]);
//鎸夐敭3
var frame3 = new FrameLayoutControl();
@@ -480,7 +458,7 @@
frame3.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame3);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame3, listDevice[2], false);
+ this.InitDeviceIcon(frame3, listDevice[2]);
}
#endregion
@@ -502,7 +480,7 @@
frame1.Y = Application.GetMinRealAverage(63);
frameBack.AddChidren(frame1);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame1, listDevice[0], true);
+ this.InitDeviceIcon(frame1, listDevice[0]);
//鎸夐敭2
var frame2 = new FrameLayoutControl();
@@ -512,7 +490,7 @@
frame2.Y = Application.GetMinRealAverage(63);
frameBack.AddChidren(frame2);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame2, listDevice[1], false);
+ this.InitDeviceIcon(frame2, listDevice[1]);
//鎸夐敭3
var frame3 = new FrameLayoutControl();
@@ -522,7 +500,7 @@
frame3.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame3);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame3, listDevice[2], false);
+ this.InitDeviceIcon(frame3, listDevice[2]);
//鎸夐敭4
var frame4 = new FrameLayoutControl();
@@ -532,45 +510,7 @@
frame4.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame4);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame4, listDevice[3], false);
- }
-
- #endregion
-
- #region 鈻� 鍒濆鍖栨甯僟________________________
-
- /// <summary>
- /// 鍒濆鍖栨甯�
- /// </summary>
- private void InitFrameTable()
- {
- //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾)
- int halfRoundHeigth = Application.GetRealHeight(116) / 2;
- //寮у害鐨勫渾
- var btnRound = new NormalViewControl(bodyFrameLayout.Width, halfRoundHeigth * 2, false);
- btnRound.Y = Application.GetRealHeight(708);
- btnRound.BackgroundColor = UserCenterColor.Current.White;
- btnRound.Radius = (uint)halfRoundHeigth;
- bodyFrameLayout.AddChidren(btnRound);
- //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瑕嗙洊寮у害鐨勫渾鐨勫崐杈�)
- var detailBackFrame = new FrameLayout();
- detailBackFrame.Y = btnRound.Bottom - btnRound.Height / 2;
- detailBackFrame.Height = Application.GetRealHeight(1028);//楂樺害灏辨槸瑕佸畠瓒呰繃
- detailBackFrame.BackgroundColor = UserCenterColor.Current.White;
- bodyFrameLayout.AddChidren(detailBackFrame);
-
- //璁惧缂栬緫
- var btnTile = new NormalViewControl(800, 60, true);
- btnTile.X = ControlCommonResourse.XXLeft;
- btnTile.TextSize = 15;
- btnTile.TextColor = UserCenterColor.Current.TextColor2;
- btnTile.TextID = R.MyInternationalizationString.uDeviceEditor;
- detailBackFrame.AddChidren(btnTile);
-
- this.listview = new VerticalListControl(12);
- listview.Y = btnTile.Bottom + Application.GetRealHeight(17);
- listview.Height = Application.GetRealHeight(1028) - halfRoundHeigth - btnTile.Bottom - Application.GetRealHeight(17);
- detailBackFrame.AddChidren(listview);
+ this.InitDeviceIcon(frame4, listDevice[3]);
}
#endregion
@@ -601,7 +541,7 @@
nowContr.BorderColor = 0xfffb744a;
nowSelectControl = nowContr;
- nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
+ nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
//閲嶆柊鍒濆鍖栬彍鍗曡
this.InitMenuRow();
--
Gitblit v1.8.0