From c47c3ec2488961b3a006aaebcb03dba582f8b19b Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 12 三月 2020 17:08:42 +0800 Subject: [PATCH] 2020-03-12-1 --- ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs | 582 ++++++++++++++++++++++++++++++++------------------------- 1 files changed, 328 insertions(+), 254 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs index 55a51f1..75f24f9 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs @@ -15,27 +15,12 @@ /// bodyFrameLayout /// </summary> private FrameLayout bodyFrameLayout; + /// <summary> + /// top + /// </summary> + private TopFrameLayout top; + private Button selectAllBtn; - private Button addBtn; - - private FrameLayout itemView; - /// <summary> - /// editStatus - /// </summary> - private bool SelectAll; - - /// <summary> - /// low_High - /// </summary> - private const int low_High = 127; - /// <summary> - /// 鍔熻兘 - /// </summary> - private ButtonLineForm functionBtn; - /// <summary> - /// 鍦烘櫙 - /// </summary> - private ButtonLineForm sceneBtn; /// <summary> /// 涓儴鑳屾櫙bodyView /// </summary> @@ -55,14 +40,38 @@ /// <summary> /// 璁惧绫诲瀷RowLayout /// </summary> - private RowLayout typeRowLayout; + private FrameLayout typeRowLayout; /// <summary> /// 鐩稿悓鐨勮澶囧垪琛� /// </summary> public VerticalScrolViewLayout deviceListScrolView; + /// <summary> + /// dList + /// </summary> + private List<CommonDevice> devList; + /// <summary> + /// sceneList + /// </summary> + private List<SceneUI> sceneList; + + /// <summary> + /// 鐩稿悓绫诲瀷鐨勮澶囧垪琛� + /// </summary> + private Dictionary<int ,List<CommonDevice>> typeDeviceDic; + /// <summary> + /// 璁惧绫诲瀷鐨勫浘id + /// </summary> + private Dictionary<int, DeviceConcreteType> typeIdDic; + /// <summary> + /// 褰撳墠閫夋嫨鐨勫垎鏀� 0:鍦烘櫙 1:鍔熻兘 + /// </summary> + private int NowSelectIndex = 0; #endregion + /// <summary> + /// UnallocatedRoom + /// </summary> public UnallocatedRoom() { BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; @@ -73,11 +82,52 @@ /// </summary> public void Show() { + RemoveAll(); + InitData(); AddTop(); - AddBodyView(); } + /// <summary> + /// InitData + /// </summary> + private void InitData() + { + typeDeviceDic = new Dictionary<int, List<CommonDevice>> { }; + typeIdDic = new Dictionary<int, DeviceConcreteType> { }; + + RefreshData(); + } + + /// <summary> + /// RefreshData + /// </summary> + private void RefreshData() + { + devList = UserCenter.HdlRoomLogic.Current.GetUnalloctedDevice(); + sceneList = UserCenter.HdlSceneLogic.Current.GetUnalloctedScenes(); + typeDeviceDic.Clear(); + typeIdDic.Clear(); + if (devList == null) + { + return; + } + foreach (var device in devList) + { + var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device); + if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false) + { + var sameDevList = new List<CommonDevice> { }; + sameDevList.Add(device); + typeDeviceDic[info.BeloneTextId] = sameDevList; + } + else + { + typeDeviceDic[info.BeloneTextId].Add(device); + } + typeIdDic[info.BeloneTextId] = info.ConcreteType; + } + } #region Add____________________________________ @@ -86,7 +136,7 @@ /// </summary> public void AddTop() { - var top = new TopFrameLayout(); + top = new TopFrameLayout(); AddChidren(top); top.InitTopview(); top.SetTopTitle(R.MyInternationalizationString.Unallocated); @@ -94,21 +144,6 @@ { RemoveFromParent(); }; - - addBtn = new Button() - { - X = Application.GetRealWidth(800), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(80), - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextSize = CommonFormResouce.TopTitle_TextSize, - TextAlignment = TextAlignment.CenterRight, - TextID = R.MyInternationalizationString.AllSelect - }; - top.topView.AddChidren(addBtn); - - addBtn.MouseUpEventHandler += Edit_MouseUpEventHandler; } /// <summary> @@ -124,95 +159,30 @@ }; AddChidren(bodyFrameLayout); - var functionSceneBG = new FrameLayout() - { - Height = Application.GetRealHeight(low_High), - BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor + //鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var btnSceneFunctionSwitch = new UserCenter.SceneFunctionSwitchControl(); + btnSceneFunctionSwitch.Y = Application.GetRealHeight(43); + bodyFrameLayout.AddChidren(btnSceneFunctionSwitch); + btnSceneFunctionSwitch.SelectTabEvent += (index) => + { + this.NowSelectIndex = index; + this.RefreshBodyView(); }; - bodyFrameLayout.AddChidren(functionSceneBG); - - //鍔熻兘 - functionBtn = new ButtonLineForm(CommonFormResouce.X_Left, 34, 150, 68); - functionSceneBG.AddChidren(functionBtn); - functionBtn.Init(); - functionBtn.SetTitle(R.MyInternationalizationString.Function); - functionBtn.IsSelected = true; - - //鍦烘櫙 - sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 34, 150, 68); - functionSceneBG.AddChidren(sceneBtn); - sceneBtn.Init(); - sceneBtn.SetTitle(R.MyInternationalizationString.Scence); - - //閫夋嫨鍔熻兘鍒嗘爮 - functionBtn.NameBtn.MouseUpEventHandler += FunctionBtn_MouseUpEventHandler; - //閫夋嫨鍦烘櫙鍒嗘爮 - sceneBtn.NameBtn.MouseUpEventHandler += SceneBtn_MouseUpEventHandler; //鍔熻兘鍜屽満鏅痓odyView functionSceneBodyView = new FrameLayout() { - Y= Application.GetRealHeight(187-58), + Y = Application.GetRealHeight(127), Height = Application.GetRealHeight(1607), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; - bodyFrameLayout.AddChidren(functionSceneBodyView); - - RefreshBodyView(); - - } - - /// <summary> - /// 閫夋嫨鍔熻兘鍒嗘爮 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void FunctionBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) - { - functionBtn.IsSelected = true; - sceneBtn.IsSelected = false; - RefreshBodyView(); - } - - /// <summary> - /// 閫夋嫨鍦烘櫙鍒嗘爮 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void SceneBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) - { - functionBtn.IsSelected = false; - sceneBtn.IsSelected = true; - RefreshBodyView(); - } - - /// <summary> - /// 缂栬緫 - /// </summary> - /// <param name="sender"></param> - /// <param name="mouseEventArgs"></param> - private void Edit_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) - { - SelectAll = !SelectAll; - if (SelectAll) - { - addBtn.TextID = R.MyInternationalizationString.Cancel; - } - else - { - addBtn.TextID = R.MyInternationalizationString.AllSelect; - } - - if (functionBtn.IsSelected) - { - functionSceneBodyView.RemoveAll(); - ShowFunction(SelectAll); - } - else if (sceneBtn.IsSelected) - { - functionSceneBodyView.RemoveAll(); - ShowScene(SelectAll); - } + bodyFrameLayout.AddChidren(functionSceneBodyView); + + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + btnSceneFunctionSwitch.InitControl(listTitle); } #endregion @@ -224,14 +194,14 @@ public void RefreshBodyView() { functionSceneBodyView.RemoveAll(); - SelectAll = false; - if (functionBtn.IsSelected) + + if (this.NowSelectIndex == 1) { - ShowFunction(SelectAll); + ShowFunction(); } - else if (sceneBtn.IsSelected) + else if (this.NowSelectIndex == 0) { - ShowScene(SelectAll); + ShowScene(); } } @@ -241,71 +211,86 @@ /// <summary> /// 鍔熻兘 /// </summary> - public void ShowFunction(bool selectAll) + public void ShowFunction() { - SelectAll = selectAll; - //閫夋嫨鍔熻兘--鐩存帴浠庢埧闂寸殑devicelist涓幏鍙� - if (Common.Room.AllRoomDeviceUIList == null) - { - return; - } - if (Common.Room.AllRoomDeviceUIList.Count == 0) + if (typeIdDic.Count == 0) { ShowNoFunctionTip(); } else { + var functionTypeView1 = new FrameLayout + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y = Application.GetRealHeight(58), + Height = Application.GetRealHeight(160), + Width = Application.GetRealWidth(1028), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + functionSceneBodyView.AddChidren(functionTypeView1); + functionTypeView1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft); + + var functionTypeView2 = new FrameLayout + { + X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y = Application.GetRealHeight(58+150), + Height = Application.GetRealHeight(279-150), + Width = Application.GetRealWidth(1028), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + }; + functionSceneBodyView.AddChidren(functionTypeView2); + functionTypeView2.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); + functionTypeScrowView = new HorizontalScrolViewLayout { X = Application.GetRealWidth(CommonFormResouce.X_Left), + Y=Application.GetRealHeight(58), Height = Application.GetRealHeight(279), - Width = Application.GetRealWidth(1028), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor + Width = Application.GetRealWidth(1028) }; functionSceneBodyView.AddChidren(functionTypeScrowView); deviceListScrolView = new VerticalScrolViewLayout { X = Application.GetRealWidth(CommonFormResouce.X_Left), - Y = functionTypeScrowView.Bottom + Application.GetRealHeight(50), + Y = Application.GetRealHeight(372), Width = Application.GetRealWidth(1028), - Height = functionSceneBodyView.Height - Application.GetRealHeight(279 + 50) - 1, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor - + Height = Application.GetRealHeight(1034), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, }; functionSceneBodyView.AddChidren(deviceListScrolView); - - + deviceListScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); tempFunctionTypeBtn = new FunctionButton(); + tempFunctionTypeBtn.Init("", ""); - foreach (var deviceType in Common.Room.AllRoomDeviceTypeList) + foreach (var deviceType in typeIdDic) { - typeRowLayout = new RowLayout() + typeRowLayout = new FrameLayout() { - Width = Application.GetRealWidth(CommonPage.AppRealWidth / 5), - LineColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = deviceType + Width = Application.GetRealWidth(220), }; functionTypeScrowView.AddChidren(typeRowLayout); functionTypeIMG = new FunctionButton() { - Tag = deviceType + Tag = deviceType.Key }; - functionTypeIMG.Init(DeviceUI.GetDeviceTypeUnSelectedImagePath(deviceType), DeviceUI.GetDeviceTypeUnSelectedImagePath(deviceType)); - functionTypeIMG.SetTitle(DeviceUI.GetDeviceTypeName(deviceType)); + string imgPath=string.Empty; + string imgSeletedPath=string.Empty; + Common.LocalDevice.Current.GetDeviceObjectIcon(deviceType.Value, ref imgPath ,ref imgSeletedPath); + functionTypeIMG.Init(imgPath,imgSeletedPath); + functionTypeIMG.SetTitle(deviceType.Key); typeRowLayout.AddChidren(functionTypeIMG); - functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction; - - if (deviceType == Shared.Common.Room.AllRoomDeviceUIList[0].CommonDevice.Type) + if (functionTypeScrowView.ChildrenCount == 1) { ShowSameTypeFunction(functionTypeIMG.ImageBtn, null); } } + } } @@ -316,34 +301,16 @@ /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> private void ShowSameTypeFunction(object typeSender, MouseEventArgs mouseEventArgs) { - //閫夋嫨鍔熻兘--鐩存帴浠庢埧闂寸殑devicelist涓幏鍙� tempFunctionTypeBtn.IsSelected = false; tempFunctionTypeBtn = (typeSender as Button).Parent as FunctionButton; ((typeSender as Button).Parent as FunctionButton).IsSelected = true; deviceListScrolView.RemoveAll(); - var sameTypeList = new List<DeviceUI> { }; - var selectedList = new List<DeviceUI> { }; - foreach (var devieceUI in Common.Room.AllRoomDeviceUIList) - { - if (devieceUI == null || devieceUI.CommonDevice == null) - { - continue; - } - if (devieceUI.CommonDevice.Type.ToString() == (typeSender as Button).Tag.ToString()) - { - if (!sameTypeList.Contains(devieceUI)) - { - sameTypeList.Add(devieceUI); - } - } - } + var sameTypeList = new List<CommonDevice> { }; + var selectedList = new List<CommonDevice> { }; + sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; - if (SelectAll) - { - selectedList.AddRange(sameTypeList); - } foreach (var deviceUI in sameTypeList) { var deviceTypeRowLayout = new FrameLayout() @@ -355,15 +322,13 @@ var deviceRow = new SelectFunctionView(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - deviceRow.SetStatu(deviceUI.CommonDevice.IsOnline == 1); - deviceRow.SetSelectStatu(SelectAll); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI)); deviceTypeRowLayout.AddChidren(deviceRow); EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - deviceRow.SelectBtn.IsSelected = !deviceRow.SelectBtn.IsSelected; - if (deviceRow.SelectBtn.IsSelected) + deviceRow.IsSelected = !deviceRow.IsSelected; + if (deviceRow.IsSelected) { if (!selectedList.Contains(deviceUI)) { @@ -378,37 +343,97 @@ } } }; - deviceRow.NameBtn.MouseUpEventHandler += eventHandler; - deviceRow.ImageBtn.MouseUpEventHandler += eventHandler; - deviceRow.MouseUpEventHandler+=eventHandler; - deviceRow.SelectBtn.MouseUpEventHandler += eventHandler; - - var add = new Button - { - Y = Application.GetRealHeight(1428), - Width = Application.GetRealWidth(1034), - Height = Application.GetRealHeight(156), - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, - Radius = (uint)Application.GetRealHeight(17), - TextID = R.MyInternationalizationString.AddTo, - Gravity = Gravity.CenterHorizontal - }; - functionSceneBodyView.AddChidren(add); - add.MouseUpEventHandler += (sender, e) => - { - var selectZone = new SelectZone(); - CommonPage.Instance.AddChidren(selectZone); - selectZone.Init(); - selectZone.ZoneAction = (r) => - { - foreach (var d in selectedList) - { - r.AddDevice(d.FileName); - } - }; - }; + deviceRow.ClickBtn.MouseUpEventHandler += eventHandler; } + + selectAllBtn?.RemoveFromParent(); + selectAllBtn = new Button() + { + X = Application.GetRealWidth(1080 - 150 - 80), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(80), + Gravity = Gravity.CenterVertical, + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, + TextSize = CommonFormResouce.TopTitle_TextSize, + TextAlignment = TextAlignment.CenterRight, + TextID = R.MyInternationalizationString.AllSelect + }; + top.topView.AddChidren(selectAllBtn); + selectAllBtn.MouseUpEventHandler += (sender, e) => + { + try + { + (sender as Button).IsSelected = !(sender as Button).IsSelected; + for (int i = 0; i < deviceListScrolView.ChildrenCount; i++) + { + var frame = deviceListScrolView.GetChildren(i) as FrameLayout; + (frame.GetChildren(0) as SelectFunctionView).IsSelected = (sender as Button).IsSelected; + } + if ((sender as Button).IsSelected) + { + (sender as Button).TextID = R.MyInternationalizationString.Cancel; + selectedList.Clear(); + selectedList.AddRange(sameTypeList); + } + else + { + (sender as Button).TextID = R.MyInternationalizationString.AllSelect; + selectedList.Clear(); + } + } + catch + { + + } + }; + + var addBackground = new Button + { + Y = Application.GetRealHeight(1405), + Width = Application.GetMinRealAverage(1080), + Height = Application.GetMinRealAverage(202), + UnSelectedImagePath = "Room/AddBackground.png" + }; + functionSceneBodyView.AddChidren(addBackground); + var add = new Button + { + Y = Application.GetRealHeight(1428), + Width = Application.GetRealWidth(1034), + Height = Application.GetRealHeight(156), + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, + TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, + Radius = (uint)Application.GetRealHeight(35), + TextID = R.MyInternationalizationString.AddTo, + Gravity = Gravity.CenterHorizontal, + TextSize = 17 + }; + functionSceneBodyView.AddChidren(add); + add.MouseUpEventHandler += (sender, e) => + { + var selectZone = new SelectZone(); + selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo); + selectZone.Init(); + selectZone.ZoneAction += (r) => + { + foreach (var d in selectedList) + { + UserCenter.HdlRoomLogic.Current.AddDevice(r, d, true); + deviceListScrolView.RemoveViewByTag(d); + } + + if (sameTypeList.Count == selectedList.Count) + { + RefreshData(); + RefreshBodyView(); + } + else + { + RefreshData(); + sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; + } + }; + }; } /// <summary> @@ -416,6 +441,7 @@ /// </summary> private void ShowNoFunctionTip() { + return; var noFunction = new Button() { Y = Application.GetRealHeight(320), @@ -432,8 +458,7 @@ Height = Application.GetRealHeight(200), Width = Application.GetRealWidth(700), Gravity = Gravity.CenterHorizontal, - TextID = R.MyInternationalizationString.NoFunction, - //Text = "娌℃湁鍔熻兘 \n 璇峰湪涓汉涓績涓�--璁惧绠$悊澶勬坊鍔�", + Text= Language.StringByID(R.MyInternationalizationString.NoFunction_Tip).Replace("{\\r\\n}", "\r\n"), TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextAlignment = TextAlignment.Center, IsMoreLines = true @@ -447,75 +472,69 @@ /// <summary> /// 閫夋嫨鍦烘櫙--鎵�鏈夋埧闂寸殑鎵�鏈夊満鏅� /// </summary> - public void ShowScene(bool selectAll) + public void ShowScene() { - //鍒锋柊鍦烘櫙 - //var reFreshResult=await Shared.Common.Room.RefreshSceneUIList(); - Shared.Common.SceneRoomUI.GetAllSceneRoomUIList(); - if (SceneRoomUI.AllSceneRoomUIList == null) - { - return; - } - var sceneList = SceneRoomUI.AllSceneRoomUIList; - List<SceneRoomUI> selectedList = new List<SceneRoomUI>(); - if(selectAll) - { - selectedList.AddRange(sceneList); - } - if (sceneList.Count == 0) + List<SceneUI> selectedList = new List<SceneUI>(); + if (sceneList == null || sceneList.Count == 0) { ShowNoSceneTip(); } else - { + { var sceneScrolView = new VerticalScrolViewLayout { - Y = Application.GetRealHeight(0) + Y = Application.GetRealHeight(81), + Height=Application.GetRealHeight(1405-22) }; functionSceneBodyView.AddChidren(sceneScrolView); - foreach (var sceneRoomUI in sceneList) + foreach (var sceneUI in sceneList) { var sceneFL = new FrameLayout() { - Width=Application.GetRealWidth(CommonFormResouce.AppRealWidth), - Height = Application.GetRealHeight(397+58), + Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth), + Height = Application.GetRealHeight(397 + 46), Gravity = Gravity.CenterHorizontal, BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, - Tag = sceneRoomUI + Tag = sceneUI, + Radius = (uint)Application.GetRealHeight(17) }; sceneScrolView.AddChidren(sceneFL); - var sceneImg = new Button() + var sceneImg = new ImageView() { - X=Application.GetRealWidth(179), - Y=Application.GetRealHeight(58), + X = Application.GetRealWidth(179), Width = Application.GetRealWidth(844), Height = Application.GetRealHeight(397), - UnSelectedImagePath = sceneRoomUI.sceneUI.IconPath, + ImagePath = sceneUI.IconPath, Radius = (uint)Application.GetRealHeight(17) }; - sceneImg.UnSelectedImagePath = "Room/r0.png"; - sceneFL.AddChidren(sceneImg); + sceneFL.AddChidren(sceneImg); + + //闃村奖 + var btnShadow = new UserCenter.PicViewControl(sceneImg.Width + Application.GetRealWidth(14 * 2), sceneImg.Height + Application.GetRealHeight(43), false); + btnShadow.X = sceneImg.X - Application.GetRealWidth(14); + btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png"; + sceneFL.AddChidren(btnShadow); var selectedBtn = new Button { X = Application.GetRealWidth(919), - Y = Application.GetRealHeight(92), + Y = Application.GetRealHeight(45), Width = Application.GetMinRealAverage(60), Height = Application.GetMinRealAverage(60), UnSelectedImagePath = "Room/ItemUnSelected.png", SelectedImagePath = "Room/ItemSelected.png", - IsSelected= selectAll }; sceneFL.AddChidren(selectedBtn); var leftFL = new FrameLayout { X = Application.GetRealWidth(CommonFormResouce.X_Left), - Y = Application.GetRealHeight(58 + 58), + Y = Application.GetRealHeight(58), Width = Application.GetRealWidth(251), Height = Application.GetRealHeight(282), - BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor2 + BackgroundColor = 0xd6333333, + Radius = (uint)Application.GetRealHeight(17) }; sceneFL.AddChidren(leftFL); @@ -535,33 +554,84 @@ Width = Application.GetRealWidth(176), Height = Application.GetRealHeight(200), TextColor = ZigbeeColor.Current.GXCTextWhiteColor, - Text = sceneRoomUI.sceneUI.Name, + Text = sceneUI.Name, Gravity = Gravity.Center, IsMoreLines = true }; leftFL.AddChidren(sceneNameBtn); - EventHandler<MouseEventArgs> eventHandler = (sender,e) => + EventHandler<MouseEventArgs> eventHandler = (sender, e) => { selectedBtn.IsSelected = !selectedBtn.IsSelected; - if(selectedBtn.IsSelected) + if (selectedBtn.IsSelected) { - if(!selectedList.Contains(sceneRoomUI)) + if (!selectedList.Contains(sceneUI)) { - selectedList.Add(sceneRoomUI); + selectedList.Add(sceneUI); } } else { - if (selectedList.Contains(sceneRoomUI)) + if (selectedList.Contains(sceneUI)) { - selectedList.Remove(sceneRoomUI); + selectedList.Remove(sceneUI); } } }; selectedBtn.MouseUpEventHandler += eventHandler; sceneImg.MouseUpEventHandler += eventHandler; } + + selectAllBtn?.RemoveFromParent(); + selectAllBtn = new Button() + { + X = Application.GetRealWidth(1080 - 150 - 80), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(80), + Gravity = Gravity.CenterVertical, + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, + TextSize = CommonFormResouce.TopTitle_TextSize, + TextAlignment = TextAlignment.CenterRight, + TextID = R.MyInternationalizationString.AllSelect + }; + top.topView.AddChidren(selectAllBtn); + selectAllBtn.MouseUpEventHandler += (sender, e) => + { + try + { + (sender as Button).IsSelected = !(sender as Button).IsSelected; + for (int i = 0; i < sceneScrolView.ChildrenCount; i++) + { + var frame = sceneScrolView.GetChildren(i) as FrameLayout; + (frame.GetChildren(1) as Button).IsSelected = (sender as Button).IsSelected; + } + + if ((sender as Button).IsSelected) + { + (sender as Button).TextID = R.MyInternationalizationString.Cancel; + selectedList.AddRange(sceneList); + } + else + { + (sender as Button).TextID = R.MyInternationalizationString.AllSelect; + selectedList.Clear(); + } + } + catch + { + + } + }; + + var addBackground = new Button + { + Y = Application.GetRealHeight(1405), + Width = Application.GetMinRealAverage(1080), + Height = Application.GetMinRealAverage(202), + UnSelectedImagePath = "Room/AddBackground.png" + }; + functionSceneBodyView.AddChidren(addBackground); var add = new Button { @@ -570,22 +640,25 @@ Height = Application.GetRealHeight(156), BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, - Radius = (uint)Application.GetRealHeight(17), + Radius = (uint)Application.GetRealHeight(35), TextID = R.MyInternationalizationString.AddTo, - Gravity=Gravity.CenterHorizontal + Gravity = Gravity.CenterHorizontal, + TextSize=17, }; functionSceneBodyView.AddChidren(add); add.MouseUpEventHandler += (sender, e) => { var selectZone = new SelectZone(); - CommonPage.Instance.AddChidren(selectZone); + selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo); selectZone.Init(); - selectZone.ZoneAction = (r) => + selectZone.ZoneAction += (r) => { - foreach(var s in selectedList) + foreach (var s in selectedList) { - r.AddScene(s.sceneUI); + UserCenter.HdlSceneLogic.Current.AddScene(r, s); + sceneScrolView.RemoveViewByTag(s); } + RefreshData(); }; }; } @@ -596,6 +669,7 @@ /// </summary> private void ShowNoSceneTip() { + return; var noFunction = new Button() { Y = Application.GetRealHeight(320), @@ -612,7 +686,7 @@ Height = Application.GetRealHeight(200), Width = Application.GetRealWidth(700), Gravity = Gravity.CenterHorizontal, - TextID = R.MyInternationalizationString.NoScene, + Text = Language.StringByID(R.MyInternationalizationString.NoScene_Tip).Replace("{\\r\\n}", "\r\n"), TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextAlignment = TextAlignment.Center, IsMoreLines = true -- Gitblit v1.8.0