ufrmSingleton.pas 782 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. unit ufrmSingleton;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics,
  5. Controls, Forms, Dialogs, StdCtrls, mybean.core.intf,
  6. uIFormShow;
  7. type
  8. TfrmSingleton = class(TForm, IFreeObject, IShowAsNormal)
  9. Memo1: TMemo;
  10. private
  11. { Private declarations }
  12. public
  13. { Public declarations }
  14. procedure FreeObject; stdcall;
  15. procedure showAsNormal; stdcall;
  16. end;
  17. var
  18. frmSingleton: TfrmSingleton;
  19. implementation
  20. uses
  21. mybean.core.beanFactory;
  22. {$R *.dfm}
  23. { TfrmSingleton }
  24. procedure TfrmSingleton.FreeObject;
  25. begin
  26. self.Free;
  27. end;
  28. procedure TfrmSingleton.showAsNormal;
  29. begin
  30. Show();
  31. end;
  32. initialization
  33. beanFactory.RegisterBean('singletonDEMO', TfrmSingleton);
  34. beanFactory.configBeanSingleton('singletonDEMO', true);
  35. end.