Changeset 3 for trunk/UOptions.pas


Ignore:
Timestamp:
Feb 2, 2011, 2:14:37 PM (13 years ago)
Author:
chronos
Message:
  • Added: Not finished updating of sources from web.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11lib
        22FreePascalManager.exe
         3SourceList.xml
         4Config.xml
  • trunk/UOptions.pas

    r2 r3  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls;
     9  ComCtrls, DOM, XMLWrite, XMLRead, HTTPSend;
    1010
    1111type
     
    1414
    1515  TOptionsForm = class(TForm)
     16    ButtonUpdateSource: TButton;
    1617    ButtonCancel: TButton;
    1718    ButtonOk: TButton;
     
    2021    ListView1: TListView;
    2122    ListView2: TListView;
     23    procedure ButtonUpdateSourceClick(Sender: TObject);
    2224  private
    23     { private declarations }
     25    procedure ReloadList;
    2426  public
    2527    { public declarations }
     
    3335{$R *.lfm}
    3436
     37uses
     38  UMainForm;
     39
     40{ TOptionsForm }
     41
     42procedure TOptionsForm.ButtonUpdateSourceClick(Sender: TObject);
     43var
     44  fs: TFileStream;
     45begin
     46  fs := TFileStream.Create(ExtractFileName(SourceURL), fmOpenWrite or fmCreate);
     47  try
     48    HttpGetBinary(SourceURL, fs);
     49  finally
     50    fs.Free;
     51  end;
     52  MainForm.Sources.UpdateFormFile(ExtractFileName(SourceURL));
     53  ReloadList;
     54end;
     55
     56procedure TOptionsForm.ReloadList;
     57begin
     58  ListView1.Items.Count := MainForm.Sources.Count;
     59  ListView1.Refresh;
     60end;
     61
    3562end.
    3663
Note: See TracChangeset for help on using the changeset viewer.