Ignore:
Timestamp:
Jul 31, 2012, 8:53:58 AM (12 years ago)
Author:
chronos
Message:
  • Added: ModuleSystem package which helps manage available module instalation/uninstallation and their dependencies.
Location:
ModularSystem
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ModularSystem

    • Property svn:ignore set to
      lib
  • ModularSystem/Demo

    • Property svn:ignore
      •  

        old new  
        22project1.exe
        33project1
         4Demo.exe
         5Demo.lps
  • ModularSystem/Demo/UMainForm.pas

    r316 r394  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   StdCtrls, Menus, ActnList, UModularSystem, UModuleUser, UModuleBase;
     9  StdCtrls, Menus, ActnList, UModularSystem;
    1010
    1111type
     
    3737      Selected: Boolean);
    3838  private
    39     { private declarations }
     39    procedure RegisterModules;
    4040  public
    4141    ModuleManager: TModuleManager;
     
    4949  MainForm: TMainForm;
    5050
     51
    5152implementation
    5253
    5354{$R *.lfm}
     55
     56uses
     57  UModuleUser, UModuleBase, UModuleACL;
     58
    5459
    5560{ TMainForm }
     
    5964  if (Item.Index >= 0) and (Item.Index < ModuleManager.Modules.Count) then
    6065  with TModule(ModuleManager.Modules[Item.Index]) do begin
    61     Item.Caption := Name;
     66    Item.Caption := Title;
    6267    Item.Data := ModuleManager.Modules[Item.Index];
     68    Item.SubItems.Add(Name);
    6369    Item.SubItems.Add(Version);
    6470    Item.SubItems.Add(InstalledText[Installed]);
    65     Item.SubItems.Add(Dependencies.Text);
     71    Item.SubItems.Add(License);
     72    Item.SubItems.Add(StringReplace(Dependencies.Text, LineEnding, ', ', [rfReplaceAll]));
     73    Item.SubItems.Add(StringReplace(Description.Text, LineEnding, ', ', [rfReplaceAll]));
    6674  end;
    6775end;
     
    7886end;
    7987
     88procedure TMainForm.RegisterModules;
     89begin
     90  ModuleManager.RegisterModule(TModuleUser.Create);
     91  ModuleManager.RegisterModule(TModuleBase.Create);
     92  ModuleManager.RegisterModule(TModuleACL.Create);
     93end;
     94
    8095procedure TMainForm.RefreshList;
    8196begin
     
    87102
    88103procedure TMainForm.FormCreate(Sender: TObject);
    89 var
    90   UserModule: TModuleUser;
    91   BaseModule: TModuleBase;
    92104begin
    93   UserModule := TModuleUser.Create;
    94   BaseModule := TModuleBase.Create;
    95 
    96105  ModuleManager := TModuleManager.Create;
    97   ModuleManager.RegisterModule(UserModule);
    98   ModuleManager.RegisterModule(BaseModule);
     106  RegisterModules;
    99107end;
    100108
     
    109117      if ModuleList.Count > 0 then begin
    110118        if MessageDlg('These modules will be installed in addition to ' +
    111           TModule(ListViewModules.Selected.Data).Name + ': ' + ModuleList.Text,
     119          TModule(ListViewModules.Selected.Data).Name + ': ' +
     120          StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]),
    112121          mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    113122           TModule(ListViewModules.Selected.Data).Install;
     
    130139      if ModuleList.Count > 0 then begin
    131140        if MessageDlg('These modules will be uninstalled in addition to ' +
    132           TModule(ListViewModules.Selected.Data).Name + ': ' + ModuleList.Text,
     141          TModule(ListViewModules.Selected.Data).Name + ': ' +
     142          StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]),
    133143          mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    134144            TModule(ListViewModules.Selected.Data).Uninstall;
Note: See TracChangeset for help on using the changeset viewer.