using System; using HDL_ON.Entity; using Shared; namespace HDL_ON.UI { public partial class RoomPage { System.Threading.Thread updateUiThread; object lockObj = new object(); /// /// 更新功能状态 /// /// public static void UpdataStates(Function function) { try { if (bodyView == null) { return; } //if (SPK.LightSpkList().Contains(function.spk)) //{ // { // var localFunction = FunctionList.List.GetLightList().Find((obj) => obj.sid == function.sid); // { // if (localFunction != null) // { // if (bodyView.updateUiThread == null) // { // bodyView.updateUiThread = new System.Threading.Thread(() => // { // lock (bodyView.lockObj) // { // try // { // while (true) // { // try // { // System.Threading.Thread.Sleep(1500); // if (bodyView == null) // { // return; // } // if (bodyView.updateUiThread == null) // { // return; // } // if (DateTime.Now.AddMilliseconds(-1500) > localFunction.updateTime) // { // MainPage.Log("没有新数据,更新UI"); // break; // } // else // { // MainPage.Log("有新数据,继续等待"); // } // } // catch (Exception ex) // { // MainPage.Log("线程异常:" + ex.Message); // } // } // new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView, room); // } // catch (Exception ex) // { // MainPage.Log("FunctionPage UpdateStates error 2 :" + ex.Message); // } // finally // { // //bodyView.updateUiThread = null; // } // } // }); // bodyView.updateUiThread.IsBackground = true; // bodyView.updateUiThread.Start(); // } // } // } // } //} //else { new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView,room); } } catch (Exception ex) { MainPage.Log("FunctionPage UpdateStates error " + ex.Message); } } public static void UpdataOnline(Function function) { new ClassificaitionPublicBLL().UpdataOnlineStatus(function, bodyView, functionListView); } /// /// 加载事件列表 /// void LoadEventList() { } /// /// 跳转到编辑房间的界面 /// void LoadEvent_SkipEditRoomPage() { Action editBackAction = () => { room.UpdataRoomInfo(); ReLoadPage(); ReloadRoomName(); }; Action delAction = () => { this.RemoveFromParent(); deleteAction?.Invoke(); }; var skipPage = new RoomEditPage(room, editBackAction, delAction, this.modifyImageAction); MainPage.BasePageView.AddChidren(skipPage); skipPage.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } } }