Beispiel #1
0
 /// <summary>
 /// Removes a plugin source
 /// </summary>
 /// <param name="plugin">
 /// A <see cref="ILiveRadioPlugin"/> the plugin which to remove the source for
 /// </param>
 public void RemovePlugin(ILiveRadioPlugin plugin)
 {
     if (plugins.Contains(plugin))
     {
         LiveRadioPluginSource plugin_source = plugin.PluginSource;
         plugin.Disable();
         this.RemoveChildSource(plugin_source);
         plugin_source.Dispose();
         this.UpdateCounts();
         if (enabled_plugins.Contains(plugin.Name))
         {
             enabled_plugins.Remove(plugin.Name);
             SetEnabledPluginsEntry();
         }
     }
     else
     {
         Log.DebugFormat("[LiveRadioSource]<RemovePlugin> plugin {0} not registered, cannot remove", plugin.Name);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Add and initialize a plugin -- if it is not an assembly plugin, it must be registered first, assembly
 /// plugins are auto registered
 /// </summary>
 /// <param name="plugin">
 /// A <see cref="ILiveRadioPlugin"/> -- the plugin to initialize
 /// </param>
 public void AddPlugin(ILiveRadioPlugin plugin)
 {
     if (plugins.Contains(plugin))
     {
         LiveRadioPluginSource plugin_source = new LiveRadioPluginSource(plugin);
         this.AddChildSource(plugin_source);
         this.MergeSourceInput(plugin_source, SourceMergeType.Source);
         plugin.Initialize();
         plugin_source.UpdateCounts();
         if (!enabled_plugins.Contains(plugin.Name))
         {
             enabled_plugins.Add(plugin.Name);
             SetEnabledPluginsEntry();
         }
     }
     else
     {
         Log.DebugFormat("[LiveRadioSource]<AddPlugin> plugin {0} not registered, cannot add", plugin.Name);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Handles the RefreshLiveRadioAction. Initiates a reload of the active source/plugin's genre list
        /// and resets the active child source's view
        /// </summary>
        /// <param name="o">
        /// A <see cref="System.Object"/> -- not used
        /// </param>
        /// <param name="e">
        /// A <see cref="EventArgs"/> -- not used
        /// </param>
        protected void OnRefreshPlugin(object o, EventArgs e)
        {
            LiveRadioPluginSource current_source = ServiceManager.SourceManager.ActiveSource as LiveRadioPluginSource;

            if (current_source == null)
            {
                return;
            }
            foreach (ILiveRadioPlugin plugin in plugins)
            {
                if (plugin.PluginSource != null && plugin.PluginSource.Equals(current_source))
                {
                    plugin.RetrieveGenreList();
                    LiveRadioPluginSourceContents source_contents =
                        current_source.Properties.Get <ISourceContents> ("Nereid.SourceContents") as LiveRadioPluginSourceContents;
                    if (source_contents != null)
                    {
                        source_contents.InitRefresh();
                    }

                    return;
                }
            }
        }
 /// <summary>
 /// Add and initialize a plugin -- if it is not an assembly plugin, it must be registered first, assembly
 /// plugins are auto registered
 /// </summary>
 /// <param name="plugin">
 /// A <see cref="ILiveRadioPlugin"/> -- the plugin to initialize
 /// </param>
 public void AddPlugin(ILiveRadioPlugin plugin)
 {
     if (plugins.Contains (plugin))
     {
         LiveRadioPluginSource plugin_source = new LiveRadioPluginSource (plugin);
         this.AddChildSource (plugin_source);
         this.MergeSourceInput (plugin_source, SourceMergeType.Source);
         plugin.Initialize ();
         plugin_source.UpdateCounts ();
         if (!enabled_plugins.Contains (plugin.Name))
         {
             enabled_plugins.Add(plugin.Name);
             SetEnabledPluginsEntry ();
         }
     } else {
         Log.DebugFormat ("[LiveRadioSource]<AddPlugin> plugin {0} not registered, cannot add", plugin.Name);
     }
 }