Ignore:
Timestamp:
Nov 19, 2012, 2:40:44 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Optiomization using Update blocking during mass operations.
  • Added: Measuring modules start time.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ModularSystem/UFormModuleList.pas

    r431 r439  
    77uses
    88  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, ExtCtrls, Menus, ActnList, StdCtrls, SpecializedList,
     9  ComCtrls, ExtCtrls, Menus, ActnList, StdCtrls, SpecializedList, DateUtils,
    1010  UListViewSort, UModularSystem;
    1111
     
    1414    mloShowIdentification, mloShowLicense, mloShowEnable, mloShowRunning,
    1515    mloShowDependencies, mloShowInstalled, mloShowInfoBar, mloShowDescription,
    16     mloAllowInstall, mloAllowEnable, mloAllowRegister, mloAllowStart);
     16    mloShowStartUpTime, mloAllowInstall, mloAllowEnable, mloAllowRegister, mloAllowStart);
    1717  TModuleListOptions = set of TModuleListOption;
    1818
     
    9292  SYes = 'Yes';
    9393  SNo = 'No';
    94   SAdditionalModulesInstall = 'In addition to "%0:s" module also dependent modules will be installed: %1:s';
    95   SAdditionalModulesUninstall = 'In addition to "%0:s" module alse dependent modules will be uninstalled: %1:s';
    96   SAdditionalModulesStart = 'In addition to "%0:s" module also dependent modules will be started: %1:s';
    97   SAdditionalModulesStop = 'In addition to "%0:s" module also dependent modules will be stopped: %1:s';
     94  SAdditionalModulesInstall = 'In addition to "%0:s" module also dependent modules will be installed: "%1:s"';
     95  SAdditionalModulesUninstall = 'In addition to "%0:s" module alse dependent modules will be uninstalled: "%1:s"';
     96  SAdditionalModulesStart = 'In addition to "%0:s" module also dependent modules will be started: "%1:s"';
     97  SAdditionalModulesStop = 'In addition to "%0:s" module also dependent modules will be stopped: "%1:s"';
    9898  SIdentification = 'Identification';
    9999  SName = 'Name';
     
    133133    if FileName <> '' then Item.SubItems.Add(FileName)
    134134      else Item.SubItems.Add(' ');
     135    Item.SubItems.Add(FloatToStr(Trunc(StartUpTime / OneMillisecond)));
    135136  end;
    136137end;
     
    199200  try
    200201    Modules := TListModule.Create;
     202    Modules.OwnsObjects := False;
    201203    EnumDependenciesCascade(Modules, [mcNotRunning]);
    202204    if Modules.Count > 0 then begin
     
    223225  try
    224226    Modules := TListModule.Create;
    225     TModule(ListViewModules.Selected.Data).EnumSuperiorDependenciesCascade(Modules, [mcRunning]);
     227    Modules.OwnsObjects := False;
     228    EnumSuperiorDependenciesCascade(Modules, [mcRunning]);
    226229    if Modules.Count > 0 then begin
    227230      if MessageDlg(Format(SAdditionalModulesStop, [
    228       TModule(ListViewModules.Selected.Data).Identification,
     231      Identification,
    229232      Modules.Implode(',', ModuleToStr)]),
    230233      mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    231         TModule(ListViewModules.Selected.Data).Stop;
    232     end else TModule(ListViewModules.Selected.Data).Stop;
     234        Stop;
     235    end else Stop;
    233236  finally
    234237    FreeAndNil(Modules);
     
    248251  try
    249252    Modules := TListModule.Create;
    250     TModule(ListViewModules.Selected.Data).EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
     253    Modules.OwnsObjects := False;
     254    EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
    251255    if Modules.Count > 0 then begin
    252256      if MessageDlg(Format(SAdditionalModulesUninstall, [
    253       TModule(ListViewModules.Selected.Data).Identification,
     257      Identification,
    254258      Modules.Implode(',', ModuleToStr)]),
    255259      mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    256         TModule(ListViewModules.Selected.Data).Uninstall;
    257     end else TModule(ListViewModules.Selected.Data).Uninstall;
     260        Uninstall;
     261    end else Uninstall;
    258262  finally
    259263    Modules.Free;
     
    280284  try
    281285    Modules := TListModule.Create;
    282     TModule(ListViewModules.Selected.Data).EnumDependenciesCascade(Modules, [mcNotInstalled]);
     286    Modules.OwnsObjects := False;
     287    EnumDependenciesCascade(Modules, [mcNotInstalled]);
    283288    if Modules.Count > 0 then begin
    284289      if MessageDlg(Format(SAdditionalModulesInstall, [
    285       TModule(ListViewModules.Selected.Data).Identification,
     290      Identification,
    286291      Modules.Implode(',', ModuleToStr)]),
    287292      mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    288         TModule(ListViewModules.Selected.Data).Install;
    289     end else TModule(ListViewModules.Selected.Data).Install;
     293        Install;
     294    end else Install;
    290295  finally
    291296    Modules.Free;
     
    305310  try
    306311    Modules := TListModule.Create;
     312    Modules.OwnsObjects := False;
    307313    EnumDependenciesCascade(Modules, [mcNotRunning]);
    308314    if Modules.Count > 0 then begin
     
    310316      Identification, Modules.Implode(',', ModuleToStr)]),
    311317      mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    312         Enabled := True;
     318        Enable;
    313319        Start;
    314320      end;
    315321    end else begin
    316       Enabled := True;
     322      Enable;
    317323      Start;
    318324    end;
     
    334340  try
    335341    Modules := TListModule.Create;
    336     TModule(ListViewModules.Selected.Data).EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
     342    Modules.OwnsObjects := False;
     343    EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
    337344    if Modules.Count > 0 then begin
    338345      if MessageDlg(Format(SAdditionalModulesUninstall, [
    339       TModule(ListViewModules.Selected.Data).Identification,
     346      Identification,
    340347      Modules.Implode(',', ModuleToStr)]),
    341348      mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    342         TModule(ListViewModules.Selected.Data).Stop;
    343         TModule(ListViewModules.Selected.Data).Enabled := False;
     349        Stop;
     350        Disable;
    344351      end;
    345352    end else begin
    346353      TModule(ListViewModules.Selected.Data).Stop;
    347       TModule(ListViewModules.Selected.Data).Enabled := False;
     354      TModule(ListViewModules.Selected.Data).Disable;
    348355    end;
    349356  finally
     
    393400      7: Result := CompareString(TModule(Item1).Version, TModule(
    394401        Item2).Version);
    395       8: Result := CompareString(TModule(Item1).Dependencies.Implode(',', StrToStr), TModule(
    396         Item2).Dependencies.Implode(',', StrToStr));
     402      8: Result := CompareString(TModule(Item1).Dependencies.Implode(',', StrToStr),
     403        TModule(Item2).Dependencies.Implode(',', StrToStr));
     404      9: Result := CompareString(TModule(Item1).FileName,
     405        TModule(Item2).FileName);
     406      10: Result := CompareTime(TModule(Item1).StartUpTime,
     407        TModule(Item2).StartUpTime);
    397408    end;
    398409    if ListViewSort.Order = soDown then Result := -Result;
     
    483494  ListViewModules.Column[8].Visible := (mloShowDependencies in FOptions);
    484495  ListViewModules.Column[9].Visible := (mloShowFileName in FOptions);
     496  ListViewModules.Column[10].Visible := (mloShowStartUpTime in FOptions);
    485497  Memo1.Visible := (mloShowInfoBar in FOptions);
    486498  Splitter1.Visible := (mloShowInfoBar in FOptions);
Note: See TracChangeset for help on using the changeset viewer.