wxr
2024-10-15 9523ea8fc874c27ad1369c076de59c00bbc5d470
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
    public partial class FunctionPage
    {
        System.Threading.Thread updateUiThread;
        object lockObj = new object();
        /// <summary>
        /// 更新功能列表界面功能状态
        /// </summary>
        /// <param name="function"></param>
        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);
        }
 
 
    }
}