public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value ) { if ( provider != null ) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService( typeof( IWindowsFormsEditorService ) ); if ( edSvc != null ) { if ( _editorUI == null ) { _editorUI = new XSharpMLEPropertyForm(); } _editorUI.Text = context.PropertyDescriptor.DisplayName; // we can also use the Attributes property to pass in information via an attribute _editorUI.PropertyText.Text = (string) value; _editorUI.PropertyText.Select(); _editorUI.PropertyText.DeselectAll(); _editorUI.PropertyText.ClearUndo(); XSharpBuildMacros mc = new XSharpBuildMacros( (ProjectNode) ( (SettingsPage) context.Instance ).ProjectMgr ); _editorUI.SetMacros( mc ); DialogResult result = edSvc.ShowDialog( _editorUI ); if ( result == DialogResult.OK ) { value = _editorUI.PropertyText.Text; } } } return value; }
internal void SetMacros(XSharpBuildMacros mc) { MacrosList.BeginUpdate(); MacrosList.Items.Clear(); foreach (var p in mc) { ListViewItem i = new ListViewItem(); i.Text = String.Concat("$(", p.MacroName, ")"); i.SubItems.Add(p.Value); MacrosList.Items.Add(i); } MacrosList.Items[0].Selected = true; MacrosList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); MacrosList.EndUpdate(); }