From 6144d4267f92db9be96a7003f4352732bfe9bb3b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 19 三月 2020 17:49:31 +0800
Subject: [PATCH] 2020-03-19-1
---
ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs | 617 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 354 insertions(+), 263 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
old mode 100644
new mode 100755
index 08c12ac..1b5cb52
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
@@ -2,338 +2,429 @@
using System.Collections.Generic;
using System.Globalization;
using Shared.Common;
+using Shared.Phone.UserCenter;
+using ZigBee.Device;
namespace Shared.Phone.Device.CommonForm
{
public class DeviceDetailInfo : FrameLayout
{
- public List<string> RoomNameList;
- public string BelongZoneStr;
- public Action action;
+ #region 鈼� 鍙橀噺____________________________
+ /// <summary>
+ /// bodyFrameLayout
+ /// </summary>
+ private FrameLayout bodyFrameLayout;
+ /// <summary>
+ /// 鎵�灞炲尯鍩�
+ /// </summary>
+ private string roomName;
+ /// <summary>
+ /// action
+ /// </summary>
+ public Action<CommonDevice, Common.Room> EditAction;
+ /// <summary>
+ /// curRoom
+ /// </summary>
+ private Common.Room curRoom;
+ /// <summary>
+ /// curRoom
+ /// </summary>
+ private Common.Room befRoom;
+ /// <summary>
+ /// sharedRow
+ /// </summary>
+ private DeviceInfoRow sharedRow;
+ /// <summary>
+ /// functionTypeRow
+ /// </summary>
+ private DeviceInfoRow functionTypeRow;
+
+
+ #endregion
+
+ #region 鈼� 绉婚櫎____________________________
+ /// <summary>
+ /// RemoveFromParent
+ /// </summary>
public override void RemoveFromParent()
{
- action();
+ EditAction = null;
base.RemoveFromParent();
}
+ #endregion
+
+ #region 鈼� 鏋勯�犳柟娉昣________________________
+ /// <summary>
+ /// DeviceDetailInfo
+ /// </summary>
public DeviceDetailInfo()
{
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
}
- public void Show(DeviceUI device, Common.Room room)
+
+ #endregion
+
+ #region 鈼� 鏄剧ず鐣岄潰_________________________
+ /// <summary>
+ /// Show
+ /// </summary>
+ /// <param name="device"></param>
+ /// <param name="room"></param>
+ public void Show(CommonDevice device, Common.Room room)
{
- RoomNameList = new List<string> { };
- RoomNameList = Common.Room.CurrentRoom.GetRoomListNameByDevice(device.CommonDevice);
- #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);
+ Init(device);
- 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);
+ AddTop();
- var back = new BackButton() { };
- topView.AddChidren(back);
- back.MouseUpEventHandler += (sender, e) =>
- {
- this.RemoveFromParent();
- };
- #endregion
+ AddBodyView(device,room);
- #region midFL
- var midFL = new FrameLayout()
+ }
+
+ #endregion
+
+ #region Add____________________________________
+
+ /// <summary>
+ /// AddTop
+ /// </summary>
+ public void AddTop()
+ {
+ var top = new TopFrameLayout();
+ AddChidren(top);
+ top.InitTopview();
+ top.SetTopTitle(R.MyInternationalizationString.FunctionSetting);
+ top.backButton.MouseUpEventHandler += (sender, e) =>
{
- Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
- Y = topView.Bottom,
+ RemoveFromParent();
+ };
+
+ }
+ /// <summary>
+ /// AddBodyView
+ /// </summary>
+ public void AddBodyView(CommonDevice device, Common.Room room)
+ {
+ bodyFrameLayout = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(184),
+ Height = Application.GetRealHeight(1737),
+ BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
+ };
+ AddChidren(bodyFrameLayout);
+
+ var deviceBG = new Button()
+ {
+ Y = Application.GetRealHeight(118),
+ Width = Application.GetMinRealAverage(207),
+ Height = Application.GetMinRealAverage(207),
+ Gravity = Gravity.CenterHorizontal,
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+ Radius = (uint)Application.GetMinRealAverage(207/2)
};
- this.AddChidren(midFL);
- var r = new R.MyInternationalizationString();
- object t;
- try
+ bodyFrameLayout.AddChidren(deviceBG);
+
+ var deviceBG2 = new Button()
{
- t = r.GetType().InvokeMember(device.CommonDevice.Type.ToString(), System.Reflection.BindingFlags.GetField, null, r, null);
- }
- catch
- {
- t = 11070;
- }
+ Y = Application.GetRealHeight(130),
+ Width = Application.GetMinRealAverage(184),
+ Height = Application.GetMinRealAverage(184),
+ Gravity = Gravity.CenterHorizontal,
+ BackgroundColor = ZigbeeColor.Current.GXCSelectedBackgroundColor,
+ Radius = (uint)Application.GetMinRealAverage(184/2)
+ };
+ bodyFrameLayout.AddChidren(deviceBG2);
+
var deviceIMG = new Button()
{
- Y = Application.GetRealHeight(30),
- Width = Application.GetMinRealAverage(320),
- Height = Application.GetMinRealAverage(320),
+ Y = Application.GetRealHeight(161),
+ Width = Application.GetMinRealAverage(124),
+ Height = Application.GetMinRealAverage(124),
UnSelectedImagePath = device.IconPath,
- SelectedImagePath = device.OnlineIconPath,
- IsSelected=device.CommonDevice.IsOnline==1,
Gravity = Gravity.CenterHorizontal
};
- midFL.AddChidren(deviceIMG);
+ bodyFrameLayout.AddChidren(deviceIMG);
+
+ var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device);
+
var deviceTypeName = new Button()
{
- Y = deviceIMG.Bottom,
+ Y = Application.GetRealHeight(360),
Width = Application.GetRealWidth(900),
- Height = Application.GetRealHeight(100),
+ Height = Application.GetRealHeight(80),
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- TextID = (int)t,
- Gravity = Gravity.CenterHorizontal
+ TextID = info.BeloneTextId,
+ Gravity = Gravity.CenterHorizontal,
+ TextSize = 15
};
- midFL.AddChidren(deviceTypeName);
+ bodyFrameLayout.AddChidren(deviceTypeName);
- var deviceNameFL = new FrameLayout()
- {
- Y = deviceTypeName.Bottom,
- Height = Application.GetRealHeight(170),
- };
- midFL.AddChidren(deviceNameFL);
- var deviceNameTip = new Button()
- {
- X = Application.GetRealWidth(50),
- Height = Application.GetRealHeight(70),
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 12,
- TextColor = ZigbeeColor.Current.GXCButtonTipColor,
- TextID = R.MyInternationalizationString.DeviceName,
- };
- deviceNameFL.AddChidren(deviceNameTip);
- var deviceName = new EditText()
- {
- X = Application.GetRealWidth(50),
- Y = deviceNameTip.Bottom,
- Height = Application.GetRealHeight(100) - 1,
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 20,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- Text = device.CommonDevice.DeviceEpointName,
- };
- deviceNameFL.AddChidren(deviceName);
- var deviceNameLine = new Button()
- {
- Y = deviceName.Bottom,
- Height = 1,
- BackgroundColor = ZigbeeColor.Current.GXCLineColor
- };
- deviceNameFL.AddChidren(deviceNameLine);
- var zoneFL = new FrameLayout()
+ var infoFL = new FrameLayout
{
- Y = deviceNameFL.Bottom,
- Height = Application.GetRealHeight(170),
+ Y = Application.GetRealHeight(540),
+ Height = Application.GetRealHeight(1195),
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
};
- midFL.AddChidren(zoneFL);
- var zoneTip = new Button()
- {
- X = Application.GetRealWidth(50),
- Height = Application.GetRealHeight(70),
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 12,
- TextColor = ZigbeeColor.Current.GXCButtonTipColor,
- TextID = R.MyInternationalizationString.BelongZone,
- };
- zoneFL.AddChidren(zoneTip);
- var zone = new Button()
- {
- X = Application.GetRealWidth(50),
- Y = deviceNameTip.Bottom,
- Height = Application.GetRealHeight(100) - 1,
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 20,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- Text = Common.Room.CurrentRoom.GetRoomName(RoomNameList),
- };
- zoneFL.AddChidren(zone);
- var zoneRight = new SelectedStatuButton()
- {
- X = Application.GetRealWidth(1080 - 150),
- Width = Application.GetMinRealAverage(110),
- Height = Application.GetMinRealAverage(110),
- UnSelectedImagePath = "Item/Next.png",
- SelectedImagePath="Item/NextSelected.png",
- Gravity = Gravity.CenterVertical
- };
- zoneFL.AddChidren(zoneRight);
- var zoneLine = new Button()
- {
- Y = zone.Bottom,
- Height = 1,
- BackgroundColor = ZigbeeColor.Current.GXCLineColor
- };
- zoneFL.AddChidren(zoneLine);
+ bodyFrameLayout.AddChidren(infoFL);
+ var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight;
+ infoFL.SetCornerWithSameRadius(Application.GetRealHeight(58), rectCornerID);
- var modelFL = new FrameLayout()
+ var tipBtn = new Button
{
- Y = zoneFL.Bottom,
- Height = Application.GetRealHeight(170),
- };
- midFL.AddChidren(modelFL);
- var modelTip = new Button()
- {
- X = Application.GetRealWidth(50),
- Height = Application.GetRealHeight(70),
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 12,
- TextColor = ZigbeeColor.Current.GXCButtonTipColor,
- TextID = R.MyInternationalizationString.BelongModel,
- };
- modelFL.AddChidren(modelTip);
- var model = new Button()
- {
- X = Application.GetRealWidth(50),
- Y = deviceNameTip.Bottom,
- Height = Application.GetRealHeight(100) - 1,
- Width = Application.GetRealWidth(900),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 20,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- Text = device.CommonDevice.DeviceName==""?Language.StringByID(R.MyInternationalizationString.UNKnown):device.CommonDevice.DeviceName
- };
- modelFL.AddChidren(model);
- var modelLine = new Button()
- {
- Y = model.Bottom,
- Height = 1,
- BackgroundColor = ZigbeeColor.Current.GXCLineColor
- };
- modelFL.AddChidren(modelLine);
-
- var sharedFL = new FrameLayout()
- {
- Y = modelFL.Bottom,
- Height = Application.GetRealHeight(170),
- };
- //midFL.AddChidren(sharedFL);
- var sharedBtn = new Button()
- {
- X = Application.GetRealWidth(50),
- Y = Application.GetRealHeight(70),
- Height = Application.GetRealHeight(100) - 1,
+ X = Application.GetRealWidth(CommonFormResouce.X_Left),
+ Y = Application.GetRealHeight(81),
Width = Application.GetRealWidth(500),
+ Height = Application.GetRealHeight(60),
+ TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor,
TextAlignment = TextAlignment.CenterLeft,
- TextSize = 20,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- TextID = R.MyInternationalizationString.Shared
+ TextSize = 15,
+ TextID = R.MyInternationalizationString.EditInfo
};
- sharedFL.AddChidren(sharedBtn);
+ infoFL.AddChidren(tipBtn);
- var sharedRight = new Button()
+ var infoScrolView = new VerticalScrolViewLayout
{
- X = Application.GetRealWidth(1080 - 150),
- Width = Application.GetMinRealAverage(110),
- Height = Application.GetMinRealAverage(110),
- UnSelectedImagePath = "Item/Next.png",
- Gravity = Gravity.CenterVertical
+ Y = Application.GetRealHeight(170-12),
+ Height = Application.GetRealHeight(600),
+ ScrollEnabled = false,
+ VerticalScrollBarEnabled = false
};
- sharedFL.AddChidren(sharedRight);
+ infoFL.AddChidren(infoScrolView);
- var sharedNum = new Button()
+ var nameFL = new FrameLayout
{
- X = Application.GetRealWidth(1080 - 150 - 110),
- Width = Application.GetRealWidth(110),
- Height = Application.GetRealHeight(110),
- TextAlignment = TextAlignment.CenterRight,
- TextSize = 12,
- TextColor = ZigbeeColor.Current.GXCButtonTipColor,
- Text = "1浜�",
- Gravity = Gravity.CenterVertical
+ Height = Application.GetRealHeight(127 + 12)
};
- sharedFL.AddChidren(sharedNum);
+ infoScrolView.AddChidren(nameFL);
+ var nameRow = new DeviceInfoEditRow(12);
+ nameRow.Init();
+ nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : ");
+ nameRow.SetTitle(string.IsNullOrEmpty(Common.LocalDevice.Current.GetDeviceEpointName(device)) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : Common.LocalDevice.Current.GetDeviceEpointName(device));
+ nameFL.AddChidren(nameRow);
- var sharedLine = new Button()
+
+ var zoneFL = new FrameLayout
{
- Y = sharedBtn.Bottom,
- Height = 1,
- BackgroundColor = ZigbeeColor.Current.GXCLineColor
+ Height = Application.GetRealHeight(127 + 12)
};
- sharedFL.AddChidren(sharedLine);
-
- var confirmBtn = new CommonForm.CompleteButton()
+ if (room != null && room.IsLove == false)
{
+ infoScrolView.AddChidren(zoneFL);
+ }
+ var zoneRow = new DeviceInfoRow(12);
+ zoneRow.Init();
+ zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)} : ");
+ zoneRow.SetTitle(roomName);
+ zoneFL.AddChidren(zoneRow);
+
+ var modelFL = new FrameLayout
+ {
+ Height = Application.GetRealHeight(127 + 12)
};
- AddChidren(confirmBtn);
+ infoScrolView.AddChidren(modelFL);
+ var modelRow = new DeviceInfoRow(12);
+ modelRow.Init();
+ modelRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongModel)} : ");
+ modelRow.SetTitle(string.IsNullOrEmpty(device.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.DeviceName);
+ modelRow.HideNext(true);
+ modelFL.AddChidren(modelRow);
- confirmBtn.MouseUpEventHandler += async (sender, e) =>
+ if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch)
{
- if (device.CommonDevice == null)
+ var typeFL = new FrameLayout
{
- CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
- return;
+ Height = Application.GetRealHeight(127 + 12)
+ };
+ infoScrolView.AddChidren(typeFL);
+ functionTypeRow = new DeviceInfoRow(12);
+ functionTypeRow.Init();
+ functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : ");
+ //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType);
+ typeFL.AddChidren(functionTypeRow);
+ var dfunctionType = device.DfunctionType;
+
+ //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
+ string strT = string.Empty;
+ if (dfunctionType == DeviceFunctionType.A鐏厜)
+ {
+ strT = Language.StringByID(R.MyInternationalizationString.uLight);
}
- var result = await Shared.Common.LocalDevice.Current.ReName(device.CommonDevice, deviceName.Text.Trim());
- if (result)
+ else if (dfunctionType == DeviceFunctionType.A寮�鍏�)
{
- var alertSuccess = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.Success), Language.StringByID(R.MyInternationalizationString.Confrim));
- alertSuccess.Show();
- alertSuccess.ResultEventHandler += (senderSuccess, eSuccess) =>
+ strT = Language.StringByID(R.MyInternationalizationString.uSwitch);
+ }
+ else if (dfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ strT = Language.StringByID(R.MyInternationalizationString.uSocket1);
+ }
+ functionTypeRow.SetTitle(strT);
+
+ functionTypeRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ var DfunctionType = device.DfunctionType;
+
+ //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
+ int nowSelectNo = 1;
+ string strType = string.Empty;
+ if (DfunctionType == DeviceFunctionType.A鐏厜)
{
- //鏀瑰浘鐗�
- device.IconPath = deviceIMG.UnSelectedImagePath;
- device.IsCustomizeImage = true;
- device.ReSave();
- //鏀规埧闂�
- Shared.Common.Room.CurrentRoom.ChangedRoom(device.CommonDevice, RoomNameList);
- RemoveFromParent();
+ strType = Language.StringByID(R.MyInternationalizationString.uLight);
+ nowSelectNo = 1;
+ }
+ else if (DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
+ nowSelectNo = 0;
+ }
+ else if (DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
+ nowSelectNo = 2;
+ }
+ //鏄剧ず鍒楄〃
+ var listText = new List<string>();
+ listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏�
+ listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜
+ listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇
+ //鏍囬:閫夋嫨鍔熻兘绫诲瀷
+ var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType);
+
+ var form = new BottomItemSelectForm();
+ form.AddForm(title, listText, nowSelectNo);
+ form.FinishSelectEvent += (selectNo) =>
+ {
+ functionTypeRow.NameText.Text = listText[selectNo];
+ nowSelectNo = selectNo;
+ //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
+ if (selectNo == 0)
+ {
+ device.DfunctionType = DeviceFunctionType.A寮�鍏�;
+ }
+ else if (selectNo == 1)
+ {
+ device.DfunctionType = DeviceFunctionType.A鐏厜;
+ }
+ else
+ {
+ device.DfunctionType = DeviceFunctionType.A鎻掑骇;
+ }
};
- }
- else
- {
- return;
- //CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
- }
- };
- #endregion
+ };
+ }
+
+
+ var confirmBtn = new CommonForm.CompleteButton(962, 900, 127);
+ confirmBtn.SetTitle(R.MyInternationalizationString.Save);
+ infoFL.AddChidren(confirmBtn);
#region event
EventHandler<MouseEventArgs> selectZoneEvent = (sender, e) =>
{
- UserCenter.SelectRoomForm selectedRoom = new UserCenter.SelectRoomForm();
- selectedRoom.AddForm(selectedRoom, RoomNameList);
- selectedRoom.ActionSelectRoom += ((rList) =>
+ var zone = new SelectZone();
+ zone.Init();
+ zone.ZoneAction += (selectRoom) =>
{
- RoomNameList = rList;
- zone.Text = Shared.Common.Room.CurrentRoom.GetRoomName(RoomNameList);
- });
+ curRoom = selectRoom;
+ zoneRow.SetTitle(HdlRoomLogic.Current.GetZoneName(selectRoom));
+ };
};
- zoneRight.MouseUpEventHandler += selectZoneEvent;
- zoneFL.MouseUpEventHandler += selectZoneEvent;
- zone.MouseUpEventHandler += selectZoneEvent;
+ zoneRow.ClickBtn.MouseUpEventHandler += selectZoneEvent;
EventHandler<MouseEventArgs> selectDeviceIconEvent = (sender, e) =>
- {
- var localPic = new DeviceIconSelectedIMGByLocal();
- UserView.HomePage.Instance.AddChidren(localPic);
- UserView.HomePage.Instance.PageIndex += 1;
- localPic.Show();
- localPic.action = (unSelectedImagePath,selectedImagePath) =>
- {
- deviceIMG.UnSelectedImagePath = unSelectedImagePath;
- deviceIMG.SelectedImagePath = selectedImagePath;
- };
- };
+ {
+ var localPic = new DeviceIconSelectedIMGByLocal();
+ UserView.HomePage.Instance.AddChidren(localPic);
+ UserView.HomePage.Instance.PageIndex += 1;
+ localPic.Show();
+ localPic.action = (unSelectedImagePath, selectedImagePath) =>
+ {
+ deviceIMG.UnSelectedImagePath = unSelectedImagePath;
+ deviceIMG.SelectedImagePath = selectedImagePath;
+ device.IsCustomizeImage = true;
+ };
+ };
deviceIMG.MouseUpEventHandler += selectDeviceIconEvent;
+
+ confirmBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ try
+ {
+ CommonPage.Loading.Start();
+ if (device == null)
+ {
+ CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain));
+ return;
+ }
+ if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch)
+ {
+ if (device.IsCustomizeImage == false)
+ {
+ if (device.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ device.IconPath = "Device/Switch.png";
+ }
+ else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ device.IconPath = "Device/Socket1.png";
+ }
+ else if (device.DfunctionType == DeviceFunctionType.A鐏厜)
+ {
+ device.IconPath = "Device/Light.png";
+ }
+ }
+ else
+ {
+ //鏀瑰浘鐗�
+ device.IconPath = deviceIMG.UnSelectedImagePath;
+ }
+ }
+ else
+ {
+ //鏀瑰浘鐗�
+ device.IconPath = deviceIMG.UnSelectedImagePath;
+ }
+ bool result;
+ new System.Threading.Thread(async () =>
+ {
+ result = await LocalDevice.Current.ReName(device, nameRow.NameText.Text.Trim());
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ if (result)
+ {
+ //鏀规埧闂�
+ HdlRoomLogic.Current.ChangedRoom(device, curRoom.Id);
+ device.ReSave();
+ EditAction?.Invoke(device, curRoom);
+ RemoveFromParent();
+ }
+ else
+ {
+ CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain));
+ }
+ });
+ })
+ { IsBackground = true }.Start();
+ }
+ catch
+ {
+ CommonPage.Loading.Hide();
+ }
+ };
#endregion
}
+
+ /// <summary>
+ /// Init
+ /// </summary>
+ /// <param name="device"></param>
+ public void Init(CommonDevice device)
+ {
+ roomName = HdlRoomLogic.Current.GetRoomNameByDevice(device, "锛�");
+ befRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
+ curRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
+ }
+ #endregion
}
}
--
Gitblit v1.8.0