B
BillB
Hi,
I've got some Delphi code that I need to convert c#, the code is used in a
timer to delete an entry from a TListView in Delphi.
The Delphi code is below:
procedure TfrmALSECServer.tmrALSECTimer(Sender : TObject);
var
i : Integer;
Item : TListItem;
obj : TMyObj;
begin
try
for i := vListView.Items.Count - 1 downto 0 do
begin
Item := vListView.items;
obj := TMyObj(Item.data);
if (now - obj.rqTime) > {(1.0 / (24 * 60 * 3)) then//}(1.0 / 24) then
begin
//dispose of record after 1 hour
obj.Free;
vListView.items.Delete(i);
end
end;
//switch off timer if list empty.
if (vListView.Items.Count = 0) then
tmrTimer.Enabled := False;
Except
on e : exception do
begin
ShowMessage('tmrTimer: '+e.message);
end;
End;
end;
The Object and Record used are below:
TMyObj = class(TObject)
id : Integer;
rqTime: TDateTime;
info : TMyDetails;
end;
TMyDetails = record
cValidInfo : Boolean;
Line1 : Widestring;
Line2 : Widestring;
Line3 : Widestring;
....
....
....
Line22 : Widestring;
Line23 : Widestring;
Line24 : Widestring;
end;
If anyone knows how to convert this or of a program which will do it that
would be great.
Thanks
I've got some Delphi code that I need to convert c#, the code is used in a
timer to delete an entry from a TListView in Delphi.
The Delphi code is below:
procedure TfrmALSECServer.tmrALSECTimer(Sender : TObject);
var
i : Integer;
Item : TListItem;
obj : TMyObj;
begin
try
for i := vListView.Items.Count - 1 downto 0 do
begin
Item := vListView.items;
obj := TMyObj(Item.data);
if (now - obj.rqTime) > {(1.0 / (24 * 60 * 3)) then//}(1.0 / 24) then
begin
//dispose of record after 1 hour
obj.Free;
vListView.items.Delete(i);
end
end;
//switch off timer if list empty.
if (vListView.Items.Count = 0) then
tmrTimer.Enabled := False;
Except
on e : exception do
begin
ShowMessage('tmrTimer: '+e.message);
end;
End;
end;
The Object and Record used are below:
TMyObj = class(TObject)
id : Integer;
rqTime: TDateTime;
info : TMyDetails;
end;
TMyDetails = record
cValidInfo : Boolean;
Line1 : Widestring;
Line2 : Widestring;
Line3 : Widestring;
....
....
....
Line22 : Widestring;
Line23 : Widestring;
Line24 : Widestring;
end;
If anyone knows how to convert this or of a program which will do it that
would be great.
Thanks