From 528c105b3aea0e6e00477365f16f57c1e3d7eb1c Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 24 十月 2019 15:31:28 +0800 Subject: [PATCH] 2019-10-24-3 --- ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 105 +++++++++++++++++++++++++++------------------------- 1 files changed, 54 insertions(+), 51 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index 7f6e7af..250eeb9 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -22,7 +22,7 @@ /// <summary> /// low_High /// </summary> - private const int low_High= 127; + private const int low_High = 127; /// <summary> /// 鍔熻兘 /// </summary> @@ -547,7 +547,7 @@ { foreach (var floor in Config.Instance.Home.FloorDics) { - Config.Instance.Home.CurrentFloorId=floor.Key; + Config.Instance.Home.CurrentFloorId = floor.Key; break; } } @@ -561,7 +561,7 @@ /// <param name="selectedBtn">閫変腑閭d釜鐣岄潰 0--鍔熻兘 1--鍦烘櫙 2--鑷姩鍖� </param> public void Show(int selectedBtn = 1) { - InitFloor(); + ZbGateway.StatusList.Add(this); RemoveAll(); @@ -657,23 +657,23 @@ if (Config.Instance.Home.FloorDics.Count > 0) { - floorBtn.Text = Config.Instance.Home.GetCurrentFloorName(); + floorBtn.Text = Config.Instance.Home.GetCurrentFloorName; functionSceneAutoBG.AddChidren(floorBtn); functionSceneAutoBG.AddChidren(selectFloorBtn); } var roomFL = new HorizontalScrolViewLayout() { - X= Application.GetRealWidth(CommonFormResouce.X_Left), + X = Application.GetRealWidth(CommonFormResouce.X_Left), Y = functionSceneAutoBG.Bottom, Height = Application.GetRealHeight(167), - Width=Application.GetRealWidth(CommonPage.AppRealWidth-CommonFormResouce.X_Left), + Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonFormResouce.X_Left), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; midFL.AddChidren(roomFL); Button curBtn = new Button(); - for(int i=0;i<Config.Instance.Home.RoomFilePathList.Count;i++) + for (int i = 0; i < Config.Instance.Home.RoomFilePathList.Count; i++) { var roomFilePath = Config.Instance.Home.RoomFilePathList[i]; var room = Shared.Common.Room.GetRoomByFilePath(roomFilePath); @@ -683,9 +683,9 @@ } var row = new RowLayout() { - Width = Application.GetRealWidth(187+50), + Width = Application.GetRealWidth(187 + 50), Height = Application.GetRealHeight(167), - LineColor= ZigbeeColor.Current.GXCGrayBackgroundColor + LineColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; roomFL.AddChidren(row); @@ -693,18 +693,22 @@ { Width = Application.GetRealWidth(187), Height = Application.GetRealHeight(78), - Radius=(uint)Application.GetRealHeight(78/2), + Radius = (uint)Application.GetRealHeight(78 / 2), Gravity = Gravity.Center, - Text=room.Name, - TextColor=ZigbeeColor.Current.GXCTextGrayColor, - SelectedTextColor=ZigbeeColor.Current.GXCTextWhiteColor, - BackgroundColor=ZigbeeColor.Current.GXCButtonUnSelectedColor3, - SelectedBackgroundColor=ZigbeeColor.Current.GXCButtonSelectedColor, - BorderColor=ZigbeeColor.Current.GXCBorderUnSelectedColor, - BorderWidth=1 + Text = room.Name, + TextColor = ZigbeeColor.Current.GXCTextGrayColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor, + BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor3, + SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor, + BorderColor = ZigbeeColor.Current.GXCBorderUnSelectedColor, + BorderWidth = 1 }; row.AddChidren(roomBtn); - if(Shared.Common.Room.CurrentRoom.FileName==roomFilePath) + if (Shared.Common.Room.CurrentRoom == null) + { + continue; + } + if (Shared.Common.Room.CurrentRoom.FileName == roomFilePath) { roomBtn.IsSelected = true; curBtn = roomBtn; @@ -722,7 +726,7 @@ Shared.Common.Room.CurrentRoom = room; }; } - + //鍔熻兘鍜屽満鏅痓odyView functionSceneBodyView = new FrameLayout() @@ -773,7 +777,7 @@ addBtn.MouseUpEventHandler += AddBtn_MouseUpEventHandler; selectFloorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler; - floorBtn.MouseUpEventHandler+= SelectedFloor_MouseUpEventHandler; + floorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler; } @@ -784,9 +788,9 @@ /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> private void SelectedFloor_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) { - var floors = new SelectFloor (); + var floors = new SelectFloor(); AddChidren(floors); - floors.Init(599,357); + floors.Init(599, 357); floors.FloorAction += (floorName) => { floorBtn.Text = floorName; @@ -938,10 +942,10 @@ { functionTypeScrowView = new HorizontalScrolViewLayout { - X=Application.GetRealWidth(CommonFormResouce.X_Left), + X = Application.GetRealWidth(CommonFormResouce.X_Left), Height = Application.GetRealHeight(279), Width = Application.GetRealWidth(1028), - BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; functionSceneBodyView.AddChidren(functionTypeScrowView); @@ -950,13 +954,13 @@ X = Application.GetRealWidth(CommonFormResouce.X_Left), Y = functionTypeScrowView.Bottom + Application.GetRealHeight(50), Width = Application.GetRealWidth(1028), - Height = functionSceneBodyView.Height - Application.GetRealHeight(279+50) - 1, + Height = functionSceneBodyView.Height - Application.GetRealHeight(279 + 50) - 1, BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor }; functionSceneBodyView.AddChidren(deviceListScrolView); tempFunctionTypeBtn = new FunctionButton(); - + foreach (var deviceType in Common.Room.AllRoomDeviceTypeList) { typeRowLayout = new RowLayout() @@ -1000,7 +1004,7 @@ 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> { }; @@ -1078,7 +1082,7 @@ var deviceTypeRowLayout = new RowLayout() { - Height = Application.GetRealHeight(127+35), + Height = Application.GetRealHeight(127 + 35), LineColor = ZigbeeColor.Current.GXCBackgroundColor, Tag = deviceUI }; @@ -1312,7 +1316,7 @@ }; deviceTypeRowLayout.AddRightView(delBtn); delBtn.MouseUpEventHandler += delEvent; - + } else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat) { @@ -1467,7 +1471,7 @@ deviceTypeRowLayout.AddRightView(delBtn); delBtn.MouseUpEventHandler += delEvent; - + deviceRow.SwitchBtn.MouseUpEventHandler += (sender, e) => { zbGateway = deviceUI.CommonDevice.Gateway; @@ -1502,7 +1506,7 @@ } else { - + } } } @@ -1514,10 +1518,10 @@ { var noFunction = new Button() { - Y=Application.GetRealHeight(320), - Width=Application.GetMinRealAverage(757), + Y = Application.GetRealHeight(320), + Width = Application.GetMinRealAverage(757), Height = Application.GetMinRealAverage(435), - UnSelectedImagePath="Item/NoFunction.png", + UnSelectedImagePath = "Item/NoFunction.png", Gravity = Gravity.CenterHorizontal }; functionSceneBodyView.AddChidren(noFunction); @@ -1532,7 +1536,7 @@ //Text = "娌℃湁鍔熻兘 \n 璇峰湪涓汉涓績涓�--璁惧绠$悊澶勬坊鍔�", TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, TextAlignment = TextAlignment.Center, - IsMoreLines=true + IsMoreLines = true }; functionSceneBodyView.AddChidren(noFunctionTip); } @@ -1562,7 +1566,7 @@ { var sceneScrolView = new VerticalScrolViewLayout { - Y=Application.GetRealHeight(58) + Y = Application.GetRealHeight(58) }; functionSceneBodyView.AddChidren(sceneScrolView); foreach (var sceneRoomUI in sceneList) @@ -1587,9 +1591,9 @@ var sceneImg = new Button() { - X=Application.GetRealWidth(179), - Width=Application.GetMinReal(844), - Height=Application.GetMinReal(400), + X = Application.GetRealWidth(179), + Width = Application.GetMinReal(844), + Height = Application.GetMinReal(400), Gravity = Gravity.CenterVertical, UnSelectedImagePath = sceneRoomUI.sceneUI.IconPath, Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius) @@ -1598,22 +1602,22 @@ var leftFL = new FrameLayout { - X=Application.GetRealWidth(CommonFormResouce.X_Left), + X = Application.GetRealWidth(CommonFormResouce.X_Left), Width = Application.GetRealWidth(251), Height = Application.GetRealHeight(282), - Gravity=Gravity.CenterVertical, + Gravity = Gravity.CenterVertical, BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor2 }; sceneRowLayout.AddChidren(leftFL); var collectionBtn = new Button { - X=Application.GetRealWidth(23), - Y=Application.GetRealHeight(23), - Width=Application.GetMinRealAverage(65), - Height=Application.GetMinRealAverage(65), - UnSelectedImagePath="Item/Collection.png", - SelectedImagePath="Item/CollectionSelected.png" + X = Application.GetRealWidth(23), + Y = Application.GetRealHeight(23), + Width = Application.GetMinRealAverage(65), + Height = Application.GetMinRealAverage(65), + UnSelectedImagePath = "Item/Collection.png", + SelectedImagePath = "Item/CollectionSelected.png" }; leftFL.AddChidren(collectionBtn); @@ -1624,7 +1628,7 @@ TextColor = ZigbeeColor.Current.GXCTextWhiteColor, Text = sceneRoomUI.sceneUI.Name, Gravity = Gravity.Center, - IsMoreLines=true + IsMoreLines = true }; leftFL.AddChidren(sceneNameBtn); @@ -1639,7 +1643,7 @@ //缂栬緫 var settingBtn = new Device.CommonForm.RowLayoutEditButton() { - TextID=R.MyInternationalizationString.Setting, + TextID = R.MyInternationalizationString.Setting, Tag = sceneRoomUI.sceneUI.SceneDelayTime }; //鍒犻櫎 @@ -1693,7 +1697,7 @@ var tip = new CustomAlert { }; AddChidren(tip); tip.Show(Language.StringByID(R.MyInternationalizationString.ConfirmDelete)); - + //var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.ConfirmDelete), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); //alert.Show(); tip.ResultEventHandler += async (e1) => @@ -1950,7 +1954,6 @@ { Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); } - Common.Logic.CurrentLogic.LogicType = 2; Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text; Logic.TemplatePage templatePage = new Logic.TemplatePage(); Logic.TemplatePage.s = logiciocnBtn.Tag.ToString(); -- Gitblit v1.8.0