From 72e1b4e4626315ebd4b879a68c94e7738fd0473e Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 28 十月 2019 11:00:28 +0800
Subject: [PATCH] 2019-10-28-1
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs | 58 +++++++++++++++++++++++++++++++---------------------------
1 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs
index d942395..efbac27 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));
@@ -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)
{
//涓嶈兘鍏佽绌虹櫧鍚嶅瓧
@@ -215,7 +208,7 @@
{
menuCount = 2;
}
- var frame = new TopRightMenuControl(this, menuCount);
+ var frame = new TopRightMenuControl(menuCount);
if (canTest == true)
{
//瀹氫綅
@@ -302,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)
{
@@ -310,6 +304,11 @@
{
//鍙骞叉帴鐐�
listOffSwitch.Add(device);
+ if (device.DeviceEpoint == deviceObj.DeviceEpoint)
+ {
+ //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾
+ hadDevice = true;
+ }
}
}
//鎺掑簭
@@ -321,6 +320,11 @@
}
return -1;
});
+ if (hadDevice == false)
+ {
+ //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓�
+ this.deviceObj = listOffSwitch[0];
+ }
var frameBorder = new FrameLayout();
frameBorder.Y = Application.GetRealHeight(150);
@@ -357,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;
@@ -376,7 +380,7 @@
this.DeviceEpointSelectEvent(btnIcon, null);
};
- if (isFirst == true)
+ if (device.DeviceEpoint == deviceObj.DeviceEpoint)
{
//鍒濆鍖栬彍鍗曡
this.DeviceEpointSelectEvent(btnIcon, null);
@@ -402,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();
@@ -412,7 +416,7 @@
frame2.Gravity = Gravity.CenterHorizontal;
frameBack.AddChidren(frame2);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame2, listDevice[1], false);
+ this.InitDeviceIcon(frame2, listDevice[1]);
}
#endregion
@@ -434,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();
@@ -444,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();
@@ -454,7 +458,7 @@
frame3.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame3);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame3, listDevice[2], false);
+ this.InitDeviceIcon(frame3, listDevice[2]);
}
#endregion
@@ -476,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();
@@ -486,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();
@@ -496,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();
@@ -506,7 +510,7 @@
frame4.Y = Application.GetMinRealAverage(245);
frameBack.AddChidren(frame4);
//鍒濆鍖栬澶囧浘鏍�
- this.InitDeviceIcon(frame4, listDevice[3], false);
+ this.InitDeviceIcon(frame4, listDevice[3]);
}
#endregion
@@ -537,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