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/Device/CommonForm/DeviceDetailInfo.cs | 642 ++++++++++++++++++++++++++++++++++------------------------
1 files changed, 376 insertions(+), 266 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
index 384e134..b992f88 100755
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
@@ -2,338 +2,448 @@
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;
+ #region 鈼� 鍙橀噺____________________________
+ /// <summary>
+ /// bodyFrameLayout
+ /// </summary>
+ private FrameLayout bodyFrameLayout;
+ /// <summary>
+ /// 鎵�灞炲尯鍩�
+ /// </summary>
+ private string roomName;
+ /// <summary>
+ /// action
+ /// </summary>
public Action action;
+ /// <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();
base.RemoveFromParent();
}
+ #endregion
+
+ #region 鈼� 鏋勯�犳柟娉昣________________________
+ /// <summary>
+ /// DeviceDetailInfo
+ /// </summary>
public DeviceDetailInfo()
{
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
}
+
+ #endregion
+
+ #region 鈼� 鏄剧ず鐣岄潰_________________________
+ /// <summary>
+ /// Show
+ /// </summary>
+ /// <param name="device"></param>
+ /// <param name="room"></param>
public void Show(DeviceUI 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);
- #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(DeviceUI device)
+ {
+ 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)
};
- 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)
+ };
+ 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 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,
+ Text = DeviceUI.GetDeviceTypeName(device.CommonDevice.Type),
Gravity = Gravity.CenterHorizontal
};
- 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(50), 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()
- {
- X = Application.GetRealWidth(1080 - 150),
- Width = Application.GetMinRealAverage(110),
- Height = Application.GetMinRealAverage(110),
- UnSelectedImagePath = "Item/Next.png",
- Gravity = Gravity.CenterVertical
- };
- sharedFL.AddChidren(sharedRight);
+ var nameRow = new DeviceInfoEditRow(170);
+ nameRow.Init();
+ nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : ");
+ nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName);
+ infoFL.AddChidren(nameRow);
- var sharedNum = new Button()
- {
- 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
- };
- sharedFL.AddChidren(sharedNum);
+ var zoneRow = new DeviceInfoRow(308);
+ zoneRow.Init();
+ zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)} : ");
+ zoneRow.SetTitle(roomName);
+ infoFL.AddChidren(zoneRow);
- var sharedLine = new Button()
- {
- Y = sharedBtn.Bottom,
- Height = 1,
- BackgroundColor = ZigbeeColor.Current.GXCLineColor
- };
- sharedFL.AddChidren(sharedLine);
+ var modelRow = new DeviceInfoRow(446);
+ modelRow.Init();
+ modelRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongModel)} : ");
+ modelRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceName);
+ modelRow.HideNext(true);
+ infoFL.AddChidren(modelRow);
- var confirmBtn = new CommonForm.CompleteButton()
+ if (device.CommonDevice.Type==ZigBee.Device.DeviceType.OnOffOutput)
{
- };
- AddChidren(confirmBtn);
+ functionTypeRow = new DeviceInfoRow(585);
+ functionTypeRow.Init();
+ functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : ");
+ //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType);
+ infoFL.AddChidren(functionTypeRow);
+ var dfunctionType = device.CommonDevice.DfunctionType;
- confirmBtn.MouseUpEventHandler += async (sender, e) =>
- {
- if (device.CommonDevice == null)
+ //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
+ string strT = string.Empty;
+ if (dfunctionType == DeviceFunctionType.A鐏厜)
{
- CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
- return;
+ 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.CommonDevice.DfunctionType;
+
+ //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
+ int nowSelectNo = 1;
+ string strType = string.Empty;
+ if (DfunctionType == DeviceFunctionType.A鐏厜)
{
- //鏀瑰浘鐗�
- device.CommonDevice.IconPath = deviceIMG.UnSelectedImagePath;
- device.CommonDevice.IsCustomizeImage = true;
- device.CommonDevice.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.CommonDevice.DfunctionType = DeviceFunctionType.A寮�鍏�;
+ }
+ else if (selectNo == 1)
+ {
+ device.CommonDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ }
+ else
+ {
+ device.CommonDevice.DfunctionType = DeviceFunctionType.A鎻掑骇;
+ }
};
- }
- else
- {
- return;
- //CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
- }
- };
- #endregion
+ };
+
+ //sharedRow = new DeviceInfoRow(723);
+ //sharedRow.Init();
+ //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : ");
+ //sharedRow.SetTitle("2浜�");
+ //infoFL.AddChidren(sharedRow);
+ }
+ else
+ {
+ //sharedRow = new DeviceInfoRow(585);
+ //sharedRow.Init();
+ //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : ");
+ //sharedRow.SetTitle("2浜�");
+ //infoFL.AddChidren(sharedRow);
+ }
+
+ var confirmBtn = new CommonForm.CompleteButton(962, 907, 127);
+ confirmBtn.SetTitle(R.MyInternationalizationString.Confrim);
+ infoFL.AddChidren(confirmBtn);
#region event
EventHandler<MouseEventArgs> selectZoneEvent = (sender, e) =>
{
- UserCenter.SelectRoomForm selectedRoom = new UserCenter.SelectRoomForm();
- selectedRoom.AddForm(selectedRoom, RoomNameList);
- selectedRoom.ActionSelectRoom += ((rList) =>
+ List<string> floorIds = new List<string> { };
+ List<string> floorNames = new List<string> { };
+ List<List<string>> roomNames = new List<List<string>> { };
+ List<List<Common.Room>> rooms = new List<List<Common.Room>> { };
+ List<Common.Room> rs = new List<Common.Room> { };
+ List<string> rNames = new List<string> { };
+ if (Config.Instance.Home.FloorDics.Count>0)
{
- RoomNameList = rList;
- zone.Text = Shared.Common.Room.CurrentRoom.GetRoomName(RoomNameList);
- });
+ foreach (var floor in Config.Instance.Home.FloorDics)
+ {
+ floorIds.Add(floor.Key);
+ floorNames.Add(floor.Value);
+ if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0)
+ {
+ roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key));
+ rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key));
+ }
+ }
+ PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) =>
+ {
+ curRoom = rooms[index1][index2];
+ zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(floorIds[index1])} , {rooms[index1][index2].Name}");
+ }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongFloor),
+ Language.StringByID(R.MyInternationalizationString.Confrim),
+ Language.StringByID(R.MyInternationalizationString.Cancel));
+ }
+ else
+ {
+ for(int i=0;i<Common.Room.Lists.Count;i++)
+ {
+ var r = Common.Room.Lists[i];
+ if (r.IsLove)
+ {
+ continue;
+ }
+ rs.Add(r);
+ rNames.Add(r.Name);
+ }
+ PickerView.Show(rNames, (index1) =>
+ {
+ curRoom = rs[index1];
+ zoneRow.SetTitle(rs[index1].Name);
+ }, 0,Language.StringByID(R.MyInternationalizationString.BelongFloor),
+ Language.StringByID(R.MyInternationalizationString.Confrim),
+ Language.StringByID(R.MyInternationalizationString.Cancel));
+ }
};
- 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.CommonDevice.IsCustomizeImage = true;
+ };
+ };
deviceIMG.MouseUpEventHandler += selectDeviceIconEvent;
+
+ confirmBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ try
+ {
+ CommonPage.Loading.Start();
+ if (device.CommonDevice == null)
+ {
+ CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
+ return;
+ }
+ if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput)
+ {
+ if (device.IsCustomizeImage == false)
+ {
+ if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ device.CommonDevice.IconPath = "Device/Switch.png";
+ }
+ else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ device.CommonDevice.IconPath = "Device/Socket1.png";
+ }
+ else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鐏厜)
+ {
+ device.CommonDevice.IconPath = "Device/Light.png";
+ }
+ }
+ else
+ {
+ //鏀瑰浘鐗�
+ device.CommonDevice.IconPath = deviceIMG.UnSelectedImagePath;
+ }
+ }
+ else
+ {
+ //鏀瑰浘鐗�
+ device.CommonDevice.IconPath = deviceIMG.UnSelectedImagePath;
+ }
+ bool result;
+ new System.Threading.Thread(async () =>
+ {
+ result = await LocalDevice.Current.ReName(device.CommonDevice, nameRow.NameText.Text.Trim());
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ if (result)
+ {
+ 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) =>
+ {
+ //鏀规埧闂�
+ Shared.Common.Room.CurrentRoom.ChangedRoom(device.CommonDevice, curRoom.Id);
+ device.CommonDevice.ReSave();
+ RemoveFromParent();
+ };
+ }
+ else
+ {
+ CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
+ }
+ });
+ })
+ { IsBackground = true }.Start();
+ }
+ catch
+ {
+ CommonPage.Loading.Hide();
+ }
+ };
#endregion
}
+
+ /// <summary>
+ /// Init
+ /// </summary>
+ /// <param name="device"></param>
+ public void Init(DeviceUI device)
+ {
+ roomName = device.GetZone();
+ befRoom = Common.Room.CurrentRoom.GetRoomByDevice(device.CommonDevice);
+ curRoom = Common.Room.CurrentRoom.GetRoomByDevice(device.CommonDevice);
+ }
+ #endregion
}
}
--
Gitblit v1.8.0