public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { GraphicsControl graphicsContext; if (context.Instance is AbstractControl) { graphicsContext = ((AbstractControl)context.Instance).Context; } else { throw new Exception("Unable to find context from Type Editor"); } //Dialog.Show(); //Dialog.InitNewSearch(value is SingleTextureProperty ? ((SingleTextureProperty)value).Path : ""); TextureBrowserDialog dialog = new TextureBrowserDialog(); dialog.setupNewSearch(value is SingleTextureProperty ? ((SingleTextureProperty)value).Path : ""); //DialogResult dr=Dialog.ShowDialog(); if (dialog.ShowDialog() == DialogResult.OK) { return(new SingleTextureProperty(dialog.SelectedPath, dialog.SelectedTexture, graphicsContext)); } if (((SingleTextureProperty)value).Path == "") { return(null); } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { GraphicsControl graphicsContext; if (context.Instance is AbstractControl) graphicsContext = ((AbstractControl) context.Instance).Context; else throw new Exception("Unable to find context from Type Editor"); TextureBrowserDialog dialog = new TextureBrowserDialog(value is SingleTextureProperty ? ((SingleTextureProperty)value).Path : ""); if (dialog.ShowDialog() == DialogResult.OK) return new SingleTextureProperty(dialog.SelectedPath, dialog.SelectedTexture, graphicsContext); return value; }