Exemplo n.º 1
0
        public static void UpdateAlarmList(List <AlarmInfo> AlarmList)
        {
            try
            {
                Form         form = Application.OpenForms["FormAlarm"];
                DataGridView AlarmList_gv;



                if (form == null)
                {
                    return;
                }


                AlarmList_gv = form.Controls.Find("AlarmList_gv", true).FirstOrDefault() as DataGridView;
                if (AlarmList_gv == null)
                {
                    return;
                }

                if (AlarmList_gv.InvokeRequired)
                {
                    UpdateAlarm ph = new UpdateAlarm(UpdateAlarmList);

                    AlarmList_gv.BeginInvoke(ph, AlarmList);
                }
                else
                {
                    //JobList_gv.DataSource = null;
                    AlarmList_gv.DataSource = AlarmList.ToList();

                    //Conn_gv.Refresh();
                    AlarmList_gv.ClearSelection();
                    AlarmList_gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    NodeStatusUpdate.UpdateCurrentState(FormMain.RouteCtrl.EqpState);
                    if (AlarmList.Count() != 0)
                    {
                        form.Visible = true;
                    }
                    else
                    {
                        form.Visible = false;
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateAlarmList: Update fail." + e.Message + "\n" + e.StackTrace);
            }
        }
Exemplo n.º 2
0
        public static void UpdateAlarmHistory(List <AlarmInfo> AlarmList)
        {
            try
            {
                Form         form = Application.OpenForms["Form1"];
                DataGridView AlarmList_gv;

                if (form == null)
                {
                    return;
                }


                AlarmList_gv = form.Controls.Find("AlarmHistory_gv", true).FirstOrDefault() as DataGridView;
                if (AlarmList_gv == null)
                {
                    return;
                }

                if (AlarmList_gv.InvokeRequired)
                {
                    UpdateAlarm ph = new UpdateAlarm(UpdateAlarmHistory);
                    AlarmList_gv.BeginInvoke(ph, AlarmList);
                }
                else
                {
                    //JobList_gv.DataSource = null;
                    AlarmList_gv.DataSource = AlarmList;

                    //Conn_gv.Refresh();
                    AlarmList_gv.ClearSelection();
                    AlarmList_gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateAlarmHistory: Update fail." + e.Message + "\n" + e.StackTrace);
            }
        }