FrmExceptionMsg.cs 2.2 KB

using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace OnlineStore.AssemblyLine
{
    internal partial class FrmExceptionMsg : FrmBase
    {
        public FrmExceptionMsg()
        {
            InitializeComponent();
        }  
        private void FrmTrayInfo_Load(object sender, EventArgs e)
        {
            loadMsg();
        }

        private void loadMsg()
        {
            try
            {
                List<ExceptionMsg> msgList = ExceptionMsgManager.getList();
                dataGridView1.Rows.Clear();
                foreach (ExceptionMsg msg in msgList)
                {
                    try
                    {
                        if (msg == null)
                        {
                            continue;
                        }
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dataGridView1);
                        row.Cells[Column_Module.Index].Value = msg.module;
                        row.Cells[Column_Name.Index].Value = msg.name;
                        row.Cells[Column_Time.Index].Value = msg.updateTime.ToString("yyyy-MM-dd HH:mm:ss");
                        row.Cells[Column_Msg.Index].Value = msg.message;
                        dataGridView1.Rows.Add(row);
                    }
                    catch (Exception ex) { LogUtil.error("FrmExceptionMsg loadMsg error:" + ex.ToString()); }
                }
            }
            catch (Exception ex) { LogUtil.error("FrmExceptionMsg loadMsg error:" + ex.ToString()); }
        }
       

        private void btnUpdate_Click(object sender, EventArgs e)
        { 
            loadMsg();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmTrayInfo_SizeChanged(object sender, EventArgs e)
        {
            this.Left = Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2;//桌面的宽度的一半减去自身宽的的一半
            this.Top = Screen.PrimaryScreen.Bounds.Height / 2 - this.Height / 2;//桌面的高度的一半减去自身高度的一半
 
        }
    }
}