Esempio n. 1
0
        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();

                    XBuildMacroCollection mc = new XBuildMacroCollection((ProjectNode)((SettingsPage)context.Instance).ProjectMgr);
                    _editorUI.SetMacros(mc);

                    DialogResult result = edSvc.ShowDialog(_editorUI);

                    if (result == DialogResult.OK)
                    {
                        value = _editorUI.PropertyText.Text;
                    }
                }
            }

            return(value);
        }
      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;
      }
        private void OKButton_Click(object sender, EventArgs e)
        {
            XSharpMLEPropertyForm form = (XSharpMLEPropertyForm)sender;

            form.Close();
        }