From ea0b1e8e5f43c5fd0a7d479e25ede3b8cbea464a Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 02 十二月 2024 17:17:19 +0800 Subject: [PATCH] tcp;可视对讲; --- HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 478 ++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 262 insertions(+), 216 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 44cf87f..8fc33ea 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -5,12 +5,16 @@ using HDL_ON.Entity; using HDL_ON.UI; using HDL_ON.UI.CSS; +using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Shared; namespace HDL_ON.UI { + /// <summary> + /// 鍒嗙被鐣岄潰 + /// </summary> public partial class ClassificationPage : FrameLayout { @@ -85,14 +89,14 @@ #region top FrameLayout topView = new FrameLayout() { - Height = Application.GetRealHeight(64), + Height = Application.GetRealHeight(74), BackgroundColor = CSS_Color.TopViewColor, }; bodyView.AddChidren(topView); btnRoomTilte = new Button() { - Y = Application.GetRealHeight(30), + Y = Application.GetRealHeight(40), Width = Application.GetRealWidth(170), Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.CenterRight, @@ -107,7 +111,7 @@ btnFuncTitle = new Button() { X = Application.GetRealWidth(209), - Y = Application.GetRealHeight(30), + Y = Application.GetRealHeight(40), Width = Application.GetRealWidth(170), Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.CenterLeft, @@ -121,8 +125,8 @@ contentPageView = new PageLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 64 - 49 + 30), + Y = Application.GetRealHeight(74), + Height = Application.GetRealHeight(667 - 74 - 49 + 30), BackgroundColor = CSS_Color.MainBackgroundColor, IsShowPoint = false }; @@ -358,106 +362,34 @@ //2020-12-03 淇敼鍥剧墖鍔犺浇鏂规硶 ImageUtlis.Current.LoadLocalOrNetworkImages(room.backgroundImage, roomViewbg); - var btnFloorAndRoomName = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(12 - 2), - Width = Application.GetRealWidth(266), - Height = Application.GetRealHeight(22 + 2 + 2), - Text = room.floorName + room.roomName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.MainBackgroundColor, - TextSize = CSS_FontSize.SubheadingFontSize, - }; - roomView.AddChidren(btnFloorAndRoomName); - - #region 鐜鏁版嵁 - //var environmentalView = new FrameLayout() - //{ - // Y = Application.GetRealHeight(2) + btnFloorAndRoomName.Bottom, - // Height = Application.GetRealHeight(32), - // Tag = "EnvironmentalView", - //}; - //roomView.AddChidren(environmentalView); - - //Button btnTempIcon = new Button() - //{ - // X = Application.GetRealWidth(12), - // Gravity = Gravity.CenterVertical, - // Width = Application.GetMinRealAverage(16), - // Height = Application.GetMinRealAverage(16), - // UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png", - //}; - //environmentalView.AddChidren(btnTempIcon); - - //var btnTempValues = new Button() - //{ - // X = btnTempIcon.Right + Application.GetRealWidth(4), - // Width = Application.GetRealWidth(30), - // Gravity = Gravity.CenterVertical, - // TextColor = CSS_Color.MainBackgroundColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - // Text = "--掳", - // TextAlignment = TextAlignment.CenterLeft, - // Tag = "TempValues" - //}; - //environmentalView.AddChidren(btnTempValues); - - //Button btnHumidityIcon = new Button() - //{ - // X = btnTempValues.Right + Application.GetRealWidth(2), - // Gravity = Gravity.CenterVertical, - // Width = Application.GetMinRealAverage(16), - // Height = Application.GetMinRealAverage(16), - // UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png", - //}; - //environmentalView.AddChidren(btnHumidityIcon); - - //var btnHumidityValues = new Button() - //{ - // X = btnHumidityIcon.Right + Application.GetRealWidth(4), - // Width = Application.GetRealWidth(30), - // Gravity = Gravity.CenterVertical, - // TextColor = CSS_Color.MainBackgroundColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - // Text = "--%", - // TextAlignment = TextAlignment.CenterLeft, - // Tag = "HumidityValues" - //}; - //environmentalView.AddChidren(btnHumidityValues); - - //Button btnPm25Icon = new Button() - //{ - // X = btnHumidityValues.Right + Application.GetRealWidth(2), - // Gravity = Gravity.CenterVertical, - // Width = Application.GetMinRealAverage(16), - // Height = Application.GetMinRealAverage(16), - // UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png", - //}; - //environmentalView.AddChidren(btnPm25Icon); - - //var btnPm25Values = new Button() - //{ - // X = btnPm25Icon.Right + Application.GetRealWidth(4), - // Width = Application.GetRealWidth(30), - // Gravity = Gravity.CenterVertical, - // TextColor = CSS_Color.MainBackgroundColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - // Text = "--", - // TextAlignment = TextAlignment.CenterLeft, - // Tag = "Pm25Values" - //}; - //environmentalView.AddChidren(btnPm25Values); - //roomView.AddChidren(environmentalView); - #endregion - var roomViewbgColor = new Button() { Height = Application.GetRealWidth(192), Radius = (uint)Application.GetRealWidth(12), - BackgroundColor = 0x19333333, }; roomView.AddChidren(roomViewbgColor); + + var nameView = new FrameLayout() + { + Height = Application.GetRealWidth(50), + BackgroundColor = 0x33000000, + Radius = (uint)Application.GetRealWidth(12), + }; + roomView.AddChidren(nameView); + + var btnFloorAndRoomName = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(12 - 2), + Width = Application.GetRealWidth(266), + Height = Application.GetRealWidth(22 + 2 + 2), + Text = room.floorName + room.roomName, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize + OnAppConfig.Instance.FontAmplify, + IsBold = true, + }; + nameView.AddChidren(btnFloorAndRoomName); var btnAllClose = new Button() { @@ -471,14 +403,6 @@ }; roomView.AddChidren(btnAllClose); LoadEvent_CloseAllFunction(btnAllClose, room); - - //var btn = new Button() - //{ - // Y = Application.GetRealWidth(192), - // Height = Application.GetRealWidth(20), - // BackgroundColor = CSS_Color.MainBackgroundColor, - //}; - //roomView.AddChidren(btn); roomViewbgColor.MouseUpEventHandler += (sender, e) => { @@ -605,21 +529,35 @@ }; } - /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃鐣岄潰 /// </summary> - void LoadFunctionPageView() + void LoadFunctionPageView () { - #region functionsPageView = new VerticalScrolViewLayout() { BackgroundColor = CSS_Color.BackgroundColor, Height = Application.GetRealHeight(667 - 64 - 49 + 20), }; contentPageView.AddChidren(functionsPageView); + this.RefreshFunctionView(); - FrameLayout functionContentView; + } + FrameLayout functionContentView; + /// <summary> + /// 鏄剧ず鍔熻兘鍒楄〃鐣岄潰 + /// </summary> + void RefreshFunctionView() + { + #region + //functionsPageView = new VerticalScrolViewLayout() + //{ + // BackgroundColor = CSS_Color.BackgroundColor, + // Height = Application.GetRealHeight(667 - 64 - 49 + 20), + //}; + //contentPageView.AddChidren(functionsPageView); + + //FrameLayout functionContentView; functionContentView = new FrameLayout() { Y = Application.GetRealHeight(16), @@ -655,8 +593,12 @@ int functionOnCount = 0; switch (item) { + case ShowFunction.Series: + functionCount = FunctionList.List.GetSeries().Count; + //functionOnCount = FunctionList.List.GetSeries().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + break; case ShowFunction.IpCam: - functionCount = FunctionList.List.GetIpCamImouList().Count; + //functionCount = FunctionList.List.GetIpCamImouList().Count; break; case ShowFunction.MechanicalArm: functionCount = FunctionList.List.GetMechanicalArmList().Count; @@ -692,8 +634,12 @@ break; case ShowFunction.Electric: #region 鐢靛櫒 + functionCount = FunctionList.List.GetElectricals().Count; - functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.spk!=SPK.ElectricalTvHisense&&obj.trait_on_off.curValue.ToString() == "on").Count; +//#if DEBUG +// functionCount = 1; +//#endif #endregion break; case ShowFunction.EnergyMonitoring: @@ -722,19 +668,51 @@ case ShowFunction.SecurityMonitoring: if (!MainPage.NoLoginMode) { - functionCount = 1; + if (OnAppConfig.Instance.RequestHttpsHost.Contains("bahrain") || !Common.ApiUtlis.Ins.hadInternet) + { + functionCount = 0; + } + else + { + functionCount = FunctionList.List.GetEzMonitorList().Count; + } } break; case ShowFunction.Sensor: functionCount = FunctionList.List.GetArmSensorList().Count; break; + case ShowFunction.VideoIntercom: + if (FunctionList.List.videoIntercom != null && FunctionList.List.videoIntercom.Count > 0) + { + functionCount = 1; + } + break; case ShowFunction.SecurityCenter: functionCount = FunctionList.List.securities.Count; - //if (DB_ResidenceData.Instance.GatewayType == 1) - //{ - // functionCount = 1; - //} break; + case ShowFunction.Acst: + functionCount = FunctionList.List.GetAcstParentList().Count; + functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + break; + case ShowFunction.VideoDoorLock: + if (Common.ApiUtlis.Ins.hadInternet) + { + functionCount = FunctionList.List.GetVideoDoorLockList().Count; + functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.GetAttrState("status").ToString() == "open" + || obj.GetAttrState("status").ToString() == "normal_open").Count; + } + else + { + functionCount = 0; + } + break; + case ShowFunction.Aks: + functionCount = FunctionList.List.GetVideoControlsList().Count; + functionOnCount = 1; + break; + + + } if (functionCount == 0) @@ -788,13 +766,22 @@ }; functionView.AddChidren(btnName); - if (item != ShowFunction.Environmental && item != ShowFunction.Sensor - && item != ShowFunction.SecurityMonitoring && item != ShowFunction.FreshAir && item != ShowFunction.Music - && item != ShowFunction.EnergyMonitoring && item != ShowFunction.SecurityCenter - && item != ShowFunction.IpCam + //涓嶉渶瑕佹樉绀鸿澶囧紑鐘舵�佹暟閲�; + Button btnFunctionCount=null; + if (item != ShowFunction.Aks + && item != ShowFunction.VideoDoorLock + && item != ShowFunction.Environmental + && item != ShowFunction.Sensor + && item != ShowFunction.VideoIntercom + && item != ShowFunction.SecurityMonitoring + && item != ShowFunction.FreshAir + && item != ShowFunction.Music + && item != ShowFunction.EnergyMonitoring + && item != ShowFunction.SecurityCenter + && item != ShowFunction.Acst && item != ShowFunction.IpCam && functionCount != 0) { - Button btnFunctionCount = new Button() + btnFunctionCount = new Button() { X = Application.GetRealWidth(17) + Application.GetRealWidth(7 * functionCount.ToString().Length), Y = btnName.Bottom, @@ -805,21 +792,29 @@ TextAlignment = TextAlignment.CenterLeft, Text = "/" + functionCount, }; - functionView.AddChidren(btnFunctionCount); - Button btnOpenCount = new Button() + if (item == ShowFunction.Series) { - X = Application.GetRealWidth(16), - Y = btnName.Bottom, - Width = Application.GetRealWidth(14 * functionCount.ToString().Length), - Height = Application.GetRealHeight(24), - TextColor = CSS_Color.MainColor, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextAlignment = TextAlignment.CenterLeft, - Text = functionOnCount.ToString(), - Tag = item + "_onCount", - BorderWidth = 0, - }; - functionView.AddChidren(btnOpenCount); + btnFunctionCount.Text = functionCount.ToString(); + } + functionView.AddChidren(btnFunctionCount); + + if (item != ShowFunction.Series) + { + Button btnOpenCount = new Button() + { + X = Application.GetRealWidth(16), + Y = btnName.Bottom, + Width = Application.GetRealWidth(14 * functionCount.ToString().Length), + Height = Application.GetRealHeight(24), + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = functionOnCount.ToString(), + Tag = item + "_onCount", + BorderWidth = 0, + }; + functionView.AddChidren(btnOpenCount); + } } @@ -834,6 +829,16 @@ int functionPageTitleId = 0; switch (item) { + case ShowFunction.Series: + btnName.TextID = StringId.HorseRaceLamp; + functionPageTitleId = StringId.HorseRaceLamp; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var page2 = new UI2.Classification.SeriesFunctionListPage(); + MainPage.BasePageView.AddChidren(page2); + page2.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + break; case ShowFunction.Light: #region Light btnName.TextID = StringId.Lights; @@ -998,13 +1003,15 @@ case ShowFunction.EnergyMonitoring: #region 鑳芥簮鐩戞祴 btnName.TextID = StringId.EnergyMonitoring; - btnFunctionViewBg.MouseUpEventHandler = (sender, e) => - { - var skipView = new EnergyMainPage(); - MainPage.BasePageView.AddChidren(skipView); - skipView.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; + functionPageTitleId = StringId.EnergyMonitoring; + + //btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + //{ + // var skipView = new EnergyMainPage(); + // MainPage.BasePageView.AddChidren(skipView); + // skipView.LoadPage(); + // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //}; #endregion break; case ShowFunction.Environmental: @@ -1068,6 +1075,14 @@ btnName.TextID = StringId.Sensor; functionPageTitleId = StringId.Sensor; break; + case ShowFunction.VideoIntercom://鍙瀵硅 + btnName.TextID = StringId.VideoIntercom; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var videoMethod = new UI2.FuntionControlView.Video.VideoMethod(); + videoMethod.MianView(this); + }; + break; case ShowFunction.SecurityCenter: btnName.TextID = StringId.SecurityCenter; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => @@ -1078,20 +1093,104 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; break; + case ShowFunction.Acst: + btnName.TextID = StringId.Acst; + Button btnJMLogo = new Button() + { + Y = specialList.Contains(index) ? Application.GetRealWidth(147) : Application.GetRealWidth(104), + UnSelectedImagePath = "FunctionIcon/Acst/LvJianLogo.png", + Width = Application.GetRealWidth(105), + Height = Application.GetRealWidth(57), + }; + functionView.AddChidren(btnJMLogo); + + //Button btnAcstPower = new Button() + //{ + // X = Application.GetRealWidth(120), + // Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), + // Width = Application.GetRealWidth(32), + // Height = Application.GetRealWidth(32), + // SelectedImagePath = "Public/PowerOpen.png", + // UnSelectedImagePath = "Public/PowerClose.png", + // IsSelected = functionOnCount > 0, + // Tag = item + "_AllControl", + //}; + //functionView.AddChidren(btnAcstPower); + //btnAcstPower.MouseUpEventHandler = (sender, e) => + //{ + // btnAcstPower.IsSelected = !btnAcstPower.IsSelected; + // string onoff = btnAcstPower.IsSelected ? "on" : "off"; + // Dictionary<string, string> d = new Dictionary<string, string>(); + // d.Add(FunctionAttributeKey.OnOff, onoff); + // foreach (var temp in FunctionList.List.GetAcstParentList()) + // { + // Control.Ins.SendWriteCommand(temp, d); + // } + //}; + + + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var page = new AcstParentPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + break; + case ShowFunction.VideoDoorLock: + //钀ょ煶瑙嗛闂ㄩ攣 + btnName.TextID = StringId.yingshishipinmensuo; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var list =CommonMethod.Current.GetVideoDoorLockList(); + var form = new VideoDoorLockListPage(()=> { + UpdateBottomView(); + }); + form.AddForm(list); + }; + break; + case ShowFunction.Aks: + + btnFunctionViewBg.UnSelectedImagePath = "FunctionIcon/FunctionBg/AksFunctionBg.png"; + //鍩冨厠鏂奖闊充腑鎺� + btnName.TextID = StringId.jiatingyingyuan; + btnFunctionViewBg.MouseUpEventHandler = (sender, e) => + { + var list = HDL_ON.UI.UI2.FuntionControlView.Aks.AksCommonMethod.Current.GetVideoControlsList(); + var form = new HDL_ON.UI.UI2.FuntionControlView.Aks.AksListPage(() => { + UpdateBottomView(); + }); + form.AddForm(list); + }; + break; } - //鐣岄潰璺宠浆--闊充箰璺宠浆鑷繁鐨勭晫闈�--鐜璺宠浆鑷繁鐨勭晫闈� - if (item != ShowFunction.Music && item != ShowFunction.Environmental && item != ShowFunction.SecurityMonitoring && item != ShowFunction.DoorLock - && ShowFunction.EnergyMonitoring != item && ShowFunction.SecurityCenter != item - ) + //鐣岄潰璺宠浆--闊充箰璺宠浆鑷繁鐨勭晫闈�--鐜璺宠浆鑷繁鐨勭晫闈�--(钀ょ煶瑙嗛闂ㄩ攣)璺宠浆鑷繁鐨勭晫闈�--鍩冨厠鏂奖闊充腑鎺� + if (item != ShowFunction.VideoDoorLock + && item != ShowFunction.Aks + && item != ShowFunction.Music + && item != ShowFunction.Environmental + && item != ShowFunction.SecurityMonitoring + && item != ShowFunction.DoorLock + //&& ShowFunction.EnergyMonitoring != item + && ShowFunction.VideoIntercom != item + && ShowFunction.SecurityCenter != item + && ShowFunction.Series != item + && ShowFunction.Acst != item) { btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { + var skipView = new FunctionPage(); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(functionPageTitleId); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + skipView.DelAction += () => + { + + UpdateBottomView(); + }; }; } index++; @@ -1100,76 +1199,11 @@ s1View.Height = s2View.Height = functionContentView.Height = functionContentViewHeight + Application.GetRealWidth(40); - #endregion +#endregion } - void refreshInverterInfo(Button btnPowerTenerationToday, Button btnWorkingMode, Button btnCurrentPowerGeneration) - { - new System.Threading.Thread(() => - { - var http = new HttpServerRequest(); - var pack = http.GetInverterStatisticsInfo(); - if (pack != null) - { - if(pack.Data == null) - { - return; - } - var info = JsonConvert.DeserializeObject<StatisticsInfo>(pack.Data?.ToString()); - if (info == null) - { - return; - } - try - { - Application.RunOnMainThread(() => - { - btnPowerTenerationToday.Text = info.totalElectricityPvToday + "kW路h";// Language.StringByID(StringId.PowerTenerationToday).Replace("----", info.totalElectricityPvToday); - string workModeString = ""; - if (Language.CurrentLanguage == "Chinese") { - switch (info.workMode) - { - case "self_use": - workModeString = "鑷彂鑷敤"; - break; - case "peak_load_shifting": - workModeString = "鍓婂嘲濉胺"; - break; - case "battery_priority": - workModeString = "鐢垫睜浼樺厛"; - break; - } - } - else - { - switch (info.workMode) - { - case "self_use": - workModeString = "Self Consume"; - break; - case "peak_load_shifting": - workModeString = "Peak Shift"; - break; - case "battery_priority": - workModeString = "Battery Priority"; - break; - } - } - btnWorkingMode.Text = workModeString;// Language.StringByID(StringId.WorkingMode).Replace("----", workModeString); - btnCurrentPowerGeneration.Text = info.powerPvNow + "w";// Language.StringByID(StringId.CurrentPowerGeneration).Replace("----", info.powerPvNow); - //btnBatterySOC.Text = Language.StringByID(StringId.BatterySOC).Replace("--", info.batterySoc); - }); - } - catch (Exception ex) - { - MainPage.Log($"鑾峰彇瀹跺涵鍏変紡缁熻鏁版嵁寮傚父锛歿ex.Message}"); - } - } + - - }) - { IsBackground = true }.Start(); - } #region 鍒囨崲妤煎眰 /// <summary> @@ -1328,6 +1362,18 @@ { } -#endregion + #endregion + + /// <summary> + /// 鏇存柊搴曢儴鐣岄潰 + /// </summary> + void UpdateBottomView() + { + Application.RunOnMainThread(() => + { + functionContentView?.RemoveFromParent(); + this.RefreshFunctionView(); + }); + } } } -- Gitblit v1.8.0