Samples /// /// Event to be added privatevoidAddEvent(TcEventevt) { ListViewItemlvi =newListViewItem(); lvi.Name ="Time"; try { lvi.Text =Convert.ToString(evt.Date); } catch(Exception) { lvi.Text =""; } eventView1.Items.Insert(0, lvi); PrepareListViewItem(lvi); try { AddListViewSubItem(lvi,"Type", GetEventClassName(evt)); } catch(Exception) { } try { AddListViewSubItem(lvi,"Source", evt.get_SourceName(langId)); } catch(Exception) { } try { AddListViewSubItem(lvi,"Message", evt.GetMsgString(langId)); } catch(Exception) { } } /// ///Prepare the listview item by padding its subitems with empty items /// /// ListViewItem to be prepared privatevoidPrepareListViewItem(ListViewItemlvi) { for(inti = 0; i lvi.SubItems.Add("???");// pad items with question marks.
} /// ///Add one sub item at an indexed position to the ListViewItem /// /// Parent item. The item must have been inserted to a ListView control /// Item name (index) of the item. A coulumn with such index must exist in the ListView control /// Display text privatevoidAddListViewSubItem(ListViewItemlvi,stringname,stringtext) { ListViewItem.ListViewSubItemlvsi =newListViewItem.ListViewSubItem(); lvsi.Name = name; lvsi.Text = text; lvi.SubItems.Insert(lvi.ListView.Columns.IndexOfKey(lvsi.Name), lvsi); } /// ///Get a textual representation for the event class.
/// /// Event object /// Classname privatestringGetEventClassName(TcEventevt) { switch( (TcEventClass)evt.Class) TcEventLogger 194 Version: 1.1