| 17 |
|
function GetConnectionCount: Integer; |
| 18 |
|
function GetConnection(ConnectionID: Integer): TDataAccess; |
| 19 |
|
function GetConnectionByIndex(Index: Integer): TDataAccess; |
| 20 |
+ |
function GetConnectionIndex(ConnectionID: Integer): Integer; |
| 21 |
|
procedure RemoveConnection(ArrayIndex: Integer); |
| 22 |
|
protected |
| 23 |
|
public |
| 24 |
|
property Count: Integer read GetConnectionCount; |
| 25 |
|
property Connection[ConnectionID: Integer]: TDataAccess read GetConnection; |
| 26 |
|
property ConnectionByIndex[Index: Integer]: TDataAccess read GetConnectionByIndex; |
| 27 |
+ |
property ConnectionIndexByID[ConnectionID: Integer]: Integer read GetConnectionIndex; |
| 28 |
|
property OnCoonnectionListChanged: TConnectionListChangedEvent read FConnectionListChanged write FConnectionListChanged; |
| 29 |
|
|
| 30 |
|
constructor Create; |
| 38 |
|
end; |
| 39 |
|
|
| 40 |
|
|
| 41 |
+ |
var |
| 42 |
+ |
ConManager: TConnectionManager; |
| 43 |
+ |
|
| 44 |
+ |
|
| 45 |
|
implementation |
| 46 |
|
uses |
| 47 |
|
SysUtils, Dialogs; |
| 56 |
|
Result := Length(FConnections); |
| 57 |
|
end; |
| 58 |
|
|
| 59 |
+ |
function TConnectionManager.GetConnectionIndex(ConnectionID: Integer): Integer; |
| 60 |
+ |
var |
| 61 |
+ |
i: Integer; |
| 62 |
+ |
begin |
| 63 |
+ |
Result := -1; |
| 64 |
+ |
if Count > 0 then |
| 65 |
+ |
for i := 0 to Count - 1 do |
| 66 |
+ |
if ConnectionByIndex[i].ConnectionID = ConnectionID then |
| 67 |
+ |
begin |
| 68 |
+ |
Result := i; |
| 69 |
+ |
Break; |
| 70 |
+ |
end; |
| 71 |
+ |
end; |
| 72 |
+ |
|
| 73 |
|
function TConnectionManager.GetConnection(ConnectionID: Integer): TDataAccess; |
| 74 |
|
var |
| 75 |
|
i: Integer; |
| 259 |
|
end; |
| 260 |
|
|
| 261 |
|
|
| 262 |
+ |
initialization |
| 263 |
+ |
ConManager := TConnectionManager.Create; |
| 264 |
+ |
finalization |
| 265 |
+ |
ConManager.Free; |
| 266 |
|
end. |