Changeset 105 for trunk/Packages/ModularSystem
- Timestamp:
- Oct 9, 2012, 1:58:45 PM (12 years ago)
- Location:
- trunk/Packages/ModularSystem
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/ModularSystem/Demo
-
Property svn:ignore
set to
lib
Demo.exe
-
Property svn:ignore
set to
-
trunk/Packages/ModularSystem/Demo/Demo.lpi
r89 r105 35 35 <Item1> 36 36 <PackageName Value="ModularSystem"/> 37 <DefaultFilename Value="..\ModularSystem.lpk" Prefer="True"/> 37 38 </Item1> 38 39 <Item2> -
trunk/Packages/ModularSystem/Demo/Demo.lps
r89 r105 2 2 <CONFIG> 3 3 <ProjectSession> 4 <PathDelim Value="\"/> 4 5 <Version Value="9"/> 5 6 <BuildModes Active="Default"/> 6 <Units Count=" 5">7 <Units Count="6"> 7 8 <Unit0> 8 9 <Filename Value="Demo.lpr"/> 9 10 <IsPartOfProject Value="True"/> 10 11 <UnitName Value="Demo"/> 11 <UsageCount Value="2 0"/>12 <UsageCount Value="22"/> 12 13 </Unit0> 13 14 <Unit1> … … 18 19 <ResourceBaseClass Value="Form"/> 19 20 <UnitName Value="UMainForm"/> 20 < IsVisibleTab Value="True"/>21 < EditorIndex Value="1"/>22 < WindowIndex Value="0"/>23 < TopLine Value="87"/>24 < CursorPos X="46" Y="105"/>25 < UsageCount Value="20"/>26 <Loaded Value="True"/>21 <EditorIndex Value="4"/> 22 <WindowIndex Value="0"/> 23 <TopLine Value="61"/> 24 <CursorPos X="37" Y="76"/> 25 <UsageCount Value="22"/> 26 <Loaded Value="True"/> 27 <LoadedDesigner Value="True"/> 27 28 </Unit1> 28 29 <Unit2> … … 30 31 <IsPartOfProject Value="True"/> 31 32 <UnitName Value="UModuleUser"/> 32 <UsageCount Value="20"/> 33 <EditorIndex Value="2"/> 34 <WindowIndex Value="0"/> 35 <TopLine Value="13"/> 36 <CursorPos X="17" Y="26"/> 37 <UsageCount Value="22"/> 38 <Loaded Value="True"/> 33 39 </Unit2> 34 40 <Unit3> … … 36 42 <IsPartOfProject Value="True"/> 37 43 <UnitName Value="UModuleBase"/> 38 <UsageCount Value="20"/> 44 <IsVisibleTab Value="True"/> 45 <EditorIndex Value="1"/> 46 <WindowIndex Value="0"/> 47 <TopLine Value="10"/> 48 <CursorPos X="40" Y="17"/> 49 <UsageCount Value="22"/> 50 <Loaded Value="True"/> 39 51 </Unit3> 40 52 <Unit4> … … 45 57 <WindowIndex Value="0"/> 46 58 <TopLine Value="1"/> 47 <CursorPos X=" 36" Y="4"/>48 <UsageCount Value="2 0"/>59 <CursorPos X="17" Y="14"/> 60 <UsageCount Value="22"/> 49 61 <Loaded Value="True"/> 50 62 </Unit4> 63 <Unit5> 64 <Filename Value="..\UModularSystem.pas"/> 65 <UnitName Value="UModularSystem"/> 66 <EditorIndex Value="3"/> 67 <WindowIndex Value="0"/> 68 <TopLine Value="117"/> 69 <CursorPos X="1" Y="133"/> 70 <UsageCount Value="11"/> 71 <Loaded Value="True"/> 72 </Unit5> 51 73 </Units> 52 74 <General> 53 75 <ActiveWindowIndexAtStart Value="0"/> 54 76 </General> 55 <JumpHistory Count=" 1" HistoryIndex="0">77 <JumpHistory Count="29" HistoryIndex="28"> 56 78 <Position1> 57 <Filename Value="UM ainForm.pas"/>58 <Caret Line="1 " Column="1" TopLine="1"/>79 <Filename Value="UModuleUser.pas"/> 80 <Caret Line="13" Column="51" TopLine="10"/> 59 81 </Position1> 82 <Position2> 83 <Filename Value="UModuleUser.pas"/> 84 <Caret Line="15" Column="23" TopLine="2"/> 85 </Position2> 86 <Position3> 87 <Filename Value="UModuleBase.pas"/> 88 <Caret Line="13" Column="31" TopLine="10"/> 89 </Position3> 90 <Position4> 91 <Filename Value="UModuleBase.pas"/> 92 <Caret Line="12" Column="43" TopLine="1"/> 93 </Position4> 94 <Position5> 95 <Filename Value="UModuleACL.pas"/> 96 <Caret Line="13" Column="29" TopLine="1"/> 97 </Position5> 98 <Position6> 99 <Filename Value="UModuleACL.pas"/> 100 <Caret Line="14" Column="43" TopLine="1"/> 101 </Position6> 102 <Position7> 103 <Filename Value="UMainForm.pas"/> 104 <Caret Line="14" Column="39" TopLine="1"/> 105 </Position7> 106 <Position8> 107 <Filename Value="UMainForm.pas"/> 108 <Caret Line="92" Column="54" TopLine="77"/> 109 </Position8> 110 <Position9> 111 <Filename Value="UMainForm.pas"/> 112 <Caret Line="71" Column="23" TopLine="54"/> 113 </Position9> 114 <Position10> 115 <Filename Value="UMainForm.pas"/> 116 <Caret Line="46" Column="7" TopLine="33"/> 117 </Position10> 118 <Position11> 119 <Filename Value="UMainForm.pas"/> 120 <Caret Line="71" Column="35" TopLine="57"/> 121 </Position11> 122 <Position12> 123 <Filename Value="UMainForm.pas"/> 124 <Caret Line="72" Column="35" TopLine="58"/> 125 </Position12> 126 <Position13> 127 <Filename Value="UMainForm.pas"/> 128 <Caret Line="74" Column="35" TopLine="60"/> 129 </Position13> 130 <Position14> 131 <Filename Value="UMainForm.pas"/> 132 <Caret Line="137" Column="3" TopLine="135"/> 133 </Position14> 134 <Position15> 135 <Filename Value="UMainForm.pas"/> 136 <Caret Line="138" Column="3" TopLine="136"/> 137 </Position15> 138 <Position16> 139 <Filename Value="UMainForm.pas"/> 140 <Caret Line="139" Column="3" TopLine="137"/> 141 </Position16> 142 <Position17> 143 <Filename Value="UMainForm.pas"/> 144 <Caret Line="140" Column="3" TopLine="138"/> 145 </Position17> 146 <Position18> 147 <Filename Value="UMainForm.pas"/> 148 <Caret Line="35" Column="15" TopLine="22"/> 149 </Position18> 150 <Position19> 151 <Filename Value="UMainForm.pas"/> 152 <Caret Line="40" Column="15" TopLine="25"/> 153 </Position19> 154 <Position20> 155 <Filename Value="UMainForm.pas"/> 156 <Caret Line="95" Column="77" TopLine="86"/> 157 </Position20> 158 <Position21> 159 <Filename Value="UMainForm.pas"/> 160 <Caret Line="98" Column="65" TopLine="76"/> 161 </Position21> 162 <Position22> 163 <Filename Value="..\UModularSystem.pas"/> 164 <Caret Line="183" Column="1" TopLine="164"/> 165 </Position22> 166 <Position23> 167 <Filename Value="..\UModularSystem.pas"/> 168 <Caret Line="237" Column="33" TopLine="220"/> 169 </Position23> 170 <Position24> 171 <Filename Value="..\UModularSystem.pas"/> 172 <Caret Line="183" Column="1" TopLine="170"/> 173 </Position24> 174 <Position25> 175 <Filename Value="..\UModularSystem.pas"/> 176 <Caret Line="233" Column="1" TopLine="220"/> 177 </Position25> 178 <Position26> 179 <Filename Value="..\UModularSystem.pas"/> 180 <Caret Line="130" Column="1" TopLine="117"/> 181 </Position26> 182 <Position27> 183 <Filename Value="..\UModularSystem.pas"/> 184 <Caret Line="131" Column="1" TopLine="117"/> 185 </Position27> 186 <Position28> 187 <Filename Value="..\UModularSystem.pas"/> 188 <Caret Line="132" Column="1" TopLine="117"/> 189 </Position28> 190 <Position29> 191 <Filename Value="..\UModularSystem.pas"/> 192 <Caret Line="133" Column="1" TopLine="117"/> 193 </Position29> 60 194 </JumpHistory> 61 195 </ProjectSession> 62 <EditorMacros Count="0"/> 196 <Debugging> 197 <BreakPoints Count="1"> 198 <Item1> 199 <Kind Value="bpkSource"/> 200 <WatchScope Value="wpsLocal"/> 201 <WatchKind Value="wpkWrite"/> 202 <Source Value="..\UModularSystem.pas"/> 203 <Line Value="233"/> 204 </Item1> 205 </BreakPoints> 206 </Debugging> 63 207 </CONFIG> -
trunk/Packages/ModularSystem/Demo/UMainForm.lfm
r89 r105 10 10 OnDestroy = FormDestroy 11 11 OnShow = FormShow 12 LCLVersion = '1. 1'12 LCLVersion = '1.0.1.3' 13 13 object ListViewModules: TListView 14 14 Left = 8 … … 30 30 end 31 31 item 32 Caption = 'State' 32 Caption = 'Installed' 33 Width = 80 34 end 35 item 36 Caption = 'Running' 33 37 Width = 80 34 38 end … … 80 84 TabOrder = 3 81 85 end 86 object ButtonUpdate1: TButton 87 Left = 248 88 Height = 25 89 Top = 281 90 Width = 75 91 Action = AModuleStart 92 Anchors = [akLeft, akBottom] 93 TabOrder = 4 94 end 95 object ButtonUpdate2: TButton 96 Left = 328 97 Height = 25 98 Top = 281 99 Width = 75 100 Action = AModuleStop 101 Anchors = [akLeft, akBottom] 102 TabOrder = 5 103 end 82 104 object PopupMenu1: TPopupMenu 83 105 left = 183 … … 92 114 Action = AModuleUpdate 93 115 end 116 object MenuItem4: TMenuItem 117 Action = AModuleStart 118 end 119 object MenuItem5: TMenuItem 120 Action = AModuleStop 121 end 94 122 end 95 123 object ActionList1: TActionList 96 left = 1 3797 top = 1 65124 left = 184 125 top = 136 98 126 object AModuleInstall: TAction 99 127 Caption = 'Install' … … 108 136 OnExecute = ButtonUpdateClick 109 137 end 138 object AModuleStart: TAction 139 Caption = 'Start' 140 OnExecute = AModuleStartExecute 141 end 142 object AModuleStop: TAction 143 Caption = 'Stop' 144 OnExecute = AModuleStopExecute 145 end 110 146 end 111 147 end -
trunk/Packages/ModularSystem/Demo/UMainForm.pas
r89 r105 15 15 TMainForm = class(TForm) 16 16 published 17 AModuleStart: TAction; 18 AModuleStop: TAction; 17 19 AModuleInstall: TAction; 18 20 AModuleUninstall: TAction; … … 22 24 ButtonUninstall: TButton; 23 25 ButtonInstall: TButton; 26 ButtonUpdate1: TButton; 27 ButtonUpdate2: TButton; 24 28 ListViewModules: TListView; 25 29 MenuItem1: TMenuItem; 26 30 MenuItem2: TMenuItem; 27 31 MenuItem3: TMenuItem; 32 MenuItem4: TMenuItem; 33 MenuItem5: TMenuItem; 28 34 PopupMenu1: TPopupMenu; 35 procedure AModuleStartExecute(Sender: TObject); 36 procedure AModuleStopExecute(Sender: TObject); 29 37 procedure ButtonInstallClick(Sender: TObject); 30 38 procedure ButtonUninstallClick(Sender: TObject); … … 44 52 45 53 const 46 InstalledText: array[Boolean] of string = ('Not installed', 'Installed');54 BoolText: array[Boolean] of string = ('No', 'Yes'); 47 55 48 56 var … … 66 74 Item.Caption := Title; 67 75 Item.Data := ModuleManager.Modules[Item.Index]; 68 Item.SubItems.Add( Name);76 Item.SubItems.Add(Identification); 69 77 Item.SubItems.Add(Version); 70 Item.SubItems.Add(InstalledText[Installed]); 78 Item.SubItems.Add(BoolText[Installed]); 79 Item.SubItems.Add(BoolText[Running]); 71 80 Item.SubItems.Add(License); 72 81 Item.SubItems.Add(StringReplace(Dependencies.Text, LineEnding, ', ', [rfReplaceAll])); … … 79 88 var 80 89 Installed: Boolean; 90 Running: Boolean; 81 91 begin 82 92 if Assigned(ListViewModules.Selected) then Installed := TModule(ListViewModules.Selected.Data).Installed; 93 if Assigned(ListViewModules.Selected) then Running := TModule(ListViewModules.Selected.Data).Running; 83 94 AModuleInstall.Enabled := Assigned(ListViewModules.Selected) and not Installed; 84 95 AModuleUninstall.Enabled := Assigned(ListViewModules.Selected) and Installed; 85 96 AModuleUpdate.Enabled := Assigned(ListViewModules.Selected) and Installed; 97 AModuleStart.Enabled := Assigned(ListViewModules.Selected) and not Running; 98 AModuleStop.Enabled := Assigned(ListViewModules.Selected) and Running; 86 99 end; 87 100 88 101 procedure TMainForm.RegisterModules; 89 102 begin 90 ModuleManager.RegisterModule(TModuleUser.Create );91 ModuleManager.RegisterModule(TModuleBase.Create );92 ModuleManager.RegisterModule(TModuleACL.Create );103 ModuleManager.RegisterModule(TModuleUser.Create(nil)); 104 ModuleManager.RegisterModule(TModuleBase.Create(nil)); 105 ModuleManager.RegisterModule(TModuleACL.Create(nil)); 93 106 end; 94 107 … … 129 142 end; 130 143 144 procedure TMainForm.AModuleStartExecute(Sender: TObject); 145 var 146 ModuleList: TStringList; 147 begin 148 if Assigned(ListViewModules.Selected) then begin 149 try 150 ModuleList := TStringList.Create; 151 TModule(ListViewModules.Selected.Data).EnumModulesStart(ModuleList); 152 if ModuleList.Count > 0 then begin 153 if MessageDlg('These modules will be started in addition to ' + 154 TModule(ListViewModules.Selected.Data).Name + ': ' + 155 StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]), 156 mtConfirmation, [mbYes, mbNo], 0) = mrYes then 157 TModule(ListViewModules.Selected.Data).Start; 158 end else TModule(ListViewModules.Selected.Data).Start; 159 finally 160 ModuleList.Free; 161 end; 162 RefreshList; 163 end; 164 end; 165 166 procedure TMainForm.AModuleStopExecute(Sender: TObject); 167 var 168 ModuleList: TStringList; 169 begin 170 if Assigned(ListViewModules.Selected) then begin 171 try 172 ModuleList := TStringList.Create; 173 TModule(ListViewModules.Selected.Data).EnumModulesStop(ModuleList); 174 if ModuleList.Count > 0 then begin 175 if MessageDlg('These modules will be stopped in addition to ' + 176 TModule(ListViewModules.Selected.Data).Name + ': ' + 177 StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]), 178 mtConfirmation, [mbYes, mbNo], 0) = mrYes then 179 TModule(ListViewModules.Selected.Data).Stop; 180 end else TModule(ListViewModules.Selected.Data).Stop; 181 finally 182 ModuleList.Free; 183 end; 184 185 RefreshList; 186 end; 187 end; 188 131 189 procedure TMainForm.ButtonUninstallClick(Sender: TObject); 132 190 var … … 155 213 begin 156 214 if Assigned(ListViewModules.Selected) then begin 157 TModule(ListViewModules.Selected.Data).Up date;215 TModule(ListViewModules.Selected.Data).Upgrade; 158 216 RefreshList; 159 217 end; … … 162 220 procedure TMainForm.FormDestroy(Sender: TObject); 163 221 begin 164 ModuleManager.Free;222 FreeAndNil(ModuleManager); 165 223 end; 166 224 -
trunk/Packages/ModularSystem/Demo/UModuleACL.pas
r89 r105 12 12 13 13 TModuleACL = class(TModule) 14 constructor Create ; override;14 constructor Create(AOwner: TComponent); override; 15 15 destructor Destroy; override; 16 16 end; … … 21 21 { TModuleACL } 22 22 23 constructor TModuleACL.Create ;23 constructor TModuleACL.Create(AOwner: TComponent); 24 24 begin 25 25 inherited; 26 Name:= 'UserACL';26 Identification := 'UserACL'; 27 27 Title := 'User ACL'; 28 28 Version := '1.0'; -
trunk/Packages/ModularSystem/Demo/UModuleBase.pas
r89 r105 10 10 type 11 11 TModuleBase = class(TModule) 12 constructor Create ; override;12 constructor Create(AOwner: TComponent); override; 13 13 destructor Destroy; override; 14 14 end; … … 19 19 { TModuleUser } 20 20 21 constructor TModuleBase.Create ;21 constructor TModuleBase.Create(AOwner: TComponent); 22 22 begin 23 23 inherited; 24 Name:= 'Base';24 Identification := 'Base'; 25 25 Title := 'Base'; 26 26 Version := '1.0'; -
trunk/Packages/ModularSystem/Demo/UModuleUser.pas
r89 r105 13 13 14 14 TModuleUser = class(TModule) 15 constructor Create ; override;15 constructor Create(AOwner: TComponent); override; 16 16 destructor Destroy; override; 17 17 end; … … 21 21 { TModuleUser } 22 22 23 constructor TModuleUser.Create ;23 constructor TModuleUser.Create(AOwner: TComponent); 24 24 begin 25 25 inherited; 26 Name:= 'User';26 Identification := 'User'; 27 27 Title := 'User'; 28 28 Version := '1.0'; -
trunk/Packages/ModularSystem/ModularSystem.lpk
r92 r105 20 20 <Description Value="Modular system"/> 21 21 <License Value="GNU/LGPLv3"/> 22 <Version Minor=" 2"/>22 <Version Minor="1"/> 23 23 <Files Count="1"> 24 24 <Item1> … … 28 28 </Item1> 29 29 </Files> 30 <i18n> 31 <EnableI18N Value="True"/> 32 <OutDir Value="Language"/> 33 <EnableI18NForLFM Value="True"/> 34 </i18n> 30 35 <Type Value="RunAndDesignTime"/> 31 <RequiredPkgs Count=" 1">36 <RequiredPkgs Count="2"> 32 37 <Item1> 38 <PackageName Value="Common"/> 39 </Item1> 40 <Item2> 33 41 <PackageName Value="FCL"/> 34 </Item 1>42 </Item2> 35 43 </RequiredPkgs> 36 44 <UsageOptions> -
trunk/Packages/ModularSystem/UModularSystem.pas
r94 r105 6 6 7 7 uses 8 Classes, SysUtils, Contnrs ;8 Classes, SysUtils, Contnrs, URegistry; 9 9 10 10 type … … 19 19 TModule = class(TComponent) 20 20 private 21 FEnabled: Boolean; 21 22 FRunning: Boolean; 22 23 FInstalled: Boolean; 23 Manager: TModuleManager;24 FManager: TModuleManager; 24 25 FVersion: string; 25 26 FIdentification: string; … … 29 30 FDependencies: TStringList; 30 31 FDescription: TStringList; 32 procedure SetEnabled(AValue: Boolean); 31 33 procedure SetInstalled(AValue: Boolean); 32 34 procedure SetRunning(AValue: Boolean); 35 protected 36 procedure BeforeStart; virtual; 37 procedure AfterStart; virtual; 38 procedure BeforeStop; virtual; 39 procedure AfterStop; virtual; 33 40 public 34 41 API: TAPI; 35 MarkForInstall: Boolean;36 42 procedure Start; virtual; 37 43 procedure Stop; virtual; … … 48 54 property Running: Boolean read FRunning write SetRunning; 49 55 property Installed: Boolean read FInstalled write SetInstalled; 56 property Enabled: Boolean read FEnabled write SetEnabled; 50 57 published 58 property Manager: TModuleManager read FManager; 51 59 property Version: string read FVersion write FVersion; 52 60 property Identification: string read FIdentification write FIdentification; … … 79 87 procedure EnumModulesInstall(Dependencies, ModuleList: TStringList); 80 88 procedure EnumModulesUninstall(ModuleName: string; ModuleList: TStringList); 81 procedure RegisterModule(Module: TModule; MarkForInstall: Boolean = False);89 procedure RegisterModule(Module: TModule; Enabled: Boolean = True); 82 90 procedure UnregisterModule(Module: TModule); 83 91 procedure StartInstalled; 84 procedure Install Marked;92 procedure InstallEnabled; 85 93 procedure StopAll; 86 94 procedure UninstallAll; 95 procedure LoadFromRegistry(Context: TRegistryContext); 96 procedure SaveToRegistry(Context: TRegistryContext); 87 97 constructor Create(AOwner: TComponent); override; 88 98 destructor Destroy; override; … … 143 153 for I := 0 to Dependencies.Count - 1 do begin 144 154 Module := FindModuleByName(Dependencies[I]); 145 if Assigned(Module) then begin155 if Assigned(Module) and Module.Enabled then begin 146 156 if not Module.Running then Module.Start; 147 157 end else raise Exception.CreateFmt(SModuleNotFound, [ModuleName, Dependencies[I]]); … … 199 209 for I := 0 to Dependencies.Count - 1 do begin 200 210 Module := FindModuleByName(Dependencies[I]); 201 if Assigned(Module) then begin211 if Assigned(Module) and Module.Enabled then begin 202 212 if not Module.Installed then Module.Install; 203 213 end else raise Exception.CreateFmt(SModuleNotFound, [ModuleName, Dependencies[I]]); … … 248 258 249 259 procedure TModuleManager.RegisterModule(Module: TModule; 250 MarkForInstall: Boolean = False);260 Enabled: Boolean = True); 251 261 begin 252 262 Modules.Add(Module); 253 Module. Manager := Self;263 Module.FManager := Self; 254 264 Module.API := API; 255 Module. MarkForInstall := MarkForInstall;265 Module.Enabled := Enabled; 256 266 end; 257 267 … … 270 280 end; 271 281 272 procedure TModuleManager.Install Marked;282 procedure TModuleManager.InstallEnabled; 273 283 var 274 284 I: Integer; … … 276 286 for I := 0 to Modules.Count - 1 do 277 287 with TModule(Modules[I]) do 278 if not Installed and MarkForInstallthen Install;288 if not Installed and Enabled then Install; 279 289 end; 280 290 … … 301 311 inherited; 302 312 Modules := TObjectList.Create; 313 //Modules.OwnsObjects := False; 303 314 end; 304 315 … … 307 318 StopAll; 308 319 FreeAndNil(Modules); 309 inherited Destroy; 320 inherited; 321 end; 322 323 procedure TModuleManager.LoadFromRegistry(Context: TRegistryContext); 324 var 325 I: Integer; 326 begin 327 with TRegistryEx.Create do 328 try 329 RootKey := Context.RootKey; 330 for I := 0 to Modules.Count - 1 do 331 with TModule(Modules[I]) do begin 332 OpenKey(Context.Key + '\' + Identification, True); 333 Running := ReadBoolWithDefault('Run', Enabled); 334 end; 335 finally 336 Free; 337 end; 338 end; 339 340 procedure TModuleManager.SaveToRegistry(Context: TRegistryContext); 341 var 342 I: Integer; 343 begin 344 with TRegistryEx.Create do 345 try 346 RootKey := Context.RootKey; 347 for I := 0 to Modules.Count - 1 do 348 with TModule(Modules[I]) do begin 349 OpenKey(Context.Key + '\' + Identification, True); 350 WriteBool('Run', Running); 351 end; 352 finally 353 Free; 354 end; 310 355 end; 311 356 … … 318 363 end; 319 364 365 procedure TModule.BeforeStart; 366 begin 367 if Running then Exit; 368 if not Installed then Install; 369 Manager.StartDependencies(Identification, Dependencies); 370 end; 371 372 procedure TModule.AfterStart; 373 begin 374 FRunning := True; 375 end; 376 377 procedure TModule.BeforeStop; 378 begin 379 if not Running then Exit; 380 FRunning := False; 381 Manager.StopDependencies(Identification); 382 end; 383 384 procedure TModule.AfterStop; 385 begin 386 end; 387 320 388 procedure TModule.SetInstalled(AValue: Boolean); 321 389 begin … … 324 392 end; 325 393 394 procedure TModule.SetEnabled(AValue: Boolean); 395 begin 396 if FEnabled = AValue then Exit; 397 FEnabled := AValue; 398 if not FEnabled and FInstalled then Uninstall; 399 end; 400 326 401 procedure TModule.Start; 327 402 begin 328 if Running then Exit;329 Manager.StartDependencies(Identification, Dependencies);330 FRunning := True;403 BeforeStart; 404 // Do something 405 AfterStart; 331 406 end; 332 407 333 408 procedure TModule.Stop; 334 409 begin 335 if not Running then Exit;336 Manager.StopDependencies(Identification);337 FRunning := False;410 BeforeStop; 411 // Do something 412 AfterStop; 338 413 end; 339 414 … … 403 478 begin 404 479 Running := False; 405 Description.Free;406 Dependencies.Free;407 inherited Destroy;480 FreeAndNil(FDescription); 481 FreeAndNil(FDependencies); 482 inherited; 408 483 end; 409 484
Note:
See TracChangeset
for help on using the changeset viewer.