CommandCollector.cs
上传用户:husern
上传日期:2022-03-24
资源大小:534k
文件大小:2k
源码类别:

编辑器/阅读器

开发平台:

C#

  1. // -- FILE ------------------------------------------------------------------
  2. // name       : LookupCollector.cs
  3. // project    : Itenso Web User Forms
  4. // created    : Jani Giannoudis - 2008.10.30
  5. // language   : c#
  6. // environment: .NET 2.0
  7. // copyright  : (c) 2008 by Itenso GmbH, Switzerland
  8. // --------------------------------------------------------------------------
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Web.UI;
  12. namespace Itenso.WebUserForms.Controls
  13. {
  14. // ------------------------------------------------------------------------
  15. public class CommandCollector : UserFormVisitor
  16. {
  17. // ----------------------------------------------------------------------
  18. public CommandCollector( Control startControl )
  19. : base( startControl )
  20. {
  21. } // LookupCollector
  22. // ----------------------------------------------------------------------
  23. public List<IUserFormCommand> Commands
  24. {
  25. get { return this.commands; }
  26. } // Commands
  27. // ----------------------------------------------------------------------
  28. public void Collect()
  29. {
  30. this.commands.Clear();
  31. Start();
  32. } // Collect
  33. // ----------------------------------------------------------------------
  34. public static List<IUserFormCommand> Collect( Control startControl )
  35. {
  36. CommandCollector lookupFieldCollector = new CommandCollector( startControl );
  37. lookupFieldCollector.Collect();
  38. return lookupFieldCollector.Commands;
  39. } // Collect
  40. // ----------------------------------------------------------------------
  41. protected override void VisitFormCommand( Control control,
  42. IUserFormCommand formCommand, IUserFormHeader formHeader )
  43. {
  44. this.commands.Add( formCommand );
  45. } // VisitLookupFormField
  46. // ----------------------------------------------------------------------
  47. // members
  48. private readonly List<IUserFormCommand> commands = new List<IUserFormCommand>();
  49. } // class LookupCollector
  50. } // namespace Itenso.WebUserForms.Controls
  51. // -- EOF -------------------------------------------------------------------