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_Auto_Power_Viewer : Form
|
{
|
delegate void UI_Update_Delegate();
|
|
Equipment _equip;
|
|
Thread UI_Update_Th;
|
|
bool update_check;
|
|
public bool shown;
|
|
bool Clear_bit;
|
|
Queue<string> Info_Que = new Queue<string>();
|
|
public Form_Auto_Power_Viewer(Equipment _equip)
|
{
|
InitializeComponent();
|
this._equip = _equip;
|
|
UI_Update_Th = new Thread(UI_Update_Th_Set);
|
UI_Update_Th.Start();
|
}
|
|
private void UI_Update_Th_Set()
|
{
|
while (!_equip.IsDisposed)
|
{
|
Thread.Sleep(100);
|
|
if (!update_check)
|
{
|
update_check = true;
|
UI_Update();
|
}
|
}
|
}
|
|
private void UI_Update()
|
{
|
if (InvokeRequired)
|
{
|
BeginInvoke(new UI_Update_Delegate(UI_Update));
|
return;
|
}
|
else
|
{
|
try
|
{
|
object value;
|
|
lb_Power_Measuring.BackColor = _equip.process.ablation.Is_Power_Measure ? Color.Lime : Color.Green;
|
|
if (_equip.sm.Get_Value(Process_Memory_Address.Power_Meter_Energy, out value))
|
{
|
tb_Power.Text = value.ToString();
|
}
|
|
if (_equip.sm.Get_Value(Process_Memory_Address.Power_Meter_Average, out value))
|
{
|
tb_Average.Text = value.ToString();
|
}
|
if (_equip.sm.Get_Value(Process_Memory_Address.Power_Meter_Count, out value))
|
{
|
tb_Count.Text = value.ToString();
|
}
|
if (_equip.sm.Get_Value(Process_Memory_Address.Power_Meter_Max, out value))
|
{
|
tb_Max.Text = value.ToString();
|
}
|
if (_equip.sm.Get_Value(Process_Memory_Address.Power_Meter_Min, out value))
|
{
|
tb_Min.Text = value.ToString();
|
}
|
|
tb_Hour.Text = (_equip.Power_Parameter.Measurement_Cycle_Hour - (DateTime.Now - _equip.Power_Parameter.Measure_Date).TotalHours).ToString();
|
|
if (Info_Que.Count > 0)
|
{
|
string str = Info_Que.Dequeue();
|
|
tb_Info.AppendText(str + "\r\n");
|
}
|
|
if(Clear_bit)
|
{
|
tb_Info.Text = string.Empty;
|
Clear_bit = false;
|
}
|
}
|
catch (Exception ex)
|
{
|
|
}
|
finally
|
{
|
update_check = false;
|
}
|
}
|
}
|
|
public void Add_Info(string str)
|
{
|
Info_Que.Enqueue(str);
|
}
|
|
public void Clear_Info()
|
{
|
Clear_bit = true;
|
}
|
|
private void btn_Hide_Click(object sender, EventArgs e)
|
{
|
shown = false;
|
this.Hide();
|
}
|
}
|
}
|