private bool DoEditValueWithCcustomDialog(IServiceProvider provider, string providerName, object value, out object newValue) { newValue = value; DataSource dataSource; DataProvider dataProvider; if (!GetKnownDataSourceAndProviderForProviderName(providerName, out dataSource, out dataProvider)) { return(false); } DataConnectionDialog dlg = new DataConnectionDialog(); dlg.DataSources.Add(dataSource); dlg.SelectedDataSource = dataSource; dlg.SelectedDataProvider = dataProvider; dlg.ConnectionString = value as string; System.Windows.Forms.Design.IUIService uisvc = (System.Windows.Forms.Design.IUIService)provider.GetService(typeof(System.Windows.Forms.Design.IUIService)); IWin32Window owner = uisvc != null?uisvc.GetDialogOwnerWindow() : null; if (DataConnectionDialog.Show(dlg, owner) == DialogResult.OK) { newValue = dlg.ConnectionString; } return(true); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { object obj; UIService = (System.Windows.Forms.Design.IUIService)provider.GetService(typeof(System.Windows.Forms.Design.IUIService)); try { System.Drawing.Design.UITypeEditor uitypeEditor = (System.Drawing.Design.UITypeEditor)System.ComponentModel.TypeDescriptor.GetEditor(typeof(System.Drawing.Image), typeof(System.Drawing.Design.UITypeEditor)); if (uitypeEditor.GetType().FullName.StartsWith("Microsoft.VisualStudio")) { return(EditValueResourcePicker(uitypeEditor, context, provider, value)); } return(EditValueOpenDialog(value)); } catch (System.Exception e) { UIService.ShowError(e); } return(value); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { object obj; UIService = (System.Windows.Forms.Design.IUIService)provider.GetService(typeof(System.Windows.Forms.Design.IUIService)); try { System.Drawing.Design.UITypeEditor uitypeEditor = (System.Drawing.Design.UITypeEditor)System.ComponentModel.TypeDescriptor.GetEditor(typeof(System.Drawing.Image), typeof(System.Drawing.Design.UITypeEditor)); if (uitypeEditor.GetType().FullName.StartsWith("Microsoft.VisualStudio")) { return EditValueResourcePicker(uitypeEditor, context, provider, value); } return EditValueOpenDialog(value); } catch (System.Exception e) { UIService.ShowError(e); } return value; }