當前位置: 首頁>>代碼示例>>C#>>正文


C# TvBusinessLayer.RemoveOldPrograms方法代碼示例

本文整理匯總了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
//.........這裏部分代碼省略.........
開發者ID:sekotin,項目名稱:MediaPortal-1,代碼行數:101,代碼來源:BusinessLayer.cs


注:本文中的TvDatabase.TvBusinessLayer.RemoveOldPrograms方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。