The IRssSettingsControl interface defines the settings control. This control is used for setting which information to be extracted from the
channel providers.
In order to implement that functionality, we will create a new class - JobModule - and place it in the WebControls folder of the Samples.Jobs.Pluggable
module. It will implement the interface, and also inherit the CompositeControl class (the basic functionality required by Web controls that contain
child controls).
Inherited Members
The following methods implement the IRssSettingsControl interface:
One of the methods is public void InitSettings. It initializes the settings. The parameter contains the
default values when a new provider is created (in IRssProviderModule implementation). If the provider has already been created, the parameter
contains the values saved in the database.
The following code initializes the settings for Jobs.Pluggable:
| InitSettings() |
Copy Code |
|
public void InitSettings(IDictionary<string, string> settings)
{
this.settings = settings;
}
|
The second method is public IDictionary<string,string> GetSettings. It gets the newly edited
settings.
The following code gets the settings for Jobs.Pluggable:
| GetSettings() |
Copy Code |
|
public IDictionary<string, string> GetSettings()
{
this.settings = new Dictionary<string, string>();
this.settings[JobsChannelProvider.KeyJobProvider] = this.ctrlContainer.ProviderName.Text;
this.settings[JobsChannelProvider.KeyJobUrl] = this.ctrlContainer.JobUrl.Text;
this.settings[JobsChannelProvider.KeyItemCount] = this.ctrlContainer.ItemsCount.Text;
if (this.ctrlContainer.AllJobs.Checked)
this.settings[JobsChannelProvider.KeySelectedJobs] = "";
else if (this.ctrlContainer.ChooseJobs.Checked)
{
StringBuilder values = new StringBuilder();
foreach (ListItem item in this.ctrlContainer.JobsList.Items)
{
if (item.Selected)
{
values.Append(item.Value);
values.Append(";");
}
}
this.settings[JobsChannelProvider.KeySelectedJobs] = values.ToString();
}
this.settings[JobsChannelProvider.KeySyndicationType] = this.ctrlContainer.SyndicationType.SelectedValue;
this.settings[JobsChannelProvider.KeySummaryLength] = this.ctrlContainer.SummaryLength.Text;
return this.settings;
}
|
See Also