本文整理汇总了C#中TvDatabase.TvBusinessLayer.RemoveOldPrograms方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.RemoveOldPrograms方法的具体用法?C# TvBusinessLayer.RemoveOldPrograms怎么用?C# TvBusinessLayer.RemoveOldPrograms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.RemoveOldPrograms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertProgramsThreadStart
//public void StartResetProgramStatesThread(ThreadPriority aThreadPriority)
//{
// if (_resetProgramStatesThread == null || !_resetProgramStatesThread.IsAlive)
// {
// _resetProgramStatesThread = new Thread(ProgramStatesThread);
// _resetProgramStatesThread.Priority = aThreadPriority;
// _resetProgramStatesThread.Name = "Program states thread";
// _resetProgramStatesThread.IsBackground = true;
// _resetProgramStatesThread.Start();
// }
//}
//private void ProgramStatesThread()
//{
// lock (SingleProgramStateUpdate)
// {
// if (_lastProgramUpdate == DateTime.MinValue)
// {
// return;
// }
// while (true)
// {
// System.TimeSpan ts = DateTime.Now - _lastProgramUpdate;
// Log.Info("BusinessLayer: ProgramStatesThread waiting...{0} sec", ts.TotalSeconds);
// if (ts.TotalSeconds >= 60) //if more than 60 secs. has passed since last update to the program table, then lets do the program states
// {
// Log.Info("BusinessLayer: ProgramStatesThread - done waiting. calling SynchProgramStatesForAll");
// _lastProgramUpdate = DateTime.MinValue;
// Schedule.SynchProgramStatesForAll();
// return;
// }
// else
// {
// Thread.Sleep(1000);
// }
// }
// }
//}
//private void ImportMySqlThread(object aImportParam)
//{
// lock (SingleInsert)
// {
// ImportParams MyParams = (ImportParams)aImportParam;
// InsertMySql(MyParams);
// _lastProgramUpdate = DateTime.Now;
// StartResetProgramStatesThread(ThreadPriority.BelowNormal);
// }
//}
//private void ImportSqlServerThread(object aImportParam)
//{
// lock (SingleInsert)
// {
// ImportParams MyParams = (ImportParams)aImportParam;
// InsertSqlServer(MyParams);
// _lastProgramUpdate = DateTime.Now;
// StartResetProgramStatesThread(ThreadPriority.BelowNormal);
// }
//}
private static void InsertProgramsThreadStart()
{
try
{
Log.Debug("BusinessLayer: InsertProgramsThread started");
IGentleProvider prov = ProviderFactory.GetDefaultProvider();
string provider = prov.Name.ToLowerInvariant();
string defaultConnectString = prov.ConnectionString;
DateTime lastImport = DateTime.Now;
InsertProgramsDelegate insertProgams;
switch (provider)
{
case "mysql":
insertProgams = InsertProgramsMySql;
break;
case "sqlserver":
insertProgams = InsertProgramsSqlServer;
break;
default:
Log.Info("BusinessLayer: InsertPrograms unknown provider - {0}", provider);
return;
}
while (true)
{
if (lastImport.AddSeconds(60) < DateTime.Now)
{
// Done importing and 60 seconds since last import
// Remove old programs
TvBusinessLayer layer = new TvBusinessLayer();
layer.RemoveOldPrograms();
// Let's update states
Schedule.SynchProgramStatesForAll();
// and exit
//.........这里部分代码省略.........