Esempio n. 1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider == null)
            {
                return(value);
            }

            _context = context;

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc == null)
            {
                return(value);
            }

            if (_binaryUI == null)
            {
                // child modal dialog -launching in System Aware mode
                _binaryUI = DpiHelper.CreateInstanceInSystemAwareContext(() => new BinaryUI(this));
            }

            _binaryUI.Value = value;
            if (edSvc.ShowDialog(_binaryUI) == DialogResult.OK)
            {
                value = _binaryUI.Value;
            }
            _binaryUI.Value = null;

            return(value);
        }
Esempio n. 2
0
        /// <include file='doc\BinaryEditor.uex' path='docs/doc[@for="BinaryEditor.EditValue"]/*' />
        /// <devdoc>
        ///      Edits the given object value using the editor style provided by
        ///      GetEditorStyle.  A service provider is provided so that any
        ///      required editing services can be obtained.
        /// </devdoc>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                this.context = context;

                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    if (binaryUI == null)
                    {
                        binaryUI = new BinaryUI(this);
                    }

                    binaryUI.Value = value;

                    if (edSvc.ShowDialog(binaryUI) == DialogResult.OK)
                    {
                        value = binaryUI.Value;
                    }

                    binaryUI.Value = null;
                }
            }

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         this.context = context;
         IWindowsFormsEditorService service = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
         if (service == null)
         {
             return value;
         }
         if (this.binaryUI == null)
         {
             this.binaryUI = new BinaryUI(this);
         }
         this.binaryUI.Value = value;
         if (service.ShowDialog(this.binaryUI) == DialogResult.OK)
         {
             value = this.binaryUI.Value;
         }
         this.binaryUI.Value = null;
     }
     return value;
 }