本文整理汇总了C#中System.Diagnostics.EventLog.EndInit方法的典型用法代码示例。如果您正苦于以下问题:C# EventLog.EndInit方法的具体用法?C# EventLog.EndInit怎么用?C# EventLog.EndInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.EventLog
的用法示例。
在下文中一共展示了EventLog.EndInit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SystemEventLogging
public SystemEventLogging()
{
_eventLog = new EventLog();
_eventLog.BeginInit();
_eventLog.Log = "ВИРД";
_eventLog.Source = "ВИРД";
_eventLog.EndInit();
}
示例2: EventLogWriter
private EventLogWriter( )
{
evLog = new EventLog();
evLog.BeginInit();
evLog.Log = "Application";
evLog.Source = "ShareIndexService";
evLog.EndInit();
}
示例3: LoadConfig
public void LoadConfig(TailFileConfig tailConfig, string configPath)
{
try
{
_eventLog = new EventLog(tailConfig.FilePath);
_eventLog.EntryWritten += new EntryWrittenEventHandler(_eventLog_EntryWritten);
_eventLog.EndInit();
if (_eventLog.Entries.Count == -1)
return; // Crazy check just to ensure we have permissions to read the log
}
catch (System.Security.SecurityException ex)
{
MessageBox.Show(this, "Access denied when opening log: " + tailConfig.FilePath + "\n\n" + ex.Message);
Close();
return;
}
_messageLookup = new EventLogMesageLookup(_eventLog);
if (tailConfig.FormBackColor != null)
_eventListView.BackColor = tailConfig.FormBackColor.Value;
if (tailConfig.FormTextColor != null)
_eventListView.ForeColor = tailConfig.FormTextColor.Value;
if (tailConfig.FormFont != null)
{
_eventListView.Font = tailConfig.FormFont;
_eventMessageText.Font = tailConfig.FormFont;
}
if (tailConfig.Title != null)
_formTitle = tailConfig.Title;
else
_formTitle = "EventLog - " + _eventLog.LogDisplayName;
TabPage parentTab = this.Tag as TabPage;
if (parentTab != null)
parentTab.Text = _formTitle;
if (tailConfig.ColumnFilters != null)
{
foreach (List<string> filter in tailConfig.ColumnFilters)
{
List<Regex> columnFilter = new List<Regex>();
foreach (string regexPattern in filter)
{
if (!string.IsNullOrEmpty(regexPattern))
columnFilter.Add(new Regex(regexPattern));
else
columnFilter.Add(null);
}
_columnFilters.Add(columnFilter);
}
}
_filterActive = tailConfig.ColumnFilterActive;
_displayTabIcon = tailConfig.DisplayTabIcon;
if (Visible)
{
ConfigureColumnFilter(_filterActive);
}
}