| | |
| | | { |
| | | |
| | | #region 控件列表 |
| | | static FrameLayout bodyView; |
| | | static HomePage bodyView; |
| | | /// <summary> |
| | | /// 顶部信息区域 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | VerticalScrolViewLayout sceneFunctionView; |
| | | /// <summary> |
| | | /// 灯光区域集合 |
| | | /// 功能区域集合 |
| | | /// </summary> |
| | | static Dictionary<string, FrameLayout> LightViews; |
| | | /// <summary> |
| | | /// 空调区域集合 |
| | | /// </summary> |
| | | static Dictionary<string, FrameLayout> AcViews; |
| | | /// <summary> |
| | | /// 窗帘区域集合 |
| | | /// </summary> |
| | | static Dictionary<string, FrameLayout> CurtainViews; |
| | | List<FrameLayout> functionViews; |
| | | #endregion |
| | | |
| | | #region 区域变量 |
| | |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | try |
| | | { |
| | | #region topView |
| | | topView = new FrameLayout() |
| | |
| | | environmentalView.AddChidren(btnPm25Values); |
| | | #endregion |
| | | |
| | | |
| | | #region msg |
| | | FrameLayout msgView; |
| | | msgView = new FrameLayout() |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | msgView.AddChidren(btnMsgTime); |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 功能场景切换 |
| | | changeView = new FrameLayout() |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | changeView.AddChidren(btnChangeScene); |
| | | |
| | | #endregion |
| | | |
| | | #region ContextView |
| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | LightViews = new Dictionary<string, FrameLayout>(); |
| | | AcViews = new Dictionary<string, FrameLayout>(); |
| | | CurtainViews = new Dictionary<string, FrameLayout>(); |
| | | functionViews = new List<FrameLayout>(); |
| | | |
| | | deviceFunctionView = new VerticalScrolViewLayout(); |
| | | contentView.AddChidren(deviceFunctionView); |
| | |
| | | #endregion |
| | | |
| | | LoadEvent_ChangeShowedFunctionType(); |
| | | //刷新功能状态 |
| | | DB_ResidenceData.residenceData.RefreshResidenceFunctionStatus(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"HomePage LoadPage Error : {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | #region ContextView |
| | | deviceFunctionView.RemoveAll(); |
| | | LightViews.Clear(); |
| | | AcViews.Clear(); |
| | | CurtainViews.Clear(); |
| | | functionViews.Clear(); |
| | | var rowView = new FrameLayout(); |
| | | try |
| | | { |
| | |
| | | { |
| | | UnSelectedImagePath = "Collection/Functionbg.png", |
| | | SelectedImagePath = "Collection/FunctionOnbg.png", |
| | | Tag = function.sid |
| | | }; |
| | | functionView.AddChidren(btnbg); |
| | | switch (function.functionCategory) |
| | | { |
| | | case FunctionType.Light: |
| | | #region 灯光 Light |
| | | LightViews.Add(function.sid, functionView); |
| | | #endregion |
| | | break; |
| | | case FunctionType.Curtain: |
| | | #region 窗帘 |
| | | CurtainViews.Add(function.sid, functionView); |
| | | #endregion |
| | | break; |
| | | case FunctionType.AC: |
| | | #region 空调 AC |
| | | AcViews.Add(function.sid, functionView); |
| | | #endregion |
| | | break; |
| | | } |
| | | functionViews.Add(functionView); |
| | | LoadDeviceFunctionDiv(functionView, function); |
| | | index++; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("homepage erorr : " + ex.Message); |
| | | MainPage.Log("homepage error : " + ex.Message); |
| | | } |
| | | deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); |
| | | #endregion |
| | |
| | | BackgroundImagePath = (function as Scene).ImagePath, |
| | | }; |
| | | rowView.AddChidren(functionView); |
| | | //functionView.Radius = (uint)Application.GetRealWidth(12); |
| | | //functionView.BorderColor = CSS_Color.BackgroundColor; |
| | | //functionView.BorderWidth = 1; |
| | | |
| | | |
| | | LoadSceneFunctionDiv(functionView, function); |
| | | index++; |
| | |
| | | }; |
| | | view.AddChidren(btnCollection); |
| | | |
| | | if (function.functionCategory == FunctionCategory.Curtain) |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Curtain/CurtainOnIcon.png"; |
| | | Button btnCurtainClose; |
| | | btnCurtainClose = new Button() |
| | | { |
| | | X = Application.GetRealWidth(84), |
| | | Y = Application.GetRealWidth(89), |
| | | Width = Application.GetRealWidth(44), |
| | | Height = Application.GetRealWidth(44), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseBlueIcon_Shadow.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseWhiteIcon_Shadow.png", |
| | | }; |
| | | view.AddChidren(btnCurtainClose); |
| | | |
| | | Button btnCurtainOpen; |
| | | btnCurtainOpen = new Button() |
| | | { |
| | | X = btnCurtainClose.Right, |
| | | Y = Application.GetRealWidth(89), |
| | | Width = Application.GetRealWidth(44), |
| | | Height = Application.GetRealWidth(44), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenBlueIcon_Shadow.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenWhiteIcon_Shadow.png", |
| | | }; |
| | | view.AddChidren(btnCurtainOpen); |
| | | |
| | | LoadEvent_ControlCurtain(function as Curtain, btnCurtainClose, btnCurtainOpen); |
| | | } |
| | | else |
| | | { |
| | | Button btnSwitch; |
| | | btnSwitch = new Button() |
| | | { |
| | |
| | | |
| | | switch (function.functionCategory) |
| | | { |
| | | case FunctionType.Light: |
| | | case FunctionCategory.Light: |
| | | #region 灯光 Light |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Light/LightOnIcon.png"; |
| | | LoadRelaySwitchEvent(function, btnSwitch, view); |
| | | //btnCollection.IsSelected = btnIcon.IsSelected = btnName.IsSelected = btnZone.IsSelected = btnSwitch.IsSelected = (function as Light).state == 1; |
| | | UpdataLightView(function as Light); |
| | | //btnSwitch.MouseUpEventHandler += (sender, e) => |
| | | //{ |
| | | // var curState = !btnSwitch.IsSelected; |
| | | // for (int i = 0; i < view.ChildrenCount; i++) |
| | | // { |
| | | // if (view.GetChildren(i).GetType() == typeof(Button)) |
| | | // { |
| | | // var btn = view.GetChildren(i) as Button; |
| | | // btn.IsSelected = curState; |
| | | // } |
| | | // } |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // var light = function as Light; |
| | | // light.state = btnSwitch.IsSelected ? 1 : 0; |
| | | // Control.Send("write", function, 3); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | //}; |
| | | UpdataFunctionStates(function as Light); |
| | | #endregion |
| | | break; |
| | | case FunctionType.Curtain: |
| | | #region 窗帘 |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/Curtain/CurtainOnIcon.png"; |
| | | #endregion |
| | | break; |
| | | case FunctionType.AC: |
| | | case FunctionCategory.AC: |
| | | #region 空调 AC |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; |
| | | #endregion |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | case FunctionCategory.FloorHeating: |
| | | #region 地热 |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; |
| | | btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; |
| | | #endregion |
| | | break; |
| | | } |
| | | LoadEvent_SwitchFunction(function, btnSwitch); |
| | | } |
| | | UpdataFunctionStates(function); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | UnSelectedImagePath = "Collection/SceneCovered.png", |
| | | SelectedImagePath = "Collection/SceneCoveredOn.png", |
| | | //Width = Application.GetRealWidth(165), |
| | | }; |
| | | view.AddChidren(btnCoverd); |
| | | btnCoverd.MouseDownEventHandler = (sender, e) => { |
| | | btnCoverd.IsSelected = true; |
| | | }; |
| | | btnCoverd.MouseUpEventHandler = (sender, e) => { |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(200); |
| | | Application.RunOnMainThread(() => { |
| | | btnCoverd.IsSelected = false; |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | }; |
| | | LoadEvent_ControlScene(btnCoverd, function); |
| | | |
| | | Button btnDelayIcon; |
| | | btnDelayIcon = new Button() |
| | |
| | | }; |
| | | 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 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); |
| | | |
| | | } |
| | | catch (Exception ex) |