Ignore:
Timestamp:
Nov 9, 2011, 4:11:56 PM (13 years ago)
Author:
george
Message:
  • Added: Partial client-server protocol layer implementation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UMainForm.pas

    r25 r27  
    1818    AConnect: TAction;
    1919    AAbout: TAction;
     20    ADisconnect: TAction;
    2021    AImportStructure: TAction;
    2122    AInitSystemValues: TAction;
     
    5556    MenuItem20: TMenuItem;
    5657    MenuItem21: TMenuItem;
     58    MenuItem22: TMenuItem;
    5759    MenuItem3: TMenuItem;
    5860    MenuItem4: TMenuItem;
     
    7173    procedure AAboutExecute(Sender: TObject);
    7274    procedure AConnectExecute(Sender: TObject);
     75    procedure ADisconnectExecute(Sender: TObject);
    7376    procedure AExitExecute(Sender: TObject);
    7477    procedure AImportStructureExecute(Sender: TObject);
     
    111114    TreeState: TTreeState;
    112115    Report: TReport;
     116    procedure UpdateInterface;
    113117    procedure LoadTree;
    114118    procedure LoadItemList;
     
    130134uses
    131135  UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo,
    132   UCore, UImportStructureForm, UAboutForm, ULoginProfileForm;
     136  UCore, UImportStructureForm, UAboutForm, ULoginProfileForm, UChronisClientDirect;
    133137
    134138{$R *.lfm}
     
    507511end;
    508512
     513procedure TMainForm.UpdateInterface;
     514begin
     515  ADisconnect.Enabled := Core.System.Database.Connected;
     516  AConnect.Enabled := not Core.System.Database.Connected;
     517  AInitSystemValues.Enabled := Core.System.Database.Connected;
     518  AImportStructure.Enabled := Core.System.Database.Connected;
     519end;
     520
    509521procedure TMainForm.FormCreate(Sender: TObject);
    510522begin
     
    639651      Core.System.Database.UserName := Core.LastUserName;
    640652      Core.System.Database.Password := Core.LastPassword;
     653      Core.System.Database.Port := Port;
     654      if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create;
     655    end;
     656    try
    641657      Core.System.Database.Connect;
    642     end;
    643     InitStructure;
    644     Core.System.LoadTypes;
    645     LoadTree;
    646   end;
     658      InitStructure;
     659      Core.System.LoadTypes;
     660      LoadTree;
     661    except
     662      on E:Exception do ShowMessage(E.Message);
     663    end;
     664  end;
     665end;
     666
     667procedure TMainForm.ADisconnectExecute(Sender: TObject);
     668begin
     669  Core.System.Database.Disconnect;
     670  TreeView1.Items.Clear;
     671  ListView1.Items.Clear;
     672  Core.System.Types.Clear;
     673  FreeAndNil(Core.Client);
    647674end;
    648675
Note: See TracChangeset for help on using the changeset viewer.