public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             GoogleMapsMarkerCollection mc = context.Instance as GoogleMapsMarkerCollection;
             if (mc != null)
             {
                 GoogleMapsMarker marker = value as GoogleMapsMarker;
                 if (marker != null)
                 {
                     service.CloseDropDown();
                     CommandSelectControl isc = new CommandSelectControl(service);
                     service.DropDownControl(isc);
                     if (isc.SelectedCommand != null)
                     {
                         if (isc.SelectedCommand.CommandId == EnumCommand.Delete)
                         {
                             mc.Remove(marker);
                         }
                         else if (isc.SelectedCommand.CommandId == EnumCommand.New)
                         {
                             mc.Add(new GoogleMapsMarker(mc.Owner));
                         }
                         value = marker;
                     }
                 }
             }
         }
     }
     return(value);
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             GoogleMapsMarkerCollection mc = context.Instance as GoogleMapsMarkerCollection;
             if (mc != null)
             {
                 mc.Add(new GoogleMapsMarker(mc.Owner));
                 value = null;
             }
             else
             {
                 HtmlGoogleMap map = context.Instance as HtmlGoogleMap;
                 if (map != null)
                 {
                     map.GoogleMapsMarkers.Add(new GoogleMapsMarker(map));
                 }
             }
         }
     }
     return(value);
 }
 public PropertyDescriptorNewMapMarker(GoogleMapsMarkerCollection owner)
     : base("New Marker", new Attribute[] {
     new EditorAttribute(typeof(TypeEditorNewMapMarker), typeof(UITypeEditor)),
     new RefreshPropertiesAttribute(RefreshProperties.All)
 })
 {
     _owner = owner;
 }
 private void buttonOK_Click(object sender, EventArgs e)
 {
     Result = new GoogleMapsMarkerCollection(_gmap);
     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         Result.Add(listBox1.Items[i] as GoogleMapsMarker);
     }
     this.DialogResult = DialogResult.OK;
 }