Reply to thread

AW: Create a plugin configuration


First, there is a difference between the "Setting" and the "Configuration":


"Setting" stores your configured values (i.e. a string "Share").

"Configuration" classes used to provide support for changing settings from GUI.


For a very simple example look at the Setting for my slimtv4homeprovider:

[CODE]  class TV4HomeProviderSettings

  {

    /// <summary>

    /// Holds the host name or IP adress of the TV4home service (running on same machine as TvServer).

    /// </summary>

    [Setting(SettingScope.User, "localhost")]

    public string TvServerHost { get; set; }

  }[/CODE]


and the related configuration class: TV4HomeServerAddress.cs (note the inheritance from "Entry", a simple string input)


[CODE]using MediaPortal.Common.Configuration.ConfigurationClasses;

using MediaPortal.Plugins.SlimTvClient.Providers.Settings;


namespace MediaPortal.Plugins.SlimTv.Providers.Settings.Configuration

{

  public class TV4HomeServerAddress[B] : Entry[/B]

  {

    public override void Load()

    {

      _value = SettingsManager.Load<TV4HomeProviderSettings>().TvServerHost;

    }


    public override void Save()

    {

      base.Save();

      TV4HomeProviderSettings settings = SettingsManager.Load<TV4HomeProviderSettings>();

      settings.TvServerHost = _value;

      SettingsManager.Save(settings);

    }


    public override int DisplayLength

    {

      get { return 50; }

    }

  }

}[/CODE]


You can use some different configuration "editor" classes from the MediaPortal.Common.Configuration.ConfigurationClasses namespace.


The plugin.xml then have to contain the class name of a Configuration class.


I hope this brings you a step further :)


Morpheus


Top Bottom