천호석
2022-06-17 4de9ea98e13449174aa2cd09c8351fc0e978f44a
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace SHARP_CLAS_UI
{
    public partial class Form_Cim : Form
    {
        #region Field
        Form_Frame _Parent;
 
        CIM_Server server;
        CIM_Client client;
 
        Thread UI_Update_Th;
        delegate void UI_Update_Delegate();
        bool update_check;
        #endregion
 
        #region Construct
        public Form_Cim(Form_Frame _Parent)
        {
            InitializeComponent();
            this._Parent = _Parent;
            server = _Parent._equip.cim_server;
            client = _Parent._equip.cim_client;
 
            UI_Update_Th = new Thread(UI_Update_Th_Set);
            UI_Update_Th.Start();
        }
        #endregion
 
        #region Form Fuction
 
        #endregion
 
        #region Function
        private void UI_Update_Th_Set()
        {
            while (!_Parent.IsDisposed)
            {
                Thread.Sleep(50);
                if (!update_check)
                {
                    update_check = true;
                    UI_Update();
                }
            }
        }
        private void UI_Update()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new UI_Update_Delegate(UI_Update));
                return;
            }
            else
            {
                try
                {
                    DateTime dt = DateTime.Now;
 
                    lb_Cim_Server.BackColor = _Parent._equip.cim_mode == En_Cim_Mode.Online ? Color.Lime : Color.Green;
 
                    TimeSpan ts = DateTime.Now - dt;
                }
                catch (Exception ex)
                {
 
                }
                finally
                {
                    update_check = false;
                }
            }
        }
        #endregion
    }
}