source: cprs/trunk/BDK32/SharedBrokerDebugger/fClientInfo.pas@ 829

Last change on this file since 829 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

File size: 4.3 KB
Line 
1unit fClientInfo;
2
3interface
4
5uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
6 uBrokerConnectionInfo;
7
8
9type
10 TForm2 = class(TForm)
11 private
12 { Private declarations }
13 public
14 { Public declarations }
15 end;
16
17{
18/// <summary>
19/// Summary description for ClientInfo.
20/// </summary>
21}
22 TClientInfo = class(TPersistent)
23 private
24 FUniqueId: Integer;
25 FName: String;
26 FBrokerConnectionIndex: Integer;
27 FRpcHistoryEnabled: Boolean;
28 FRpcLogger: TClientRpcLogger;
29 FVisible: Boolean;
30 protected
31 function GetVisible: Boolean;
32 procedure SetVisible(Value: Boolean);
33 procedure Initialize;
34 public
35 Constructor Create; overload; virtual;
36 Constructor Create(uniqueId: Integer; name: String; connectionIndex: Integer; historyEnabled: Boolean); overload; virtual;
37 procedure AddRpcLogEntry(entry: TRpcLogEntry; overrideCheckBox: Boolean);
38 function MakeCheckBoxString: String;
39 function ToString: String;
40 property Visible: Boolean read GetVisible write SetVisible;
41 property Name: String read FName write FName;
42 property RpcHistoryEnabled: Boolean read FRpcHistoryEnabled write FRPCHistoryEnabled;
43 property UniqueId: Integer read FUniqueId write FUniqueId;
44 property BrokerConnectionIndex: Integer read FBrokerConnectionIndex write FBrokerConnectionIndex;
45 end;
46
47const
48 kRpcHistoryEnabledDefault: Boolean = true;
49 kBrokerConnectionIndexDefault: Integer = -1;
50
51var
52 Form2: TForm2;
53
54implementation
55
56{$R *.DFM}
57
58Constructor TClientInfo.Create;
59begin
60 inherited;
61 Initialize;
62end;
63{
64 /// <summary>
65 /// ClientInfo parameterized constructor
66 /// </summary>
67 /// <param name="uniqueId"></param>
68 /// <param name="name"></param>
69 /// <param name="connectionIndex"></param>
70 /// <param name="historyEnabled"></param>
71}
72Constructor TClientInfo.Create(uniqueId: Integer; name: String; connectionIndex: Integer; historyEnabled: Boolean);
73begin
74 Create;
75
76 FUniqueId := uniqueId;
77 FName := name;
78 FBrokerConnectionIndex := connectionIndex;
79 FRpcHistoryEnabled := historyEnabled;
80end;
81
82procedure TClientInfo.AddRpcLogEntry(entry: TRpcLogEntry; overrideCheckBox: Boolean);
83begin
84 if(FRpcLogger <> nil) then
85 FRpcLogger.AddRpcLogEntry(entry,overrideCheckBox);
86end;
87
88procedure TClientInfo.SetVisible(Value: Boolean);
89begin
90 if(value) then
91 begin
92 if(FRpcLogger = nil) then
93 begin
94 FRpcLogger := TClientRpcLogger.Create;
95// TODO FRpcLogger.OnRpcLoggerClose += new EventHandler(OnRpcLoggerClosedEventHandler);
96 FRpcLogger.Text := 'RPC Log for '+Name+' ID='+IntToStr(UniqueId);
97 end;
98 FRpcLogger.Visible := true;
99 end
100 else
101 begin
102 if(FRpcLogger <> nil) then
103 begin
104 FRpcLogger.Visible := false;
105 FRpcLogger := nil;
106 end;
107 end;
108end;
109
110function TClientInfo.GetVisible: Boolean;
111begin
112 result := false;
113 if (FRpcLogger <> nil) then
114 result := FRpcLogger.Visible;
115end;
116{
117 /// <summary>
118 /// OnLogClosed is called when the ClientRpcLogger window is called
119 /// Any event handlers by owners of this object should assign
120 /// an event handler to this event
121 /// </summary>
122}
123// TODO
124// public EventHandler OnLogClosed;
125{
126 /// <summary>
127 /// MakeCheckBoxString creates a string based on the internal members
128 /// This string is intended to be used for check box list entries.
129 /// </summary>
130 /// <param name="checkBoxString"></param>
131}
132function TClientInfo.MakeCheckBoxString: String;
133begin
134 Result := ToString;
135end;
136
137{
138 /// <summary>
139 /// ToString returns a readable string representation of the member
140 /// </summary>
141 /// <returns></returns>
142}
143function TClientInfo.ToString: String;
144begin
145 result := FName+' connection='+IntToStr(FBrokerConnectionIndex)+' id='+IntToStr(FUniqueId);
146end;
147
148procedure TClientInfo.Initialize;
149begin
150 FBrokerConnectionIndex := kBrokerConnectionIndexDefault;
151 FRpcHistoryEnabled := kRpcHistoryEnabledDefault;
152 FRpcLogger := nil;
153end;
154
155// TODO
156{
157procedure TClientInfo.OnRpcLoggerClosedEventHandler(object sender, EventArgs e)
158begin
159 // Pass the message on to my owner
160 Visible := false;
161 OnLogClosed(Self,nil);
162end;
163}
164
165end.
166
Note: See TracBrowser for help on using the repository browser.