示例#1
0
        private void entryList_DoubleClick(object sender, System.EventArgs e)
        {
            if (entryList.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem selectedItem = entryList.SelectedItems [0];

            if (logTree.SelectedNode.Parent == null)
            {
                string logName = (string)selectedItem.Tag;
                // locate corresponding tree node
                foreach (TreeNode node in logTree.Nodes[0].Nodes)
                {
                    if ((string)node.Tag == logName)
                    {
                        logTree.SelectedNode = node;
                        break;
                    }
                }
            }
            else
            {
                EventEntryView selectedEntry = (EventEntryView)selectedItem.Tag;
                if (_eventProperties == null || _eventProperties.IsDisposed)
                {
                    _eventProperties = new EventEntryProperties();
                }
                _eventProperties.DisplayEventEntry(selectedEntry);
                _eventProperties.Activate();
                _eventProperties.Show();
            }
        }
示例#2
0
 private void DisplayEventEntries(string logName, string machineName)
 {
     entryList.BeginUpdate();
     try {
         this.Cursor = Cursors.WaitCursor;
         // remove current items
         entryList.Items.Clear();
         // remove current columns
         entryList.Columns.Clear();
         // create necessary columns
         entryList.Columns.Add("Type", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Date", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Time", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Source", 200, HorizontalAlignment.Left);
         entryList.Columns.Add("Category", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Event", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("User", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Computer", 100, HorizontalAlignment.Left);
         // add eventlog entries
         using (EventLog eventLog = new EventLog(logName, machineName)) {
             EventLogEntryCollection entries = eventLog.Entries;
             foreach (EventLogEntry entry in entries)
             {
                 EventEntryView view = new EventEntryView(entry);
                 // most recent event log entries are at the top
                 entryList.Items.Insert(0, view.ListViewItem);
             }
         }
     } finally {
         this.Cursor = Cursors.Default;
         entryList.EndUpdate();
     }
 }
        public void DisplayEventEntry(EventEntryView entry)
        {
            _entry = entry;

            dateGeneratedText.Text = entry.DateGenerated;
            timeGeneratedText.Text = entry.TimeGenerated;
            entryTypeText.Text     = entry.EntryType;
            userNameText.Text      = entry.UserName;
            machineNameText.Text   = entry.MachineName;
            sourceText.Text        = entry.Source;
            categoryText.Text      = entry.Category;
            instanceIdText.Text    = entry.InstanceId;
            descriptionText.Text   = entry.Message;

            bool hasData = (entry.Data != null && entry.Data.Length > 0);

            dataLabel.Enabled        = hasData;
            bytesRadioButton.Enabled = hasData;
            wordsRadioButton.Enabled = hasData;
            dataText.Enabled         = hasData;

            if (hasData)
            {
                if (bytesRadioButton.Checked)
                {
                    DisplayDataBytes();
                }
                else
                {
                    DisplayDataWords();
                }
            }
            else
            {
                dataText.Text = string.Empty;
            }
        }
        public void DisplayEventEntry(EventEntryView entry)
        {
            _entry = entry;

            dateGeneratedText.Text = entry.DateGenerated;
            timeGeneratedText.Text = entry.TimeGenerated;
            entryTypeText.Text = entry.EntryType;
            userNameText.Text = entry.UserName;
            machineNameText.Text = entry.MachineName;
            sourceText.Text = entry.Source;
            categoryText.Text = entry.Category;
            instanceIdText.Text = entry.InstanceId;
            descriptionText.Text = entry.Message;

            bool hasData = (entry.Data != null && entry.Data.Length > 0);
            dataLabel.Enabled = hasData;
            bytesRadioButton.Enabled = hasData;
            wordsRadioButton.Enabled = hasData;
            dataText.Enabled = hasData;

            if (hasData) {
                if (bytesRadioButton.Checked)
                    DisplayDataBytes ();
                else
                    DisplayDataWords ();
            } else {
                dataText.Text = string.Empty;
            }
        }
示例#5
0
        private void DisplayEventEntries(string logName, string machineName)
        {
            entryList.BeginUpdate ();
            try {
                this.Cursor = Cursors.WaitCursor;
                // remove current items
                entryList.Items.Clear ();
                // remove current columns
                entryList.Columns.Clear ();
                // create necessary columns
                entryList.Columns.Add ("Type", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("Date", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("Time", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("Source", 200, HorizontalAlignment.Left);
                entryList.Columns.Add ("Category", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("Event", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("User", 100, HorizontalAlignment.Left);
                entryList.Columns.Add ("Computer", 100, HorizontalAlignment.Left);
                // add eventlog entries
                using (EventLog eventLog = new EventLog (logName, machineName)) {
                    EventLogEntryCollection entries = eventLog.Entries;
                    foreach (EventLogEntry entry in entries) {
                        EventEntryView view = new EventEntryView (entry);
                        // most recent event log entries are at the top
                        entryList.Items.Insert (0, view.ListViewItem);
                    }
                }

            } finally {
                this.Cursor = Cursors.Default;
                entryList.EndUpdate ();
            }
        }