From c7698e163e43cea9e7f8ee45f8e3f91c9265cca4 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 04 十一月 2019 19:11:41 +0800 Subject: [PATCH] 合并了全部的代码 --- ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs | 242 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 191 insertions(+), 51 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs index 8d287f2..2cbca49 100755 --- a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs @@ -15,22 +15,22 @@ /// bodyFrameLayout /// </summary> private FrameLayout bodyFrameLayout; - /// <summary> - /// floorIds - /// </summary> - List<string> floorIds = new List<string> { }; - /// <summary> - /// floorNames - /// </summary> - List<string> floorNames = new List<string> { }; - /// <summary> - /// roomNames - /// </summary> - List<List<string>> roomNames = new List<List<string>> { }; - /// <summary> - /// roomNames - /// </summary> - List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; + ///// <summary> + ///// floorIds + ///// </summary> + //List<string> floorIds = new List<string> { }; + ///// <summary> + ///// floorNames + ///// </summary> + //List<string> floorNames = new List<string> { }; + ///// <summary> + ///// roomNames + ///// </summary> + //List<List<string>> roomNames = new List<List<string>> { }; + ///// <summary> + ///// roomNames + ///// </summary> + //List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; /// <summary> /// ImagePath /// </summary> @@ -273,16 +273,16 @@ /// </summary> private void Init() { - 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)); - } - } + //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)); + // } + //} } /// <summary> @@ -370,7 +370,7 @@ zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)}:"); //zoneRow.SetTitle(curRoom.Name); infoFL.AddChidren(zoneRow); - zoneRow.HideLine(false); + zoneRow.HideLine(true); var targetFL = new FrameLayout() { @@ -452,43 +452,182 @@ //閫夋嫨鑳屾櫙鍥� EventHandler<MouseEventArgs> backGroundIMGHander = (sender, e) => { - if (curRoom == null) - { - RoomCommon.ShowTipNoRoom(); - return; - } - if (curRoom.IsSharedRoom) + if (curRoom != null && curRoom.IsSharedRoom) { RoomCommon.ShowTipRoomIsShared(); return; } - var localPic = new CategorySceneSelectImgByLocal(); - Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - localPic.Show(); - localPic.action = (imgPath) => + int selectRow_Height = 150; + int selectRow_Width = 1034; + var selectFL = new FrameLayout() { - IconPathType = 0; - backGround.UnSelectedImagePath = imgPath; + BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor + }; + AddChidren(selectFL); + + var itemFL = new FrameLayout() + { + Y = Application.GetRealHeight(1276), + Height = Application.GetRealHeight(450), + Width = Application.GetRealWidth(selectRow_Width), + Gravity = Gravity.CenterHorizontal, + Radius = (uint)Application.GetRealHeight(17), + BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor + }; + selectFL.AddChidren(itemFL); + itemFL.Animate = Animate.DownToUp; + + var selectLocalPicture = new Button() + { + Height = Application.GetRealHeight(selectRow_Height) - 1, + TextID = R.MyInternationalizationString.LocalPicture, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 + }; + itemFL.AddChidren(selectLocalPicture); + var selectLocalLine = new Button() + { + Y = selectLocalPicture.Bottom, + Height = 1, + BackgroundColor = ZigbeeColor.Current.GXCLineColor + }; + itemFL.AddChidren(selectLocalLine); + + var selectPhotographBtn = new Button() + { + Y = selectLocalLine.Bottom, + Height = Application.GetRealHeight(selectRow_Height) - 1, + TextID = R.MyInternationalizationString.Photograph, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 + }; + itemFL.AddChidren(selectPhotographBtn); + var selectPhotographLine = new Button() + { + Y = selectPhotographBtn.Bottom, + Height = 1, + BackgroundColor = ZigbeeColor.Current.GXCLineColor, + }; + itemFL.AddChidren(selectPhotographLine); + + var selectAblumsBtn = new Button() + { + Y = selectPhotographLine.Bottom, + Height = Application.GetRealHeight(selectRow_Height) - 1, + TextID = R.MyInternationalizationString.MyAblums, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 + }; + itemFL.AddChidren(selectAblumsBtn); + + var cancelBtn = new Button() + { + Y = Application.GetRealHeight(1742), + Height = Application.GetRealHeight(selectRow_Height), + Width = Application.GetRealWidth(selectRow_Width), + Gravity = Gravity.CenterHorizontal, + TextID = R.MyInternationalizationString.Cancel, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, + BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor, + Radius = (uint)Application.GetRealHeight(17) + }; + selectFL.AddChidren(cancelBtn); + + selectLocalPicture.MouseUpEventHandler += (send, ee) => + { + selectFL.RemoveFromParent(); + var localPic = new CategorySceneSelectImgByLocal(); + Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + localPic.Show(); + localPic.action = (imgPath) => + { + IconPathType = 0; + backGround.UnSelectedImagePath = imgPath; + }; + }; + selectPhotographBtn.MouseUpEventHandler += (send, ee) => + { + selectFL.RemoveFromParent(); + IconPathType = 1; + //閫氳繃鐩告満鎷嶇収瑁佸壀 + CropImage.TakePicture((imagePath) => + { + Console.WriteLine("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + }, "HDLPIC"); + }; + + selectAblumsBtn.MouseUpEventHandler += (send, ee) => + { + selectFL.RemoveFromParent(); + IconPathType = 2; + //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 + CropImage.SelectPicture((imagePath) => + { + Console.WriteLine("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + }, "HDLPIC"); }; + cancelBtn.MouseUpEventHandler += (send, ee) => + { + selectFL.RemoveFromParent(); + }; + selectFL.MouseUpEventHandler += (send, ee) => + { + selectFL.RemoveFromParent(); + }; }; backGround.MouseUpEventHandler += backGroundIMGHander; //鍖哄煙 EventHandler<MouseEventArgs> zoneHander = (sender, e) => { - PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) => + 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) { - curRoom = rooms[index1][index2]; - zoneRow.NameText.Text = $"{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)); + 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)); + } }; - zoneRow.NextBtn.MouseUpEventHandler += zoneHander; - zoneRow.TipBtn.MouseUpEventHandler += zoneHander; - zoneRow.NameText.MouseUpEventHandler += zoneHander; - zoneRow.MouseUpEventHandler += zoneHander; + zoneRow.ClickBtn.MouseUpEventHandler += zoneHander; //鎵ц鐩爣-娣诲姞鎵ц璁惧 EventHandler<MouseEventArgs> targetAddHander = (sender, e) => @@ -523,6 +662,7 @@ BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor }; selectFL.AddChidren(itemFL); + itemFL.Animate = Animate.DownToUp; var selectedFunctionBtn = new Button() { @@ -699,7 +839,8 @@ { } - + modifySceneUI.IconPath = backGround.UnSelectedImagePath; + CommonPage.Loading.Start(); var memberDataList = new List<ZigBee.Device.Scene.AddSceneMemberData>(); for (int i = 0; i < sceneTargetDevicesList.Count; i++) @@ -797,6 +938,7 @@ { if (modifyRoom != curRoom) { + modifyRoom.SceneUIList.Remove(modifySceneUI); modifyRoom.SceneUIFilePathList.Remove(modifySceneUI.FileName); curRoom.SceneUIList.Add(modifySceneUI); @@ -931,7 +1073,5 @@ } #endregion - - } } -- Gitblit v1.8.0