ReferenceConverter.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // System.ComponentModel.ReferenceConverter.cs
  3. //
  4. // Authors:
  5. // Martin Willemoes Hansen ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) 2003 Martin Willemoes Hansen
  9. // (C) 2003 Andreas Nahr
  10. //
  11. using System.Globalization;
  12. namespace System.ComponentModel
  13. {
  14. public class ReferenceConverter : TypeConverter
  15. {
  16. public ReferenceConverter (Type type)
  17. {
  18. }
  19. public override bool CanConvertFrom (ITypeDescriptorContext context,
  20. Type sourceType)
  21. {
  22. if (sourceType == typeof (string))
  23. return true;
  24. return base.CanConvertFrom (context, sourceType);
  25. }
  26. [MonoTODO]
  27. public override object ConvertFrom (ITypeDescriptorContext context,
  28. CultureInfo culture,
  29. object value)
  30. {
  31. // Add implementation
  32. return base.ConvertFrom(context, culture, value);
  33. }
  34. [MonoTODO]
  35. public override object ConvertTo (ITypeDescriptorContext context,
  36. CultureInfo culture,
  37. object value,
  38. Type destinationType)
  39. {
  40. // Add implementation
  41. return base.ConvertTo(context, culture, value, destinationType);
  42. }
  43. [MonoTODO]
  44. public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
  45. {
  46. throw new NotImplementedException();
  47. }
  48. public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
  49. {
  50. return true;
  51. }
  52. public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
  53. {
  54. return true;
  55. }
  56. protected virtual bool IsValueAllowed (ITypeDescriptorContext context, object value)
  57. {
  58. return true;
  59. }
  60. }
  61. }