I tested your code on our network.

Local Machine:
1458 Entries = 12.8 seconds

Remote Machine:
1970 Entries = 1 minute 48 seconds

Local machine running Windows .NET server (beta 3).
Remote machine running Windows 2000

Walt Ritscher

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Powell, Simon
Sent: Friday, May 31, 2002 3:12 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Eventlog Viewer


It takes 1 minutes 40 sec to read 2218 entries from a remote
workstation. I need to use the Listview to keep a similar look and feel
as the Windows NT event log viewer.

-----Original Message-----
From: Vincent Van Proosdij [mailto:[EMAIL PROTECTED]]
Sent: 31 May 2002 09:53
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Eventlog Viewer


How many entries are there in your log? Maybe you can display only the
errors. I tried your code on 1000 entries, writing only the errors to
xml and it performs quite nice. Thanks for the snippet. I was not aware
of how easy this Was. I've incorporated it into my
dataaccess/debug/tracing framework.

-----Original Message-----
From: Powell, Simon [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 31 mei 2002 10:04
To: [EMAIL PROTECTED]
Subject: [DOTNET] Eventlog Viewer

Hi,

I'm still fairly new to .NET, but I want to create an eventlog viewer
using C#. Attached at the bottom is some code I've already written. My
problem is that I can't match the performance of the Windows NT
eventview for reading the application event log. I can read a remote
machine's app log in seconds, but my code takes over a minute to read
the same information. How can I improve my code? Someone out there must
have tried already? Or should I just give up and use a diffent language
(C++)? If I try a listBox (rather than listView), I get a small
improvement, but nothing to match the eventviewer. What am I doing
wrong? I am the only one trying this? If Microsoft in the future will be
using C# to build their OS, will they be using the eventlog class and a
listView control, if so how will they achieve acceptable perform?

Is there a good book out there that would help?

Any help would be much appricated.

Simon

(frustrated and about to give up...)


        Code snippet*
                        |
                        |
                        V


private void GetEventlog()
{
        int rowcount = 0;
        EventLog NTIlog = new EventLog("Application",CurMachine);

        for(int i = 0; i < NTIlog.Entries.Count; i++)
        {

                if(NTIlog.Entries[i].Source.ToString() ==
"PontisInstallAgent")
                {
                ListViewItem item =
listView1.Items.Add(NTIlog.Entries[i].TimeGenerated.ToString());


                switch(NTIlog.Entries[i].EntryType.ToString())
                {
                        case "Error" :
                                item.BackColor = Color.Red;
                                item.ForeColor = Color.White;
                                break;
                        case "Warning" :
                                item.BackColor = Color.Yellow;
                                item.ForeColor = Color.Black;
                                break;
                        default :
                                item.BackColor = Color.White;
                                item.ForeColor = Color.Black;
                                break;
                }

item.SubItems.Add(NTIlog.Entries[i].EntryType.ToString());
                        item.SubItems.Add(NTIlog.Entries[i].Message);
                }
        }


                        foreach(ColumnHeader col in listView1.Columns)
                        {
                                col.Width = -2;
                        }

                        NTIlog.Close();
                }





----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to