unit Simulator.Base; interface uses Vcl.Controls, Vcl.Forms, Simulator.Registry; type TSimulatorBaseFrameClass = class of TSimulatorBaseFrame; TSimulatorBaseFrame = class(TFrame) private FFans: ISimulatorFans; public constructor Create(AFans: ISimulatorFans); reintroduce; virtual; procedure Initialize; virtual; procedure Start; virtual; procedure Stop; virtual; procedure SetUIParent(AParent: TWinControl); virtual; property Fans: ISimulatorFans read FFans; end; TSimulatorFrame = class(TInterfacedObject, ISimulator) private FSimulatorFrame: TSimulatorBaseFrame; protected property SimulatorFrame: TSimulatorBaseFrame read FSimulatorFrame; public constructor Create(AFans: ISimulatorFans); { ISimulator } procedure Start; procedure Stop; procedure SetUIParent(AParent: TWinControl); end; implementation {$R *.dfm} { TSimulatorBaseFrame } constructor TSimulatorBaseFrame.Create(AFans: ISimulatorFans); begin inherited Create(nil); FFans := AFans; Initialize; end; procedure TSimulatorBaseFrame.Initialize; begin end; procedure TSimulatorBaseFrame.Start; begin end; procedure TSimulatorBaseFrame.Stop; begin end; procedure TSimulatorBaseFrame.SetUIParent(AParent: TWinControl); begin Align := alClient; Parent := AParent; end; { TSimulatorFrame } constructor TSimulatorFrame.Create(AFans: ISimulatorFans); begin inherited Create; FSimulatorFrame := TSimulatorBaseFrameClass(T).Create(AFans); end; procedure TSimulatorFrame.Start; begin FSimulatorFrame.Start; end; procedure TSimulatorFrame.Stop; begin FSimulatorFrame.Stop; end; procedure TSimulatorFrame.SetUIParent(AParent: TWinControl); begin FSimulatorFrame.SetUIParent(AParent); end; end.