| | |
| | | public void LoadPage(int titleId) |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | Action action = () => |
| | | { |
| | | |
| | | Action<Scene > refreshAction = (outScene) => { |
| | | if (outScene != null) |
| | | { |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | |
| | | var sceneRow = new SceneControlZone(outScene); |
| | | functionListView.AddChidren(sceneRow); |
| | | sceneRow.LoadView(); |
| | | } |
| | | }; |
| | | |
| | | var skipView = new AddLightScene(new List<Function>(), new Scene() { sceneType = SceneType.LightScene }, refreshAction); |
| | | MainPage.BasePageView.AddChidren(skipView); |
| | | skipView.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView_LightFunction(action); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | } |
| | | /// <summary> |
| | | /// 房间内容显示区域 |
| | | /// </summary> |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = DB_ResidenceData.residenceData.CurFoor, |
| | | Text = DB_ResidenceData.Instance.CurFloor.roomName, |
| | | }; |
| | | roomFloorChangeView.AddChidren(btnFloor); |
| | | #endregion |
| | |
| | | |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | functionList.AddRange(FunctionList.List.lights); |
| | | functionList.AddRange(FunctionList.List.GetLightList()); |
| | | var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene); |
| | | |
| | | foreach (var scene in lightScene) |
| | | { |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | |
| | | var sceneRow = new SceneControlZone(scene); |
| | | functionListView.AddChidren(sceneRow); |
| | | sceneRow.LoadView(); |
| | | } |
| | | |
| | | } |
| | | else if (titleId == StringId.AC) |
| | | { |
| | | functionList.AddRange(FunctionList.List.aCs); |
| | | functionList.AddRange(FunctionList.List.GetAcList()); |
| | | } |
| | | else if (titleId == StringId.Curtain) |
| | | { |
| | | functionList.AddRange(FunctionList.List.curtains); |
| | | functionList.AddRange(FunctionList.List.GetCurtainList()); |
| | | } |
| | | else if (titleId == StringId.FloorHeating) |
| | | { |
| | | functionList.AddRange(FunctionList.List.floorHeatings); |
| | | functionList.AddRange(FunctionList.List.GetFloorHeatingList()); |
| | | } |
| | | else if (titleId == StringId.Electric) |
| | | { |
| | | functionList.AddRange(FunctionList.List.electricals); |
| | | functionList.AddRange(FunctionList.List.GetElectricals()); |
| | | } |
| | | else if (titleId == StringId.EnvironmentalScience) |
| | | { |
| | | functionList.AddRange(FunctionList.List.sensorsEnvironmentalScience); |
| | | functionList.AddRange(FunctionList.List.GetEnvirSensorsList()); |
| | | } |
| | | functionList.OrderByDescending(o => o.usageCount).ToList(); |
| | | else if (titleId == StringId.Sensor) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetArmSensorList()); |
| | | }
|
| | | else if (titleId == StringId.FreshAir) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetAirFreshList()); |
| | | } |
| | | functionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | |
| | | ShowFunctionRow(functionList); |
| | | |
| | |
| | | functionListView.RemoveAll(); |
| | | foreach (var function in showList) |
| | | { |
| | | |
| | | if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer) |
| | | if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2) |
| | | { |
| | | continue; |
| | | } |
| | | if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) |
| | | { |
| | | var functionDiv = new FunctionControlZone(function) |
| | | { |
| | |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.sid |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.sid |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | |
| | | } |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 加载功能类型控制卡片 |
| | | ///// </summary> |
| | | //public void LoadSceneRow(Scene scene) |
| | | //{ |
| | | // var bodyDiv = new FrameLayout() |
| | | // { |
| | | // Gravity = Gravity.CenterHorizontal, |
| | | // Width = Application.GetRealWidth(343), |
| | | // Height = Application.GetRealHeight(116), |
| | | // Radius = (uint)Application.GetMinRealAverage(12), |
| | | // BorderColor = 0x00FFFFFF, |
| | | // BorderWidth = 1, |
| | | // BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | // Tag = "Scene-" + scene.sid |
| | | // }; |
| | | // functionListView.AddChidren(bodyDiv); |
| | | |
| | | // var btnIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(10), |
| | | // Y = Application.GetRealHeight(15), |
| | | // Width = Application.GetRealWidth(32), |
| | | // Height = Application.GetRealWidth(32), |
| | | // }; |
| | | // bodyDiv.AddChidren(btnIcon); |
| | | |
| | | // var btnName = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(8 + 10 + 32), |
| | | // Y = Application.GetRealHeight(10), |
| | | // Width = Application.GetRealWidth(200), |
| | | // Height = Application.GetRealHeight(24), |
| | | // Text = scene.name, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextColor = CSS_Color.FirstLevelTitleColor, |
| | | // TextSize = CSS_FontSize.TextFontSize, |
| | | // }; |
| | | // bodyDiv.AddChidren(btnName); |
| | | |
| | | // var btnFromFloor = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(8 + 10 + 32), |
| | | // Y = Application.GetRealHeight(10 + 24), |
| | | // Width = Application.GetRealWidth(200), |
| | | // Height = Application.GetRealHeight(18), |
| | | // Text = scene.GetRoomListName(), |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextColor = CSS_Color.PromptingColor1, |
| | | // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | // }; |
| | | // bodyDiv.AddChidren(btnFromFloor); |
| | | |
| | | // var btnCollectionIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(299), |
| | | // Y = Application.GetRealHeight(10), |
| | | // Width = Application.GetMinRealAverage(40), |
| | | // Height = Application.GetMinRealAverage(40), |
| | | // SelectedImagePath = "Collection/CollectionIcon.png", |
| | | // UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | // IsSelected = scene.collect |
| | | // }; |
| | | // bodyDiv.AddChidren(btnCollectionIcon); |
| | | |
| | | // btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png"; |
| | | // if (scene.sceneType == SceneType.MovieScene) |
| | | // { |
| | | // var movieIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(52), |
| | | // Y = Application.GetRealHeight(14), |
| | | // Width = Application.GetRealWidth(16), |
| | | // Height = Application.GetRealWidth(16), |
| | | // UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png", |
| | | // }; |
| | | // bodyDiv.AddChidren(movieIcon); |
| | | // btnName.X = Application.GetRealWidth(52 + 16); |
| | | // } |
| | | // //加载场景控制事件 |
| | | // LoadEvent_ControlScene(btnName, btnFromFloor, bodyDiv, scene); |
| | | |
| | | // LoadEvent_FunctionCollection(btnCollectionIcon, scene); |
| | | //} |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 加载功能收藏按钮事件 |
| | | ///// </summary> |
| | | //void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene) |
| | | //{ |
| | | // btnCollectionIcon.MouseUpEventHandler += (sender, e) => |
| | | // { |
| | | // btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected; |
| | | // scene.CollectScene(); |
| | | // }; |
| | | //} |
| | | ///// <summary> |
| | | ///// 加载场景控制事件 |
| | | ///// </summary> |
| | | //void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, FrameLayout bodyDiv, Scene scene) |
| | | //{ |
| | | // EventHandler<MouseEventArgs> upEvent = (sender, e) => { |
| | | // DriverLayer.Control.Ins.ControlScene(scene); |
| | | // string msg = scene.name + Language.StringByID(StringId.AlreadyOpened); |
| | | // new PublicAssmebly().TipMsgAutoClose(msg, false); |
| | | // }; |
| | | // btnName.MouseUpEventHandler = upEvent; |
| | | // btnFromFloor.MouseUpEventHandler = upEvent; |
| | | // bodyDiv.MouseUpEventHandler = upEvent; |
| | | //} |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 住宅列表点击事件 |
| | | /// </summary> |
| | | void LoadDialog_ChangeFloor() |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var dialog = new Dialog(); |
| | | var dialogBody = new FrameLayout(); |
| | | dialog.AddChidren(dialogBody); |
| | | dialogBody.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(110), |
| | | BackgroundImagePath = "PersonalCenter/HomeList1bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(45 * 2), |
| | | ScrollEnabled = false |
| | | }; |
| | | dispalyView.AddChidren(contentView); |
| | | |
| | | if (SpatialInfo.CurrentSpatial.RoomList.Count < 2) |
| | | { |
| | | } |
| | | else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(155), |
| | | BackgroundImagePath = "PersonalCenter/HomeList2bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 3); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else if (SpatialInfo.CurrentSpatial.RoomList.Count < 4) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(200), |
| | | BackgroundImagePath = "PersonalCenter/HomeList3bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 4); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(100), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(245), |
| | | BackgroundImagePath = "PersonalCenter/HomeList4bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 5); |
| | | contentView.ScrollEnabled = true; |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | |
| | | |
| | | List<Room> roomList = new List<Room>(); |
| | | roomList.Add(new Room() { roomName = Language.StringByID(StringId.All) }); |
| | | roomList.AddRange(SpatialInfo.CurrentSpatial.RoomList); |
| | | foreach (var tempRoom in roomList) |
| | | { |
| | | var roomName = tempRoom.roomName; |
| | | if (roomName != Language.StringByID(StringId.All)) |
| | | { |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor |
| | | }); |
| | | } |
| | | var btnHomeName = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | Text = roomName, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsSelected = btnFloor.Text == roomName, |
| | | IsMoreLines = true, |
| | | }; |
| | | contentView.AddChidren(btnHomeName); |
| | | |
| | | btnHomeName.MouseUpEventHandler += (senderH, en) => |
| | | { |
| | | dialog.Close(); |
| | | btnFloor.Text = roomName; |
| | | if (roomName == Language.StringByID(StringId.All)) |
| | | { |
| | | ShowFunctionRow(functionList); |
| | | } |
| | | else |
| | | { |
| | | var showList = new List<Function>(); |
| | | foreach (var sf in functionList) |
| | | { |
| | | if(sf.roomIds.Contains(tempRoom.roomId)) |
| | | { |
| | | showList.Add(sf); |
| | | } |
| | | } |
| | | ShowFunctionRow(showList); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | string nowSelectId = null; |
| | | btnFloor.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | //显示下拉列表
|
| | | var form = new FloorRoomSelectPopupView();
|
| | | form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) =>
|
| | | {
|
| | | nowSelectId = selectId;
|
| | | //重新加载界面
|
| | | ShowFunctionRow(listFunc);
|
| | | }, nowSelectId);
|
| | | }; |
| | | |
| | | btnFloor.MouseUpEventHandler = eventHandler; |
| | | btnFloorDownIcon.MouseUpEventHandler = eventHandler; |
| | | } |
| | | } |
| | | } |