本文整理匯總了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
//.........這裏部分代碼省略.........