예제 #1
0
        private void logtypeMenuItemClickHandler(object sender, EventArgs e)
        {
            ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
            EventLog          logs        = GetLogs.GetEventLogs(clickedItem.Name, listBox1.Text);

            LogViewer logviewer = new LogViewer(logs);

            // Take some action based on the data in clickedItem
        }
예제 #2
0
        private void BuildLogItems()
        {
            List <Logs> logList = GetLogs.GetLogNames(listBox1.Text);

            ToolStripMenuItem[] logtypes = new ToolStripMenuItem[logList.Count];
            for (int i = 0; i < logtypes.Length; i++)
            {
                logtypes[i]        = new ToolStripMenuItem();
                logtypes[i].Name   = logList[i].LogName;
                logtypes[i].Tag    = "specialDataHere";
                logtypes[i].Text   = logtypes[i].Name;
                logtypes[i].Click += new EventHandler(logtypeMenuItemClickHandler);
            }
            remoteLogsToolStripMenuItem.DropDownItems.AddRange(logtypes);
        }
예제 #3
0
파일: Logs.cs 프로젝트: tankcr/SysTools
        public static List <Logs> GetLogNames(string computername)
        {
            List <Logs> logs     = new List <Logs>();
            GetLogs     LogNames = new GetLogs();

            EventLog[] remoteEventLogs;
            remoteEventLogs = EventLog.GetEventLogs(computername);
            Logs log = new Logs();

            foreach (EventLog e in remoteEventLogs)
            {
                log         = new Logs();
                log.LogName = e.LogDisplayName;
                logs.Add(log);
            }
            return(logs);
        }