class FlickrDataSourceDesigner : DataSourceDesigner
{
private FlickrDataSource m_dataSource;
private FlickrDesignerDataSourceView m_view;
public FlickrDataSource DataSource
get { return m_dataSource; }
}
public override bool CanConfigure
get
return true;
public override DesignerDataSourceView GetView(string viewName)
if (m_view == null)
m_view = new FlickrDesignerDataSourceView(this, viewName);
return m_view;
public override void Configure()
InvokeTransactedChange(Component, new TransactedChangeCallback(ConfigureFlickrDataSource), null,
"Configure Data Source");
public override void Initialize
(System.ComponentModel.IComponent component)
base.Initialize(component);
m_dataSource = (FlickrDataSource)component;
private bool ConfigureFlickrDataSource(object context)
DialogResult result;
try
SuppressDataSourceEvents();
using (FlickrDataSourceConfigForm form = new FlickrDataSourceConfigForm(m_dataSource))
IUIService uiService = (IUIService)GetService(typeof(IUIService));
result = uiService.ShowDialog(form);
if (result == DialogResult.OK)
OnSchemaRefreshed(EventArgs.Empty);
finally
ResumeDataSourceEvents();
return (result == DialogResult.OK);
[Designer(typeof(FlickrDataSourceDesigner))]
public class FlickrDataSource:DataSourceControl
internal class FlickrDesignerDataSourceView : DesignerDataSourceView
private FlickrDataSourceDesigner m_owner;
public FlickrDesignerDataSourceView(FlickrDataSourceDesigner owner, string viewName)
: base(owner, viewName)
m_owner = owner;
public override IDataSourceViewSchema Schema
return base.Schema;
public override System.Collections.IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData)
m_owner.DataSource.GetSetPhotos();
isSampleData = false;
return m_owner.DataSource.Photos;