public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context.Instance is MpeControl) { try { MpeControl mpc = (MpeControl)context.Instance; IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); MpeImageEditorForm selector = new MpeImageEditorForm((FileInfo)value, mpc.Parser, editorService); editorService.DropDownControl(selector); if (selector.SelectedImageName == null) { MpeLog.Info("Clearing Image..."); return(null); } MpeLog.Info("Changing texture to [" + selector.SelectedImageName + "]"); return(mpc.Parser.GetImageFile(selector.SelectedImageName)); } catch (Exception ee) { MpeLog.Debug(ee); MpeLog.Error(ee); } } return(base.EditValue(context, provider, value)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context.Instance is MpeControl) { try { MpeControl mpc = (MpeControl) context.Instance; IWindowsFormsEditorService editorService = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); MpeImageEditorForm selector = new MpeImageEditorForm((FileInfo) value, mpc.Parser, editorService); editorService.DropDownControl(selector); if (selector.SelectedImageName == null) { MpeLog.Info("Clearing Image..."); return null; } MpeLog.Info("Changing texture to [" + selector.SelectedImageName + "]"); return mpc.Parser.GetImageFile(selector.SelectedImageName); } catch (Exception ee) { MpeLog.Debug(ee); MpeLog.Error(ee); } } return base.EditValue(context, provider, value); }