当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.CreateGroup方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.CreateGroup方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.CreateGroup方法的具体用法?C# TvBusinessLayer.CreateGroup怎么用?C# TvBusinessLayer.CreateGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.CreateGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
      }
    }
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:101,代码来源:Startup.cs


注:本文中的TvDatabase.TvBusinessLayer.CreateGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。