From fa6bcb2e9907772480f99205f36ec2a1ce735a22 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 09 一月 2020 14:11:07 +0800 Subject: [PATCH] 合并代码 --- ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs | 94 ++++++++++++++++++----------------------------- 1 files changed, 36 insertions(+), 58 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs index 518bdb0..b5acaf1 100755 --- a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs @@ -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(); @@ -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); } } @@ -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); } } -- Gitblit v1.8.0