From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs | 104 ++++++++++++++++++++-------------------------------
1 files changed, 41 insertions(+), 63 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
index 518bdb0..0fdeede 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs
@@ -159,7 +159,7 @@
{
if (targetDevice.DeviceUI == null || targetDevice.DeviceUI.CommonDevice == null) continue;
devImgPath = targetDevice.DeviceUI.IconPath;
- devNameText = targetDevice.DeviceUI.CommonDevice.DeviceEpointName;
+ devNameText = Common.LocalDevice.Current.GetDeviceEpointName(targetDevice.DeviceUI.CommonDevice);
var targetRow = new SceneTargetFunctionRow(13);
targetRow.Init();
@@ -354,16 +354,26 @@
};
bodyFrameLayout.AddChidren(imgFL);
+ var backGround1 = new ImageView()
+ {
+ Y = Application.GetRealHeight(46),
+ Width = Application.GetMinRealAverage(916),
+ Height = Application.GetMinRealAverage(487),
+ Gravity = Gravity.CenterHorizontal,
+ ImagePath = "Room/Room_Rectangle.png"
+ };
+ imgFL.AddChidren(backGround1);
+
backGround = new ImageView()
{
- Width = Application.GetMinRealAverage(930),
- Height = Application.GetMinRealAverage(464),
- Gravity = Gravity.Center,
+ Y = Application.GetRealHeight(46),
+ Width = Application.GetMinRealAverage(887),
+ Height = Application.GetMinRealAverage(444),
+ Gravity = Gravity.CenterHorizontal,
Radius = (uint)Application.GetMinRealAverage(CommonFormResouce.BigFormRadius),
ImagePath = "SceneIcon/3.jpg"
};
imgFL.AddChidren(backGround);
- backGround.SetViewShadow(true);
var infoFL = new FrameLayout
{
@@ -604,6 +614,10 @@
//閫氳繃鐩告満鎷嶇収瑁佸壀
CropImage.TakePicture((imagePath) =>
{
+ if (string.IsNullOrEmpty(imagePath))
+ {
+ return;
+ }
if (isModify)
{
if (IconPathType != 0)
@@ -629,6 +643,10 @@
//浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀
CropImage.SelectPicture((imagePath) =>
{
+ if (string.IsNullOrEmpty(imagePath))
+ {
+ return;
+ }
if (isModify)
{
if (IconPathType != 0)
@@ -660,53 +678,13 @@
//鍖哄煙
EventHandler<MouseEventArgs> zoneHander = (sender, e) =>
{
- 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)
+ var zone = new SelectZone();
+ zone.Init();
+ zone.ZoneAction += (selectRoom) =>
{
- foreach (var floor in Config.Instance.Home.FloorDics)
- {
- if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0)
- {
- floorIds.Add(floor.Key);
- floorNames.Add(floor.Value);
-
- 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.BelongZone),
- 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.BelongZone),
- Language.StringByID(R.MyInternationalizationString.Confrim),
- Language.StringByID(R.MyInternationalizationString.Cancel));
- }
+ curRoom = selectRoom;
+ zoneRow.SetTitle(selectRoom.GetZoneName());
+ };
};
zoneRow.ClickBtn.MouseUpEventHandler += zoneHander;
@@ -919,13 +897,12 @@
if (OldIconPathType != 0)
{
Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath));
- HdlAutoBackupLogic.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath));
-
+ HdlAutoBackupLogic.DeleteFile(OldBackgroundImagePath);
}
if (IconPathType == 1 || IconPathType == 2)
{
Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
- HdlAutoBackupLogic.AddOrEditorFile(System.IO.Path.Combine(Config.Instance.FullPath, fileName));
+ HdlAutoBackupLogic.AddOrEditorFile(fileName);
modifySceneUI.IconPath = fileName;
}
else
@@ -1078,6 +1055,7 @@
if (IconPathType == 1 || IconPathType == 2)
{
Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
+ HdlAutoBackupLogic.AddOrEditorFile(fileName);
imgPath = fileName;
}
else
@@ -1138,7 +1116,7 @@
}
}
- var result = await curRoom.AddScene(nameRow.NameText.Text, imgPath, memberDataList);
+ var result = await curRoom.AddScene(nameRow.NameText.Text, imgPath, memberDataList, IconPathType);
if (result == 1)
{
AddAction?.Invoke();
@@ -1266,7 +1244,7 @@
Gravity = Gravity.CenterHorizontal,
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
TextSize = 16,
- Text = device.CommonDevice.DeviceEpointName
+ Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
};
titleFL.AddChidren(deviceName);
@@ -1422,7 +1400,7 @@
Gravity = Gravity.CenterHorizontal,
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
TextSize = 16,
- Text = device.CommonDevice.DeviceEpointName
+ Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
};
titleFL.AddChidren(deviceName);
@@ -1475,7 +1453,7 @@
dialog.RemoveFromParent();
};
- open.SeekBar.ProgressChanged += (sender, e) =>
+ open.SeekBar.OnProgressChangedEvent += (sender, e) =>
{
open.IsSelected = true;
shut.IsSelected = false;
@@ -1493,7 +1471,7 @@
{
open.IsSelected = true;
shut.IsSelected = false;
- open.SetProgress(sceneTarget.TaskList[0].Data2);
+ open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2);
}
}
@@ -1588,7 +1566,7 @@
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
TextSize = 16,
TextAlignment = TextAlignment.CenterLeft,
- Text = device.CommonDevice.DeviceEpointName
+ Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
};
titleFL.AddChidren(deviceName);
@@ -1641,7 +1619,7 @@
dialog.RemoveFromParent();
};
- open.SeekBar.ProgressChanged += (sender, e) =>
+ open.SeekBar.OnProgressChangedEvent += (sender, e) =>
{
open.IsSelected = true;
shut.IsSelected = false;
@@ -1659,7 +1637,7 @@
{
open.IsSelected = true;
shut.IsSelected = false;
- open.SetProgress(sceneTarget.TaskList[0].Data1);
+ open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1);
}
}
@@ -1761,7 +1739,7 @@
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
TextSize = 16,
TextAlignment = TextAlignment.CenterLeft,
- Text = device.CommonDevice.DeviceEpointName
+ Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice)
};
titleFL.AddChidren(deviceName);
--
Gitblit v1.8.0