예제 #1
0
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            object obj2 = o;

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (this.editorService != null)
            {
                Activity          component = null;
                IReferenceService service   = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                if (service != null)
                {
                    component = service.GetComponent(typeDescriptorContext.Instance) as Activity;
                }
                string           name      = null;
                RuleSetReference reference = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as RuleSetReference;
                if (reference != null)
                {
                    name = reference.RuleSetName;
                }
                RuleSetBrowserDialog dialog = new RuleSetBrowserDialog(component, name);
                if (DialogResult.OK == this.editorService.ShowDialog(dialog))
                {
                    obj2 = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentUICulture, dialog.SelectedName);
                }
            }
            return(obj2);
        }
 public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
 {
     if (typeDescriptorContext == null)
     {
         throw new ArgumentNullException("typeDescriptorContext");
     }
     if (serviceProvider == null)
     {
         throw new ArgumentNullException("serviceProvider");
     }
     object obj2 = o;
     this.editorService = (IWindowsFormsEditorService) serviceProvider.GetService(typeof(IWindowsFormsEditorService));
     if (this.editorService != null)
     {
         Activity component = null;
         IReferenceService service = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
         if (service != null)
         {
             component = service.GetComponent(typeDescriptorContext.Instance) as Activity;
         }
         string name = null;
         RuleSetReference reference = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as RuleSetReference;
         if (reference != null)
         {
             name = reference.RuleSetName;
         }
         RuleSetBrowserDialog dialog = new RuleSetBrowserDialog(component, name);
         if (DialogResult.OK == this.editorService.ShowDialog(dialog))
         {
             obj2 = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentUICulture, dialog.SelectedName);
         }
     }
     return obj2;
 }
예제 #3
0
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            object returnVal = o;

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                Activity baseActivity = null;

                IReferenceService rs = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                if (rs != null)
                {
                    baseActivity = rs.GetComponent(typeDescriptorContext.Instance) as Activity;
                }

                string           ruleSetName      = null;
                RuleSetReference ruleSetReference = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as RuleSetReference;
                if (ruleSetReference != null)
                {
                    ruleSetName = ruleSetReference.RuleSetName;
                }

                RuleSetBrowserDialog dlg = new RuleSetBrowserDialog(baseActivity, ruleSetName);

                if (DialogResult.OK == editorService.ShowDialog(dlg))
                {
                    returnVal = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentUICulture, dlg.SelectedName);
                }
            }

            return(returnVal);
        }
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
                throw new ArgumentNullException("typeDescriptorContext");
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");
            
            object returnVal = o;

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                Activity baseActivity = null;

                IReferenceService rs = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                if (rs != null)
                    baseActivity = rs.GetComponent(typeDescriptorContext.Instance) as Activity;

                string ruleSetName = null;
                RuleSetReference ruleSetReference = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as RuleSetReference;
                if (ruleSetReference != null)
                    ruleSetName = ruleSetReference.RuleSetName;

                RuleSetBrowserDialog dlg = new RuleSetBrowserDialog(baseActivity, ruleSetName);

                if (DialogResult.OK == editorService.ShowDialog(dlg))
                    returnVal = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentUICulture, dlg.SelectedName);
            }

            return returnVal;
        }