本文整理汇总了C#中TvDatabase.TvBusinessLayer.SetLogLevel方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.SetLogLevel方法的具体用法?C# TvBusinessLayer.SetLogLevel怎么用?C# TvBusinessLayer.SetLogLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.SetLogLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
/// <summary>
/// When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.
/// </summary>
/// <param name="args">Data passed by the start command.</param>
protected override void OnStart(string[] args)
{
if (_tvServiceThread == null)
{
if (!(args != null && args.Length > 0 && args[0] == "/DEBUG"))
{
RequestAdditionalTime(60000); // starting database can be slow so increase default timeout
}
TvServiceThread tvServiceThread = new TvServiceThread();
ThreadStart tvServiceThreadStart = new ThreadStart(tvServiceThread.OnStart);
_tvServiceThread = new Thread(tvServiceThreadStart);
_tvServiceThread.IsBackground = false;
// apply process priority on initial service start.
if (!_priorityApplied)
{
try
{
applyProcessPriority();
_priorityApplied = true;
}
catch (Exception ex)
{
// applyProcessPriority can generate an exception when we cannot connect to the database
Log.Error("OnStart: exception applying process priority: {0}", ex.StackTrace);
}
}
var layer = new TvBusinessLayer();
layer.SetLogLevel();
_tvServiceThread.Start();
while (!TvServiceThread.Started)
{
Thread.Sleep(20);
}
}
}
示例2: Main
//.........这里部分代码省略.........
"DB recreation needed", MessageBoxButtons.OKCancel, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
return;
Log.Info("---- create database ----");
if (!dlg.ExecuteSQLScript("create"))
{
MessageBox.Show("Failed to create the database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Log.Info("- Database created.");
currentSchemaVersion = dlg.GetCurrentShemaVersion(startupMode);
}
Log.Info("---- upgrade database schema ----");
// Get MySQL server version
string currentServerVersion = dlg.GetCurrentServerVersion(startupMode);
if (!dlg.UpgradeDBSchema(currentSchemaVersion, currentServerVersion))
{
MessageBox.Show("Failed to upgrade the database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Log.Info("---- check if tvservice is running ----");
if (!ServiceHelper.IsRunning)
{
Log.Info("---- tvservice is not running ----");
if (startupMode != StartupMode.DeployMode)
{
DialogResult result = MessageBox.Show("The Tv service is not running.\rStart it now?",
"Mediaportal TV service", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes) return;
}
Log.Info("---- start tvservice----");
ServiceHelper.Start();
}
ServiceHelper.WaitInitialized();
int cards = 0;
try
{
cards = RemoteControl.Instance.Cards;
}
catch (Exception)
{
Log.Info("---- restart tvservice----");
ServiceHelper.Restart();
ServiceHelper.WaitInitialized();
try
{
RemoteControl.Clear();
RemoteControl.HostName = Dns.GetHostName();
cards = RemoteControl.Instance.Cards;
}
catch (Exception ex)
{
Log.Info("---- Unable to restart tv service----");
Log.Write(ex);
MessageBox.Show("Failed to startup tvservice" + ex);
return;
}
}
var layer = new TvBusinessLayer();
layer.SetLogLevel();
// Mantis #0001991: disable mpg recording (part I: force TS recording format)
IList<Card> TvCards = Card.ListAll();
foreach (Card card in TvCards)
{
if (card.RecordingFormat != 0)
{
card.RecordingFormat = 0;
Log.Info("Card {0} switched from .MPG to .TS format", card.Name);
card.Persist();
}
}
// Mantis #0002138: impossible to configure TVGroups
layer.CreateGroup(TvConstants.TvGroupNames.AllChannels);
// Avoid the visual part of SetupTv if in DeployMode
if (startupMode == StartupMode.DeployMode)
{
return;
}
try
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Application.EnableVisualStyles();
Application.DoEvents();
new Startup().Start();
}
catch (Exception ex)
{
Log.Write(ex);
}
}