由于各方面原因,可能后续帖子有点乱, 等手头事情告一段落在慢慢整理一下。好了,废话不多说,先贴一篇 框架的部分接口先。 unit YsPlatformIntf; interface uses ...; type IYsWorkBenchWindow = interface; /// <summary> /// 业务模块 /// </summary> IYsWorkModule = interface ['{2F1CE43D-696B-40A6-94A0-2E18A92D8557}'] function GetIsConnected: Boolean; procedure SetIsConnected(const Value: Boolean); procedure InitModule(aWorkBenchWindow: IYsWorkBenchWindow; aModule: TGcModulesRecord; admGc: TYsDatabase); procedure LoadModuleData; procedure Restore; procedure Refresh; function getModuleRecord: TGcModulesRecord; function getDataContext: TYsDatabase; function getWorkBenchWindow: IYsWorkBenchWindow; function getWorkModuleHandle: THandle; property IsConnected: Boolean read GetIsConnected write SetIsConnected; end; /// <summary> /// 业务模块加载器 /// </summary> IYsWorkModuleLoader = interface ['{FC040122-BE94-474E-9AC8-1DCBBA1024A0}'] function Load: Boolean; end; /// <summary> /// 服务 /// </summary> IYsWorkBenchService = interface ['{2989E80B-5513-413F-8C73-D45BA7C0E14B}'] end; /// <summary> /// 服务实现基类 /// </summary> TYsWorkBenchCustomService = class(TYsInterfacedObject, IYsWorkBenchService) private Ftoken: string; public constructor Create(aToken: string); reintroduce; overload; virtual; end; /// <summary> /// 服务实现基类Class /// </summary> TYsWorkBenchCustomServiceClass = class of TYsWorkBenchCustomService; /// <summary> /// 服务管理 /// </summary> IYsServicesManager = interface ['{D78B989D-D28D-4715-A085-C8EB445016A9}'] function RegisterService(token: string; ServiceClass: TYsWorkBenchCustomServiceClass): IYsWorkBenchService; function RegisterFormService(token: string; Service: TForm): IInterface; function GetService(token: string): IYsWorkBenchService; function GetFormService(token: string): IInterface; end; /// <summary> /// 工作窗口监听器 /// </summary> IYsWorkBenchWindowListener = interface ['{1BC967F0-4EFC-4620-8CD0-7B5144FFA440}'] end; /// <summary> /// 平台工作窗口 /// </summary> IYsWorkBenchWindow = interface ['{463A28A0-06F9-4343-811E-19503972D61D}'] procedure RegisterWorkBenchWindowListener(); function GetSideBarVisible: Boolean; procedure SetSideBarVisible(Value: Boolean); function GetAciveModuleID: Integer; procedure SetAciveModuleID(Value: Integer); function getDataContext: TcsSimpleDatabase; function getWorkBenchWindowService: IYsServicesManager; function getWorkBenchWindowItem: TYsWorkBenchWindowItem; function getWorkBenchWindowHandle: THandle; /// <summary> /// 定位指定aModuleToken的业务模块, 并激活该模块 /// aModuleToken: TGcModuleRecord.GetModuleTokenSTR /// </summary> function LocateWorkModule(aModuleToken: string): IYsWorkModule; function getActiveWorkModule: IYsWorkModule; property AciveModuleID: Integer read GetAciveModuleID write SetAciveModuleID; property SideBarVisible: Boolean read GetSideBarVisible write SetSideBarVisible; end; /// <summary> /// 平台工作窗口集合 /// </summary> IYsWorkBenchWindows = interface ['{BF67ECAA-0D56-46CC-9967-4D42F8BC2986}'] end; /// <summary> /// 工作平台监听器 /// </summary> IYsWorkBenchListener = interface ['{25C5349B-24A8-49AF-8A9F-0BFC17A61089}'] end; /// <summary> /// 工作平台接口 /// </summary> IYsWorkBench = interface ['{0ECC55FB-9E81-4EAB-B5DE-DFA18FD10B89}'] function getActiveWorkBenchWindow: IYsWorkBenchWindow; function getWorkBenchHandle: THandle; end; /// <summary> /// 工作平台监听器 /// </summary> IYsPlatformListener = interface ['{599919A9-BEB2-4777-88A1-5E31FF78F2BF}'] end; /// <summary> /// 平台接口 /// </summary> IYsPlatform = interface ['{9D7EF75A-03E5-4CB7-8AA1-7FF7BCC1BF64}'] function GetWorkBenchServices: IYsServicesManager; function getWorkBench: IYsWorkBench; function getActiveWorkBenchWindow: IYsWorkBenchWindow; procedure openingWorkBenchWindow(WorkBenchWindow: IYsWorkBenchWindow); procedure openedWorkBenchWindow(WorkBenchWindow: IYsWorkBenchWindow); procedure closingWorkBenchWindow(WorkBenchWindow: IYsWorkBenchWindow); procedure closedWorkBenchWindow(WorkBenchWindow: IYsWorkBenchWindow); end; IYsPlatformService = interface ['{BF9072AD-D8A7-4450-97DF-50E5ACC3A89B}'] end; var YsPlatform: IYsPlatform; implementation { TYsWorkBenchCustomService } constructor TYsWorkBenchCustomService.Create(aToken: string); begin Ftoken := aToken; end; end.