public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ExternalPolicy parent = (ExternalPolicy)context.Instance; string sSourceSiteURL = parent.SourceSiteURL; if (sSourceSiteURL != null) { frmEditor = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); ListBox lbDocLibs = new ListBox(); SPSite site = new SPSite(sSourceSiteURL); SPWeb web = site.OpenWeb(); foreach (SPDocumentLibrary dl in web.GetListsOfType(SPBaseType.DocumentLibrary)) { lbDocLibs.Items.Add(dl.Title); } lbDocLibs.SelectedValueChanged += new EventHandler(lbDocLibs_SelectedValueChanged); frmEditor.DropDownControl(lbDocLibs); return(lbDocLibs.SelectedItem); } else { MessageBox.Show(@"You must specify a Source Site URL first!"); return(null); } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ExternalPolicy parent = (ExternalPolicy)context.Instance; string sSourceSiteURL = parent.SourceSiteURL; string sDocLibName = parent.DocumentLibrary; if ( (sSourceSiteURL != null) && (sDocLibName != null) ) { frmEditor = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); ListBox lbRuleSets = new ListBox(); SPSite site = new SPSite(sSourceSiteURL); SPWeb web = site.OpenWeb(); SPDocumentLibrary dl = (SPDocumentLibrary)web.Lists[sDocLibName]; CompositeActivity workflow = Utility.GetRootWorkflow(parent.Parent); SPQuery qry = new SPQuery(); qry.Query = string.Format(@"<Where><Eq><FieldRef Name='WorkflowName' /><Value Type='Text'>{0}</Value></Eq></Where>", workflow.QualifiedName); SPListItemCollection lic = dl.GetItems(qry); if (lic.Count > 0) { foreach (SPListItem li in lic) { lbRuleSets.Items.Add(Path.GetFileNameWithoutExtension(li.File.Name)); } } lbRuleSets.SelectedValueChanged += new EventHandler(lbRuleSets_SelectedValueChanged); frmEditor.DropDownControl(lbRuleSets); return(lbRuleSets.SelectedItem); } else { MessageBox.Show(@"You must specify a Document Library first!"); return(null); } }