From 96e9ff2e5a54f54cdbb6b8b2f049fdf6a837de3c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 23 八月 2023 14:28:22 +0800 Subject: [PATCH] 备份1 --- OnPro/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 370 ---------------------------------------------------- 1 files changed, 2 insertions(+), 368 deletions(-) diff --git a/OnPro/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/OnPro/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index 1c14381..614bd63 100644 --- a/OnPro/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/OnPro/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -81,152 +81,6 @@ } /// <summary> - /// 鏇存柊瀹夐槻鐘舵�� - /// </summary> - public static void LoadEvent_RefreshSecurityStatus() - { - try - { - Application.RunOnMainThread(() => - { - if (bodyView != null) - { - lock (FunctionList.List.securities) - { - bodyView.btnSecurityStatus.IsSelected = false; - foreach (var temp in FunctionList.List.securities) - { - if (temp.status == "enable") - { - if (temp.alarm) - { - bodyView.btnSecurityStatus.SelectedImagePath = "Collection/DefenseAlarmIcon.png"; - } - else - { - bodyView.btnSecurityStatus.SelectedImagePath = "Collection/DefenseStatusIcon.png"; - } - bodyView.btnSecurityStatus.IsSelected = true; - return; - } - } - } - } - }); - } - catch (Exception ex) - { - MainPage.Log($"瀹夐槻涓婚〉鏇存柊寮傚父锛歿ex.Message}"); - } - } - - /// <summary> - /// 鏇存柊瀹ゅ唴浼犳劅鍣ㄦ暟鎹�-婀垮害 - /// </summary> - public static void LoadEvent_RefreshEnvirIndoorHumi() - { - Application.RunOnMainThread(() => - { - if (bodyView != null) - { - var humiSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorHumidity); - var enviSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => SPK.EvironmentSensorList().Contains(obj.spk )); - foreach (var enviTemp in enviSensorList) - { - var tempAttr = enviTemp.attributes.Find((obj) => obj.key == "humidity"); - if (tempAttr != null) - { - var newTemp = new Function() - { - name = enviTemp.name, - sid = enviTemp.sid, - deviceId = enviTemp.deviceId, - attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "humidity", state = tempAttr.state, curValue = tempAttr.curValue } }, - }; - humiSensorList.Add(newTemp); - } - } - double humiTotalValues = 0; - int humiTotalCount = 0; - foreach (var temp in humiSensorList) - { - double humiValue = 0; - double.TryParse(temp.GetAttrState("humidity"), out humiValue); - if(humiValue > 0) - { - humiTotalValues += humiValue; - humiTotalCount++; - } - } - if (humiTotalValues > 0) - { - bodyView.btnIndoorHumiValues.Text = "/" + (humiTotalValues /humiTotalCount).ToString("0")+ "%"; - } - bodyView.btnIndoorHumiValues.Width = bodyView.btnIndoorHumiValues.GetTextWidth(); - - bodyView.btnHumidityIcon.X = bodyView.btnIndoorTempValues.Right + Application.GetRealWidth(8); - bodyView.btnHumidityValues.X = bodyView.btnHumidityIcon.Right + Application.GetRealWidth(4); - bodyView.btnIndoorHumiValues.X = bodyView.btnHumidityValues.Right; - bodyView.btnPm25Icon.X = bodyView.btnIndoorHumiValues.Right + Application.GetRealWidth(4); - bodyView.btnPm25Values.X = bodyView.btnPm25Icon.Right + Application.GetRealWidth(4); - } - }); - } - - /// <summary> - /// 鏇存柊瀹ゅ唴浼犳劅鍣ㄦ暟鎹� - /// </summary> - public static void LoadEvent_RefreshEnvirIndoorTemp() - { - Application.RunOnMainThread(() => - { - if (bodyView != null) - { - var tempSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorTemperature); - var enviSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => SPK.EvironmentSensorList().Contains(obj.spk)); - foreach (var enviTemp in enviSensorList) - { - var tempAttr = enviTemp.attributes.Find((obj) => obj.key == "temperature"); - if (tempAttr != null) - { - var newTemp = new Function() - { - name = enviTemp.name, - sid = enviTemp.sid, - deviceId = enviTemp.deviceId, - attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "temperature", state = tempAttr.state, curValue = tempAttr.curValue } }, - }; - tempSensorList.Add(newTemp); - } - } - double tempTotalValues = 0; - int tempTotalCount = 0; - foreach (var temp in tempSensorList) - { - double tempValue = 0; - double.TryParse(temp.GetAttrState("temperature"), out tempValue); - if (tempValue > 0) - { - tempTotalValues += tempValue; - tempTotalCount++; - } - } - if (tempTotalValues > 0) - { - bodyView.btnIndoorTempValues.Text = "/" + (tempTotalValues /tempTotalCount).ToString("0.0")+ "掳"; - } - bodyView.btnIndoorTempValues.Width = bodyView.btnIndoorTempValues.GetTextWidth(); - - bodyView.btnHumidityIcon.X = bodyView.btnIndoorTempValues.Right + Application.GetRealWidth(8); - bodyView.btnHumidityValues.X = bodyView.btnHumidityIcon.Right + Application.GetRealWidth(4); - bodyView.btnIndoorHumiValues.X = bodyView.btnHumidityValues.Right; - bodyView.btnPm25Icon.X = bodyView.btnIndoorHumiValues.Right + Application.GetRealWidth(4); - bodyView.btnPm25Values.X = bodyView.btnPm25Icon.Right + Application.GetRealWidth(4); - } - }); - } - - /// <summary> /// 鏇存柊鍔熻兘鍒楄〃涓婚〉 /// </summary> public static void RefreshFunctionView() @@ -236,25 +90,6 @@ bodyView.LoadDeviceFunctionControlZone(); } } - - /// <summary> - /// 鏇存柊鍔熻兘缁勬帶涓婚〉 - /// </summary> - public static void RefreshGroupControlView() - { - if (bodyView != null) - { - - if (FunctionList.List.groupControls.Count == 0) - { - bodyView.loadNavView(); - bodyView.contentView.PageIndex = 0; - } - bodyView.LoadGroupControlFunctionControlZone(); - } - } - - /// <summary> /// 鏇存柊杩炴帴鐘舵�佸浘鏍� @@ -309,14 +144,6 @@ btn.MouseUpEventHandler += (sender, e) => { function.collect = false; - if (SPK.MusicSpkList().Contains(function.spk))//澶勭悊闊充箰涓讳粠鍏崇郴 - { - //if ((function as Music.A31MusicModel).ServerClientType == 1) - //{ - // (function as Music.A31MusicModel).MainPlayCollection = false; - // Music.A31MusicModel.Save(); - //} - } string msg = function.name + Language.StringByID(StringId.CollectionCancelled); LoadDeviceFunctionControlZone(); function.CollectFunction(); @@ -336,19 +163,6 @@ scene.CollectScene(); new PublicAssmebly().TipMsgAutoClose(msg, true); }; - } - - /// <summary> - /// 淇敼鏄剧ず鐨勫姛鑳界被鍨� - /// 璁惧鍔熻兘/鍦烘櫙鍔熻兘 - /// </summary> - void LoadEvent_ChangeShowedFunctionType() - { - - if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl && FunctionList.List.groupControls.Count>0) - { - - } } /// <summary> @@ -386,52 +200,6 @@ state = function.trait_on_off.curValue.ToString() == "on"; } } - else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) - { - - var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.TargetStatus); - if (tempStatus != null) - { - switch (tempStatus.state) - {//0绌猴紝1璧帮紝2璺戯紝3鍧愶紝4璺屽�掞紝5绔� - case "0": - state = false; - break; - case "1": - state = true; - break; - case "2": - if (function.extSet.labModel) - { - state = true; - } - break; - case "3": - if (function.extSet.labModel) - { - state = true; - } - break; - case "4": - state = true; - break; - case "5": - if (function.extSet.labModel) - { - state = true; - } - break; - } - } - } - else if(function.spk == SPK.SensorHelp) - { - var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); - if(tempStatus != null) - { - state = tempStatus.curValue.ToString() == "alarm"; - } - } else { state = function.trait_on_off.curValue.ToString() == "on"; @@ -444,23 +212,9 @@ btn.IsSelected = state; if (btn.Tag != null && btn.Tag.ToString() == "state") { - if (SPK.MusicSpkList().Contains(function.spk)) + if (function.spk != SPK.LightSwitch) { - btn.Text =function.GetAttrState("song_name"); - } - else - { - if (function.spk != SPK.LightSwitch) - { - if (function.spk == SPK.SensorHelp) - { - btn.TextID = StringId.InAlarming; - } - else - { - btn.Text = function.lastState; - } - } + btn.Text = function.lastState; } } } @@ -497,40 +251,6 @@ new PublicAssmebly().TipMsgAutoClose(msg, true); Control.Ins.ControlScene(scene); scene.SceneCountDown(btnShowDelay); - //new System.Threading.Thread(() => { - // int time = Convert.ToInt32(scene.delay); - // if (time > 0) - // { - // while (time > 0) - // { - // Application.RunOnMainThread(() => - // { - // if (time / 60 > 1) - // { - // btnShowDelay.Text = (time / 60).ToString() + "min"; - // } - // else - // { - // btnShowDelay.Text = (time--).ToString() + "s"; - // } - // }); - // if (time / 60 > 1) - // { - // System.Threading.Thread.Sleep(time / 60 * 60000); - // } - // else - // { - // System.Threading.Thread.Sleep(1000); - // } - // } - // Application.RunOnMainThread(() => - // { - // btnShowDelay.Text = ""; - // }); - // } - //}) - //{ IsBackground = true, Priority = System.Threading.ThreadPriority.BelowNormal }.Start(); - }; btnCoverd.MouseUpEventHandler = eventHandler; btnName.MouseUpEventHandler = eventHandler; @@ -559,13 +279,6 @@ btnSwitch.IsSelected = !btnSwitch.IsSelected; new System.Threading.Thread(() => { - if(SPK.NotStatusSpkList.Contains(function.spk)) - { - System.Threading.Thread.Sleep(1000); - Application.RunOnMainThread(() => { - btnSwitch.IsSelected = !btnSwitch.IsSelected; - }); - } function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; Dictionary<string, string> d = new Dictionary<string, string>(); if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) @@ -582,19 +295,6 @@ d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); Control.Ins.SendWriteCommand(function, d); } - //else if (function.spk == SPK.PanelSocket)//鍘绘帀锛岀粺涓�澶勭悊鎬绘帶 - //{ - // if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) - // { - // d.Add("on_off_usb", function.trait_on_off.curValue.ToString()); - // } - // Control.Ins.SendWriteCommand(function, d); - //} - else if (function.spk == SPK.GroupControl) - { - d.Add("on_off", function.trait_on_off.curValue.ToString()); - (function as GroupControl).Control(d); - } else { d.Add("on_off", function.trait_on_off.curValue.ToString()); @@ -606,68 +306,12 @@ } /// <summary> - /// 鍔犺浇鐢佃鎺у埗浜嬩欢 - /// </summary> - /// <param name="function"></param> - /// <param name="btnSwitch"></param> - void LoadEvent_ControlTV(Function function, Button btnSwitch) - { - btnSwitch.MouseUpEventHandler = (sender, e) => - { - if (!function.isOnline())//绂荤嚎涓嶅厑璁告搷浣� - { - new Tip() - { - CloseTime = 1, - Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - Direction = AMPopTipDirection.None, - }.Show(MainPage.BaseView); - return; - } - if (DB_ResidenceData.Instance.GatewayType == 1) - { - btnSwitch.IsSelected = !btnSwitch.IsSelected; - new System.Threading.Thread(() => - { - if (SPK.NotStatusSpkList.Contains(function.spk)) - { - System.Threading.Thread.Sleep(2000); - Application.RunOnMainThread(() => - { - btnSwitch.IsSelected = !btnSwitch.IsSelected; - }); - } - - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", ""); - Control.Ins.SendWriteCommand(function, d); - }) - { IsBackground = true }.Start(); - } - else - { - new TV().ControlTV(InfraredCode_TV.Power, function); - } - }; - } - - /// <summary> /// 鍔犺浇绐楀笜鎺у埗浜嬩欢 /// </summary> void LoadEvent_ControlCurtain(Function curtain, Button btnClose, Button btnOpen) { btnClose.MouseUpEventHandler = (sender, e) => { - //if (!curtain.isOnline())//绂荤嚎涓嶅厑璁告搷浣� - //{ - // new Tip() - // { - // CloseTime = 1, - // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - // Direction = AMPopTipDirection.None, - // }.Show(MainPage.BaseView); - // return; - //} btnClose.IsSelected = true; curtain.trait_on_off.curValue = "off"; curtain.SetAttrState(FunctionAttributeKey.Percent, 0); @@ -678,16 +322,6 @@ btnOpen.MouseUpEventHandler = (sender, e) => { - //if (!curtain.isOnline())//绂荤嚎涓嶅厑璁告搷浣� - //{ - // new Tip() - // { - // CloseTime = 1, - // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), - // Direction = AMPopTipDirection.None, - // }.Show(MainPage.BaseView); - // return; - //} btnOpen.IsSelected = true; curtain.trait_on_off.curValue = "on"; curtain.SetAttrState(FunctionAttributeKey.Percent, 100); -- Gitblit v1.8.0