source: cprs/branches/tmg-cprs/BDK32/SharedBrokerDebugger/uBrokerConnectionInfo.pas@ 1536

Last change on this file since 1536 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.6 KB
RevLine 
[453]1unit uBrokerConnectionInfo;
2
3interface
4
5uses Windows, Classes, SysUtils, uRpcLogEntry, fClientRPCLogger, Forms;
6
7Type
8{
9 TRPCLogEntry = class
10 end;
11}
12 TClientRPCLogger = class
13 private
14 FText: String;
15 FVisible: Boolean;
16 public
17 procedure AddRpcLogEntry(entry: TRpcLogEntry; overrideCheckBox: Boolean);
18 property Text: String read FText write FText;
19 property Visible: Boolean read FVisible write FVisible;
20 end;
21
22 TBrokerConnectionInfo = class(TPersistent)
23 private
24 FRpcLogger: TfrmRPCClientLogger;
25 FConnectionIndex: Integer;
26 FConnectedServerIp: String;
27 FConnectedServerPort: Integer;
28 FLastContext: String;
29 protected
30 function GetVisible: Boolean;
31 procedure SetVisible(Value: Boolean);
32 public
33 Constructor Create(); overload; virtual;
34 Constructor Create(index: Integer; ip: String; port: Integer; lastContext: String); overload; virtual;
35 function MakeListItemString: String; virtual;
36 function ToString: String;
37 procedure AddRpcLogEntry(entry: TRpcLogEntry; overrideCheckBox: bool);
38 property ConnectionIndex: Integer read FConnectionIndex write FConnectionIndex;
39 property ConnectedServerIp: String read FConnectedServerIP write FConnectedServerIP;
40 property ConnectedServerPort: Integer read FConnectedServerPort write FConnectedServerPort;
41 property LastContext: String read FLastContext write FLastContext;
42 property Visible: Boolean read GetVisible write SetVisible;
43 end;
44
45
46const
47 kNoConnectionIndex = -1;
48 kNoServerIp: String = '0.0.0.0';
49 kNoConnectedServerPort: Integer = 0;
50 kNoLastContext: String = 'NO CONTEXT';
51
52implementation
53
54Constructor TBrokerConnectionInfo.Create;
55begin
56 ConnectionIndex := kNoConnectionIndex;
57 ConnectedServerIp := kNoServerIp;
58 ConnectedServerPort := kNoConnectedServerPort;
59 LastContext := kNoLastContext;
60end;
61
62{
63/// <summary>
64/// BrokerConnectionInfo is the parameterized constructor
65/// </summary>
66/// <param name="index"></param>
67/// <param name="ip"></param>
68/// <param name="port'></param>
69/// <param name='lastContext'></param>
70}
71Constructor TBrokerConnectionInfo.Create(index: Integer; ip: String; port: Integer; lastContext: String);
72begin
73 FConnectionIndex := index;
74 FConnectedServerIp := ip;
75 FConnectedServerPort := port;
76 FLastContext := lastContext;
77end;
78
79{
80 /// <summary>
81 /// MakeListItemString makes a string from its members intended
82 /// to be used for list items in a list box
83 /// </summary>
84 /// <param name='listItemString'></param>
85}
86function TBrokerConnectionInfo.MakeListItemString: String;
87begin
88 Result := ToString;
89end;
90
91{
92 /// <summary>
93 /// ToString returns a readable string format of the member data
94 /// </summary>
95 /// <returns></returns>
96}
97function TBrokerConnectionInfo.ToString: String;
98begin
99 Result := IntToStr(ConnectionIndex)+' server IP='+ConnectedServerIp+' server port='+IntToStr(ConnectedServerPort)+' last context='+LastContext;
100end;
101
102{
103 /// <summary>
104 /// AddRpcLogEntry adds a single log entry to the broker connection
105 /// visual log box
106 /// </summary>
107 /// <param name='entry'></param>
108 /// <param name='overrideCheckBox'></param>
109}
110
111procedure TBrokerConnectionInfo.AddRpcLogEntry(entry: TRpcLogEntry; overrideCheckBox: bool);
112begin
113 if(FRpcLogger <> nil) then
114 FRpcLogger.AddRpcLogEntry(entry,overrideCheckBox);
115end;
116
117procedure TBrokerConnectionInfo.SetVisible(Value: Boolean);
118begin
119 if (value) then
120 begin
121 if(FRpcLogger = nil) then
122 begin
123 FRpcLogger := TfrmRpcClientLogger.Create(Application);
124// ?? FRpcLogger.OnRpcLoggerClose += new EventHandler(OnRpcLoggerClosedEventHandler);
125 FRpcLogger.Caption := 'RPC Log for connection '+IntToStr(ConnectionIndex);
126 end;
127 FRpcLogger.Visible := true;
128 end
129 else
130 if(FRpcLogger <> nil) then
131 begin
132 FRpcLogger.Visible := false;
133 FRpcLogger := nil;
134 end;
135end;
136
137function TBrokerConnectionInfo.GetVisible: Boolean;
138begin
139 result := false;
140 if(FRpcLogger <> nil) then
141 result := FRpcLogger.Visible;
142end;
143
144{
145/// <summary>
146/// OnLogClosed is called when the ClientRpcLogger window is called
147/// Any event handlers by owners of this object should assign
148/// an event handler to this event
149/// </summary>
150}
151{ // TODO
152procedure EventHandler OnLogClosed;
153private void OnRpcLoggerClosedEventHandler(object sender, EventArgs e)
154begin
155 // Pass the message on to my owner
156 Visible := false;
157 OnLogClosed(Self,nil);
158end;
159}
160
161procedure TClientRPCLogger.AddRpcLogEntry(entry: TRPCLogEntry; overrideCheckBox: Boolean);
162begin
163// TODO
164end;
165
166end.
Note: See TracBrowser for help on using the repository browser.