source: cprs/branches/tmg-cprs/BDK32/SharedBrokerDebugger/uClientInfo.pas@ 1679

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

Initial upload of TMG-CPRS 1.0.26.69

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