Ejemplo n.º 1
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (value as TGIBlockListIndexCTD != null && destinationType.Equals(typeof(string)))
     {
         try
         {
             TGIBlockListIndexCTD ctd = (TGIBlockListIndexCTD)value;
             string name = ctd.field.Split(' ').Length == 1 ? ctd.field : ctd.field.Split(new char[] { ' ' }, 2)[1].Trim();
             return("" + ctd.owner[name]);
         }
         //catch { }
         catch (Exception ex) { throw new NotSupportedException("Invalid data", ex); }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Ejemplo n.º 2
0
            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (ui == null)
                {
                    ui = new TGIBlockSelection();
                }

                TGIBlockListIndexCTD o = value as TGIBlockListIndexCTD;

                ui.SetField(o.owner, o.field, o.tgiBlocks);
                ui.EdSvc = edSvc;
                edSvc.DropDownControl(ui);
                // the ui (a) updates the value and (b) closes the dropdown

                return(o.owner[o.field].Value);
            }