| | |
| | | using System;
|
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | |
| | | TextColor = CSS.CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS.CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = DB_ResidenceData.residenceData.residenceName, |
| | | Text = DB_ResidenceData.residenceData.residecenInfo.Name, |
| | | IsBold = true |
| | | }; |
| | | topView.AddChidren(btnResidenceName); |
| | | |
| | | #if DEBUG |
| | | btnResidenceName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | System.Threading.Tasks.Task.Run( |
| | | async () => { await DAL.Net.MqttCommon.StartMqtt(); |
| | | }); |
| | | }; |
| | | |
| | | #endif |
| | | |
| | | |
| | | environmentalView = new FrameLayout() |
| | | { |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/InfoIcon/TempIcon.png", |
| | | UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png", |
| | | }; |
| | | environmentalView.AddChidren(btnTempIcon); |
| | | |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = CSS.CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = "--°", |
| | | Text = MainPage.cityInfo.temperature, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | environmentalView.AddChidren(btnTempValues); |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/InfoIcon/HumidityIcon.png", |
| | | UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png", |
| | | }; |
| | | environmentalView.AddChidren(btnHumidityIcon); |
| | | |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = CSS.CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = "--%", |
| | | Text = MainPage.cityInfo.humidity, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | environmentalView.AddChidren(btnHumidityValues); |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/InfoIcon/Pm25Icon.png", |
| | | UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png", |
| | | }; |
| | | environmentalView.AddChidren(btnPm25Icon); |
| | | |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = CSS.CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = "--", |
| | | Text = MainPage.cityInfo.pm25, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | environmentalView.AddChidren(btnPm25Values); |
| | |
| | | changeView.AddChidren(btnChangeScene); |
| | | #endregion |
| | | |
| | | //bodyView.AddChidren(new Button() { Y = changeView.Bottom, Height = Application.GetRealHeight(10), BackgroundColor = 0xAAF2F3F7 }); |
| | | |
| | | |
| | | #region ContextView |
| | | contentView = new PageLayout() |
| | | { |
| | | Y = changeView.Bottom + Application.GetRealHeight(10), |
| | | Y = changeView.Bottom , |
| | | Height = Application.GetRealHeight(310 + 30), //20为超出部分 |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | |
| | | contentView.PageIndex = 0; |
| | | |
| | | #endregion |
| | | bodyView.AddChidren(new Button() { Y = changeView.Bottom, Height = Application.GetRealHeight(7), BackgroundColor = 0xAAF2F3F7 }); |
| | | |
| | | LoadEvent_ChangeShowedFunctionType(); |
| | | } |
| | |
| | | }; |
| | | rowView.AddChidren(functionView); |
| | | |
| | | LoadSceneFunctionDiv(functionView, function); |
| | | LoadSceneFunctionDiv( functionView, function); |
| | | index++; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载控制卡片 |
| | | /// 加载功能控制卡片 |
| | | /// </summary> |
| | | void LoadDeviceFunctionDiv(FrameLayout view, Function function) |
| | | { |
| | |
| | | UnSelectedImagePath = "Collection/CollectionIcon.png", |
| | | }; |
| | | view.AddChidren(btnCollection); |
| | | LoadEvent_FunctionCollection(btnCollection, function, true); |
| | | |
| | | if (function.functionCategory == FunctionCategory.Curtain) |
| | | { |
| | |
| | | view.AddChidren(btnCurtainOpen); |
| | | |
| | | LoadEvent_ControlCurtain(function as Curtain, btnCurtainClose, btnCurtainOpen); |
| | | }else if(function.functionType== FunctionType.TV) |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVIcon.png"; |
| | | Button btnPower; |
| | | btnPower = new Button() |
| | | { |
| | | X = Application.GetRealWidth(131), |
| | | Y = Application.GetRealHeight(86), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | }; |
| | | view.AddChidren(btnPower); |
| | | LoadEvent_ControlTV(function as TV, btnPower); |
| | | } |
| | | else |
| | | { |
| | |
| | | UpdataFunctionStates(function as Light); |
| | | #endregion |
| | | break; |
| | | case FunctionCategory.AC: |
| | | #region 空调 AC |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; |
| | | #endregion |
| | | case FunctionCategory.Thermostat: |
| | | switch (function.functionType) |
| | | { |
| | | case FunctionType.AC: |
| | | #region 空调 AC |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; |
| | | #endregion |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | #region 地热 |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; |
| | | #endregion |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.FloorHeating: |
| | | #region 地热 |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; |
| | | #endregion |
| | | case FunctionCategory.SwitchDevice: |
| | | switch (function.functionType) |
| | | { |
| | | case FunctionType.Socket: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Socket/SocketOnIcon.png"; |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.Electrical: |
| | | switch(function.functionType) |
| | | { |
| | | case FunctionType.Fan: |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Electrical/FanOnIcon.png"; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | LoadEvent_SwitchFunction(function, btnSwitch); |
| | | } |
| | | UpdataFunctionStates(function); |
| | | var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, new Button(), new Button(), new Button()); |
| | | view.MouseUpEventHandler = skipControlPageEvent; |
| | | btnName.MouseUpEventHandler = skipControlPageEvent; |
| | | btnIcon.MouseUpEventHandler = skipControlPageEvent; |
| | | btnState.MouseUpEventHandler = skipControlPageEvent; |
| | | //电视不需要更新状态 |
| | | if(function.functionType!= FunctionType.TV) |
| | | { |
| | | UpdataFunctionStates(function); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载控制卡片 |
| | | /// 加载场景控制卡片 |
| | | /// </summary> |
| | | void LoadSceneFunctionDiv(FrameLayout view, Function function) |
| | | { |
| | | try |
| | | { |
| | | Button btnCoverd = new Button() |
| | | { |
| | | UnSelectedImagePath = "Collection/SceneCovered.png", |
| | | SelectedImagePath = "Collection/SceneCoveredOn.png", |
| | | }; |
| | | view.AddChidren(btnCoverd); |
| | | LoadEvent_ControlScene(btnCoverd, function); |
| | | |
| | | Button btnDelayIcon; |
| | | btnDelayIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12), |
| | | Y = Application.GetRealWidth(12), |
| | | Height = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "FunctionIcon/Scene/DelayIcon.png" |
| | | }; |
| | | view.AddChidren(btnDelayIcon); |
| | | |
| | | Button btnCollection; |
| | | btnCollection = new Button() |
| | | { |
| | | X = Application.GetRealWidth(116), |
| | | Y = Application.GetRealWidth(8), |
| | | Width = Application.GetMinRealAverage(32), |
| | | Height = Application.GetMinRealAverage(32), |
| | | SelectedImagePath = "Collection/CollectionWhiteIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionIcon.png", |
| | | }; |
| | | view.AddChidren(btnCollection); |
| | | Button btnName; |
| | | btnName = new Button() |
| | | { |
| | |
| | | }; |
| | | view.AddChidren(btnZone); |
| | | |
| | | Button btnCoverd = new Button() |
| | | { |
| | | UnSelectedImagePath = "Collection/SceneCovered.png", |
| | | }; |
| | | view.AddChidren(btnCoverd); |
| | | |
| | | Button btnDelayIcon; |
| | | btnDelayIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12), |
| | | Y = Application.GetRealWidth(12), |
| | | Height = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "FunctionIcon/Scene/DelayIcon.png" |
| | | }; |
| | | view.AddChidren(btnDelayIcon); |
| | | |
| | | Button btnCollection; |
| | | btnCollection = new Button() |
| | | { |
| | | X = Application.GetRealWidth(116), |
| | | Y = Application.GetRealWidth(8), |
| | | Width = Application.GetMinRealAverage(32), |
| | | Height = Application.GetMinRealAverage(32), |
| | | SelectedImagePath = "Collection/CollectionWhiteIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionIcon.png", |
| | | }; |
| | | view.AddChidren(btnCollection); |
| | | LoadEvent_FunctionCollection(btnCollection, function, false); |
| | | |
| | | LoadEvent_ControlScene(btnCoverd, function); |
| | | |
| | | } |
| | | catch (Exception ex) |