using System;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
public partial class FunctionPage
{
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)
// {
// if (bodyView.updateUiThread == null)
// {
// MainPage.Log("线程被置空了!!");
// return;
// }
// try
// {
// while (true)
// {
// System.Threading.Thread.Sleep(1500);
// if (bodyView == null)
// {
// return;
// }
// if (DateTime.Now.AddMilliseconds(-1500) > localFunction.updateTime)
// {
// MainPage.Log("没有新数据,更新UI");
// break;
// }
// else
// {
// MainPage.Log("有新数据,继续等待");
// }
// }
// new ClassificaitionPublicBLL().UpdataStates(localFunction, bodyView, functionListView);
// }
// 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);
}
}catch(Exception ex)
{
MainPage.Log("FunctionPage UpdateStates error " + ex.Message);
}
}
public static void UpdataOnline(Function function)
{
new ClassificaitionPublicBLL().UpdataOnlineStatus(function, bodyView, functionListView);
}
}
}