From cc0d80c7d86c6d0167269b3408c4b30c24ce84e9 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 23 三月 2020 16:55:37 +0800
Subject: [PATCH] ???????
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs | 80 +++++++++++++++++++++-------------------
1 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
index 871c1ad..7e06c98 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
@@ -35,6 +35,11 @@
public void ShowForm(string deviceMac)
{
this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+ if (listNewDevice.Count == 0)
+ {
+ //瀵瑰簲鍗曠函鍙湁200鍥炶矾鐨勮澶�
+ listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
+ }
//璁剧疆鏍囬淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
@@ -57,12 +62,32 @@
//鍒濆鍖栨甯�
this.InitFrameTable();
+ var framePic = new FrameLayout();
+ framePic.Width = Application.GetRealWidth(855);
+ framePic.Height = Application.GetRealHeight(570);
+ framePic.Gravity = Gravity.CenterHorizontal;
+ framePic.Y = Application.GetRealHeight(58);
+ bodyFrameLayout.AddChidren(framePic);
+
+ var imageFile = Common.LocalDevice.Current.GetRealDeviceIcon(listNewDevice);
+ string fullName = IO.FileUtils.GetImageFilePath(imageFile);
+
+#if Android
//璁惧鍥剧墖
- var btnpictrue = new PicViewControl(855, 570);
- btnpictrue.Gravity = Gravity.CenterHorizontal;
- btnpictrue.Y = Application.GetRealHeight(58);
- Common.LocalDevice.Current.SetRealDeviceIconToControl(btnpictrue, listNewDevice);
- bodyFrameLayout.AddChidren(btnpictrue);
+ var bim = Android.Graphics.BitmapFactory.DecodeFile(fullName);
+ var btnpictrue = new PicViewControl(bim.Width, bim.Height);
+#endif
+#if iOS
+ //璁惧鍥剧墖
+ var bim = UIKit.UIImage.FromFile(fullName);
+ var btnpictrue = new PicViewControl((int)bim.Size.Width, (int)bim.Size.Height);
+#endif
+ bim.Dispose();
+ bim = null;
+
+ btnpictrue.Gravity = Gravity.Center;
+ btnpictrue.UnSelectedImagePath = imageFile;
+ framePic.AddChidren(btnpictrue);
string nameValue = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
this.saveDefultName = nameValue;
@@ -108,18 +133,22 @@
{
foreach (var device in this.listNewDevice)
{
- var room = Common.Room.CurrentRoom.GetRoomByDevice(device);
+ if (device is OTADevice)
+ {
+ continue;
+ }
+ var room = HdlRoomLogic.Current.GetRoomByDevice(device);
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
if (room == null)
{
//杩欓噷鏈夌偣鐗规畩,濡傛灉鍥炶矾娌℃湁璁剧疆鏈夊尯鍩熺殑鏃跺��,鎵嶈缃�
listCheck.Add(mainKeys);
- Common.Room.CurrentRoom.ChangedRoom(device, roomKeys);
+ HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
}
else if (listCheck.Contains(mainKeys) == true)
{
//濡傛灉杩欎釜鍥炶矾涔嬪墠閮借繕娌℃湁鍖哄煙,鍦ㄦ湰鐣岄潰杩樻病鏈夊叧闂箣鍓�,鍙互鏃犳潯浠堕殢渚垮彉鏇�
- Common.Room.CurrentRoom.ChangedRoom(device, roomKeys);
+ HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
}
}
//淇濆瓨璁惧鎴块棿绱㈠紩
@@ -140,7 +169,7 @@
};
bodyFrameLayout.AddChidren(btnHelp);
//搴曠嚎
- int lineWidth = btnHelp.GetRealWidthByText(12);
+ int lineWidth = btnHelp.GetRealWidthByText();
var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
btnLine.Gravity = Gravity.CenterHorizontal;
@@ -213,17 +242,6 @@
}
//鏇存敼杩囦竴娆′箣鍚庯紝鍒欑晫闈㈠叧闂悗涓嶅啀鏇存敼
this.saveDefultName = string.Empty;
-
- //濡傛灉瀹冪殑鍥炶矾鍙湁涓�涓殑璇濓紝鍒欏湪璁惧涓婃姤鐨勬椂鍊欙紝淇敼MAC鍚嶅瓧涔嬪悗锛岃繛鍚岀鐐瑰悕瀛椾篃涓�璧蜂慨鏀�
- if (this.listNewDevice.Count == 1)
- {
- //淇敼绔偣鍚嶅瓧
- result = await Common.LocalDevice.Current.ReName(this.listNewDevice[0], deviceName, mode);
- if (result == false)
- {
- return;
- }
- }
}
/// <summary>
@@ -231,29 +249,15 @@
/// </summary>
private async void SetAllEpointName()
{
- var tempValue = Common.LocalDevice.Current.GetDeviceObjectText(this.listNewDevice);
- var arry = tempValue.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries);
- var objName = arry[0].Trim();
-
- //鑾峰彇璁惧绫诲瀷
- var deviceInfoType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(this.listNewDevice);
foreach (var device in this.listNewDevice)
{
- if (Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
+ if ((device is OTADevice) || Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
{
+ //鏈夊悕瀛椾笉澶勭悊
continue;
}
- var epointName = objName;
- if (this.listNewDevice.Count > 1)
- {
- if (deviceInfoType.BeloneType == Common.DeviceBeloneType.A鎸夐敭闈㈡澘 && device.Type == DeviceType.TemperatureSensor)
- {
- //闈㈡澘鐨勬渶鍚庝竴涓洖璺槸娓╁害浼犳劅鍣�
- epointName = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId11);
- }
- //XXXXX(N鍥炶矾)
- epointName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
- }
+ //鑾峰彇绔偣鍚嶅瓧
+ var epointName = Common.LocalDevice.Current.GetDeviceEpointName(device);
await Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
}
}
--
Gitblit v1.8.0