WebColorConverter.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: WebColorConverter
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: ??%
  10. *
  11. * (C) Gaurav Vaish (2002)
  12. */
  13. using System;
  14. using System.Globalization;
  15. using System.ComponentModel;
  16. using System.Drawing;
  17. using System.Web;
  18. using System.Web.UI;
  19. namespace System.Web.UI.WebControls
  20. {
  21. public class WebColorConverter : ColorConverter
  22. {
  23. public WebColorConverter(): base()
  24. {
  25. }
  26. [MonoTODO("Implement_If_Color_Is_#xxxxxx_OR_A_KnownColor")]
  27. public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
  28. {
  29. if(value is string)
  30. {
  31. string val = ((string)value).Trim();
  32. if(val == String.Empty || val.Length == 0)
  33. {
  34. return Color.Empty;
  35. }
  36. if(val[0] == '#')
  37. {
  38. throw new NotImplementedException();
  39. }
  40. }
  41. return ConvertFrom(context, culture, value);
  42. }
  43. [MonoTODO("Convert_To_For_KnownColor_And_For_#xxxxxx")]
  44. public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
  45. {
  46. if(destinationType == null)
  47. {
  48. throw new ArgumentNullException("destinationType");
  49. }
  50. throw new NotImplementedException();
  51. }
  52. }
  53. }