Пример #1
0
    public void LoadSettings(string selectedSkin)
    {
      // We must specify the hostname of the TV server since MP is not running and their is no active communication with the TV server.
      TvServerRemote.HostName = TVRadio.Hostname;

      // Get the MediaPortal genres from the TV server.
      _mpGenres = TvServerRemote.GetMpGenres();

      // Load tv guide colors.
      using (Settings xmlreader = new SKSettings())
      {
        string selectedTheme;
        selectedTheme = xmlreader.GetValueAsString("theme", "name", GUIThemeManager.THEME_SKIN_DEFAULT);

        if (!xmlreader.HasSection<string>("tvguidecolors"))
        {
          CreateDefaultGenreColors(xmlreader);
        }

        PopulateThemesList(selectedTheme);

        if (SettingsForm.UseTvServer)
        {
          if (!_guideColorsLoaded)
          {
            _guideColorsLoaded = LoadGuideColors(xmlreader);
          }

          PopulateGuideGenreList();

          // Need to read skin settings as string and parse to boolean to allow skin settings to have true/false values rather than yes/no values.
          cbColoredGuide.Checked =
            bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.usecolorsforbuttons", "False"));
          cbGenreColoring.Checked =
            bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.usecolorsforgenre", "False"));
          cbGenreColorKey.Checked =
            bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.showgenrekey", "False"));
          cbBorderHighlight.Checked =
            bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.useborderhighlight", "False"));

          cbGenreColoring.Enabled = cbColoredGuide.Checked;
          cbGenreColorKey.Enabled = cbGenreColoring.Checked;

          if (cbColoredGuide.Checked)
          {
            if (!tabControlTvGuideSettings.Controls.Contains(tabPageTvGuideColors))
            {
              tabControlTvGuideSettings.Controls.Add(tabPageTvGuideColors);
            }
          }
          else
          {
            tabControlTvGuideSettings.Controls.Remove(tabPageTvGuideColors);
          }
        }
      }
    }
Пример #2
0
    public void LoadSettings(string selectedSkin)
    {
      // Load the genre map from MP settings.
      // TODO: this needs to be loaded from tv server settings.
      using (Settings xmlreader = new MPSettings())
      {
        if (_genreList.Count == 0)
        {
          LoadGenreList(xmlreader);
        }
      }

      // Load tv guide colors.
      using (Settings xmlreader = new SKSettings())
      {
        string selectedTheme;
        selectedTheme = xmlreader.GetValueAsString("theme", "name", GUIThemeManager.THEME_SKIN_DEFAULT);

        if (!xmlreader.HasSection<string>("tvguidecolors"))
        {
          CreateDefaultGenreColors(xmlreader);
        }

        if (!_guideColorsLoaded)
        {
          _guideColorsLoaded = LoadGuideColors(xmlreader);
        }

        PopulateThemesList(selectedTheme);
        PopulateGuideGenreList();

        // Need to read skin settings as string and parse to boolean to allow skin settings to have true/false values rather than yes/no values.
        cbColoredGuide.Checked = bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.usecolorsforbuttons", "False"));
        cbGenreColoring.Checked = bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.usecolorsforgenre", "False"));
        cbGenreColorKey.Checked = bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.showgenrekey", "False"));
        cbBorderHighlight.Checked = bool.Parse(xmlreader.GetValueAsString("booleansettings", "#skin.tvguide.useborderhighlight", "False"));

        cbGenreColoring.Enabled = cbColoredGuide.Checked;
        cbGenreColorKey.Enabled = cbGenreColoring.Checked;

        if (cbColoredGuide.Checked)
        {
          if (!tabControlTvGuideSettings.Controls.Contains(tabPageTvGuideColors))
          {
            tabControlTvGuideSettings.Controls.Add(tabPageTvGuideColors);
          }
        }
        else
        {
          tabControlTvGuideSettings.Controls.Remove(tabPageTvGuideColors);
        }
      }
    }