示例#1
0
        private void m_settings_SettingChanged(object sender, SettingChangedEventArgs e)
        {
            if (e.SettingName == EventViewerSettings.SettingDisplayTimeZone)
            {
                m_timeZone = m_settings.DisplayTimeZone;

                if (m_timePropertyWrapper != null)
                {
                    m_timePropertyWrapper.SetValue(LogForm.GetEventMessageTime(m_eventMessage, m_timeZone));
                    panes.gridDetails.Invalidate(true);                     // Must be called to refresh the grid immediately.
                }
            }
        }
示例#2
0
        private MemberWrappers GetMessageProperties(EventMessage eventMessage)
        {
            MemberWrappers properties = new MemberWrappers();

            // Handle exceptions from individual members to give the user a chance to see the rest of the details.

            try
            {
                // Convert the time to the user-configured time zone.

                DateTime time = LogForm.GetEventMessageTime(eventMessage, m_timeZone);

                m_timePropertyWrapper = new ConstantMemberWrapper("Time", time);
                properties.Add(m_timePropertyWrapper);
                properties.Add(new ConstantMemberWrapper("Event", eventMessage.Event));
                properties.Add(new ConstantMemberWrapper("Source", eventMessage.Source));
                properties.Add(new ConstantMemberWrapper("Type", eventMessage.Type));
                properties.Add(new ConstantMemberWrapper("Method", eventMessage.Method));

                try
                {
                    properties.Add(new ExceptionWrapper(eventMessage.Exception));
                }
                catch (System.Exception ex)
                {
                    ((MainForm)MdiParent).HandleException(ex);
                }

                foreach (IEventDetail detail in eventMessage.Details)
                {
                    try
                    {
                        properties.Add(new EventDetailMemberWrapper(detail));
                    }
                    catch (System.Exception ex)
                    {
                        ((MainForm)MdiParent).HandleException(ex);
                    }
                }
            }
            catch (System.Exception ex)
            {
                ((MainForm)MdiParent).HandleException(ex);
            }

            return(properties);
        }