WebColorConverter.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Drawing;
  15. using System.Web;
  16. using System.Web.UI;
  17. namespace System.Web.UI.WebControls
  18. {
  19. public class WebColorConverter : ColorConverter
  20. {
  21. public WebColorConverter(): base()
  22. {
  23. }
  24. [MonoTODO("Implement_If_Color_Is_#xxxxxx_OR_A_KnownColor")]
  25. public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
  26. {
  27. if(value is string)
  28. {
  29. string val = ((string)value).Trim();
  30. if(val == String.Empty || val.Lenth == 0)
  31. {
  32. return Color.Empty;
  33. }
  34. if(val[0] == '#')
  35. {
  36. throw new NotImplementedException();
  37. }
  38. }
  39. return ConvertFrom(context, culture, value);
  40. }
  41. [MonoTODO("Convert_To_For_KnownColor_And_For_#xxxxxx")]
  42. public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
  43. {
  44. if(destinationType == null)
  45. {
  46. throw new ArgumentNullException("destinationType");
  47. }
  48. throw new NotImplementedException();
  49. }
  50. }
  51. }