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/Room/EditRoom.cs | 74 ++++++++++++++++++++++---------------
1 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index a9e7def..21b0e95 100755
--- a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -33,7 +33,17 @@
/// <summary>
/// IconPathType
/// </summary>
- public int IconPathType = 0;
+ public int IconPathType;
+ /// <summary>
+ /// OldBackgroundImagePath
+ /// </summary>
+ private string OldBackgroundImagePath;
+
+ /// <summary>
+ /// OldIconPathType
+ /// </summary>
+ public int OldIconPathType;
+
#endregion
@@ -49,6 +59,11 @@
{
room = r;
IconPathType = r.BackgroundImageType;
+ OldIconPathType= r.BackgroundImageType;
+ if (IconPathType != 1)
+ {
+ OldBackgroundImagePath = r.BackgroundImage;
+ }
AddTop();
AddBodyView();
@@ -57,9 +72,10 @@
public override void RemoveFromParent()
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+ CommonPage.Instance.IsDrawerLockMode = false;
base.RemoveFromParent();
}
@@ -93,16 +109,6 @@
};
AddChidren(bodyFrameLayout);
- var imgFL = new Button
- {
- Y = Application.GetRealHeight(60),
- Width = Application.GetMinRealAverage(916),
- Height = Application.GetMinRealAverage(487),
- Gravity = Gravity.CenterHorizontal,
- UnSelectedImagePath = "Room/Room_Rectangle.png"
- };
- bodyFrameLayout.AddChidren(imgFL);
-
backGround = new Button()
{
Y = Application.GetRealHeight(60),
@@ -113,6 +119,7 @@
UnSelectedImagePath = room.BackgroundImage
};
bodyFrameLayout.AddChidren(backGround);
+ backGround.SetViewShadow(true);
backGround.MouseUpEventHandler += backGroundIMGHander;
var infoFL = new FrameLayout
@@ -122,6 +129,8 @@
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
};
bodyFrameLayout.AddChidren(infoFL);
+ var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight;
+ infoFL.SetCornerWithSameRadius(Application.GetRealHeight(50), rectCornerID);
var infoEdit = new Button
{
@@ -173,7 +182,6 @@
var temperatureRow = new DeviceInfoRow(446);
temperatureRow.Init();
temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature);
- temperatureRow.SetTitle("26.8鈩�");
temperatureRow.NameText.TextAlignment = TextAlignment.CenterRight;
infoFL.AddChidren(temperatureRow);
temperatureRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
@@ -191,8 +199,8 @@
}
room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, ((report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.TemperatrueDevice != mainKeys)
@@ -200,7 +208,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
@@ -236,8 +244,8 @@
if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.TemperatrueDevice != mainKeys)
@@ -245,7 +253,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
@@ -285,7 +293,6 @@
var humidityRow = new DeviceInfoRow(585);
humidityRow.Init();
humidityRow.SetTipTitle(R.MyInternationalizationString.Humidity);
- humidityRow.SetTitle("66.5%");
humidityRow.NameText.TextAlignment = TextAlignment.CenterRight;
infoFL.AddChidren(humidityRow);
humidityRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
@@ -293,6 +300,7 @@
var tem = new RoomHumiditySetting { };
HomePage.Instance.AddChidren(tem);
HomePage.Instance.PageIndex += 1;
+ tem.tempDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
tem.Show(room);
tem.selectDeviceAction = (selectTemp) =>
{
@@ -302,8 +310,8 @@
}
room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.HumidityDevice != mainKeys)
@@ -311,7 +319,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
@@ -337,8 +345,8 @@
};
if (string.IsNullOrEmpty(room.HumidityDevice) == false)
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.HumidityDevice != mainKeys)
@@ -346,7 +354,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
@@ -381,8 +389,12 @@
confirm.MouseUpEventHandler += (sender, e) =>
{
var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
- var fileName = $"Room_{tradeTime}";
+ var fileName = $"RoomIcon_{tradeTime}.png";
room.Name = nameRow.NameText.Text.Trim();
+ if (OldIconPathType != 1)
+ {
+ Shared.IO.FileUtils.DeleteFile(OldBackgroundImagePath);
+ }
if (IconPathType == 0)
{
room.BackgroundImage = backGround.UnSelectedImagePath;
@@ -394,6 +406,7 @@
}
room.BackgroundImageType = IconPathType;
room.Save();
+ action?.Invoke();
RemoveFromParent();
};
@@ -495,6 +508,7 @@
localPic.action = (imgPath) =>
{
IconPathType = 0;
+ backGround.ImageBytes = null;
backGround.UnSelectedImagePath = imgPath;
};
};
@@ -502,7 +516,7 @@
{
selectFL.RemoveFromParent();
var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
- var fileName = $"Room_{tradeTime}";
+ var fileName = $"RoomIcon_{tradeTime}.png";
//閫氳繃鐩告満鎷嶇収瑁佸壀
CropImage.TakePicture((imagePath) =>
{
@@ -523,7 +537,7 @@
{
selectFL.RemoveFromParent();
var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
- var fileName = $"Room_{tradeTime}";
+ var fileName = $"RoomIcon_{tradeTime}.png";
//浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀
CropImage.SelectPicture((imagePath) =>
{
--
Gitblit v1.8.0