Esempio n. 1
0
 private void AddList(ListView cListView, ListViewItem cListViewItem)
 {
     if (this.InvokeRequired)
     {
         AddListCallBack add = new AddListCallBack(AddList);
         this.Invoke(add, new object[] { cListView, cListViewItem });
     }
     else
     {
         cListView.Items.Insert(0, cListViewItem);
     }
 }
Esempio n. 2
0
 private void AddList(ListView cListView, ListViewItem cListViewItem, bool bReverse)
 {
     if (this.InvokeRequired)
     {
         AddListCallBack add = new AddListCallBack(AddList);
         this.Invoke(add, new object[] { cListView, cListViewItem, bReverse });
     }
     else
     {
         if (bReverse)
         {
             cListView.Items.Insert(0, cListViewItem);
         }
         else
         {
             cListView.Items.Add(cListViewItem);
         }
         ////cListView.Items.Insert(0, cListViewItem);
         //cListView.Items.Add(cListViewItem);
     }
 }
Esempio n. 3
0
        //Output log to ListView
        private void AddList(AcsDemoPublic.LOCAL_LOG_INFO struLogInfo)
        {
            if (this.InvokeRequired)
            {
                AddListCallBack add = new AddListCallBack(AddList);
                this.BeginInvoke(add, new object[] { struLogInfo });
            }
            else
            {
                lock (locker)
                {
                    if (listViewAllLog.Items.Count >= 5000)
                    {
                        listViewAllLog.Items.Clear();
                    }
                    if (listViewAlarmInfo.Items.Count >= 5000)
                    {
                        listViewAlarmInfo.Items.Clear();
                    }
                    string strLogType = Properties.Resources.successLogType;
                    switch (struLogInfo.iLogType)
                    {
                    case AcsDemoPublic.ALARM_INFO_T:
                        strLogType = Properties.Resources.alarmLogType;
                        ListViewItem listItem1 = new ListViewItem();
                        listItem1.Text = struLogInfo.strTime;
                        listItem1.SubItems.Add(struLogInfo.strLogInfo);
                        listItem1.SubItems.Add(struLogInfo.strDevInfo);
                        listViewAlarmInfo.Items.Insert(0, listItem1);
                        break;

                    case AcsDemoPublic.OPERATION_SUCC_T:
                        strLogType = Properties.Resources.successLogType;
                        ListViewItem listItem2 = new ListViewItem();
                        listItem2.Text = struLogInfo.strTime;
                        listItem2.SubItems.Add(strLogType);
                        listItem2.SubItems.Add(struLogInfo.strLogInfo);
                        listItem2.SubItems.Add(struLogInfo.strDevInfo);
                        listItem2.SubItems.Add(struLogInfo.strErrInfo);
                        listViewAllLog.Items.Insert(0, listItem2);
                        break;

                    case AcsDemoPublic.OPERATION_FAIL_T:
                        strLogType = Properties.Resources.failLogType;
                        ListViewItem listItem3 = new ListViewItem();
                        listItem3.Text = struLogInfo.strTime;
                        listItem3.SubItems.Add(strLogType);
                        listItem3.SubItems.Add(struLogInfo.strLogInfo);
                        listItem3.SubItems.Add(struLogInfo.strDevInfo);
                        listItem3.SubItems.Add(struLogInfo.strErrInfo);
                        listViewAllLog.Items.Insert(0, listItem3);
                        break;

                    case AcsDemoPublic.PLAY_SUCC_T:
                        strLogType = Properties.Resources.successLogType;
                        ListViewItem listItem4 = new ListViewItem();
                        listItem4.Text = struLogInfo.strTime;
                        listItem4.SubItems.Add(strLogType);
                        listItem4.SubItems.Add(struLogInfo.strLogInfo);
                        listItem4.SubItems.Add(struLogInfo.strDevInfo);
                        listItem4.SubItems.Add(struLogInfo.strErrInfo);
                        listViewAllLog.Items.Insert(0, listItem4);
                        break;

                    case AcsDemoPublic.PLAY_FAIL_T:
                        strLogType = Properties.Resources.failLogType;
                        ListViewItem listItem5 = new ListViewItem();
                        listItem5.Text = struLogInfo.strTime;
                        listItem5.SubItems.Add(strLogType);
                        listItem5.SubItems.Add(struLogInfo.strLogInfo);
                        listItem5.SubItems.Add(struLogInfo.strDevInfo);
                        listItem5.SubItems.Add(struLogInfo.strErrInfo);
                        listViewAllLog.Items.Insert(0, listItem5);
                        break;

                    default:
                        strLogType = Properties.Resources.failLogType;
                        ListViewItem listItem6 = new ListViewItem();
                        listItem6.Text = struLogInfo.strTime;
                        listItem6.SubItems.Add(strLogType);
                        listItem6.SubItems.Add(struLogInfo.strLogInfo);
                        listItem6.SubItems.Add(struLogInfo.strDevInfo);
                        listItem6.SubItems.Add(struLogInfo.strErrInfo);
                        listViewAllLog.Items.Insert(0, listItem6);
                        break;
                    }
                }
            }
        }