source: trunk/UFormCalls.pas

Last change on this file was 4, checked in by chronos, 5 years ago
  • Modified: Moved call history loading to API class.
File size: 1.7 KB
Line 
1unit UFormCalls;
2
3interface
4
5uses
6 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
7 FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
8 FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
9 FMX.ListView, FMX.TabControl, FMX.StdCtrls, FMX.Controls.Presentation,
10 System.DateUtils, System.TimeSpan, System.JSON, Generics.Collections,
11 UOdorikApi, FMX.Layouts, FMX.ListBox;
12
13type
14 TFormCalls = class(TForm)
15 ToolBar1: TToolBar;
16 SpeedButtonBack: TSpeedButton;
17 Label1: TLabel;
18 TabControl1: TTabControl;
19 TabItemHistory: TTabItem;
20 TabItemActive: TTabItem;
21 TabItemStatistics: TTabItem;
22 ListBox1: TListBox;
23 procedure SpeedButtonBackClick(Sender: TObject);
24 procedure TabControl1Change(Sender: TObject);
25 procedure FormShow(Sender: TObject);
26 private
27 { Private declarations }
28 public
29 { Public declarations }
30 end;
31
32var
33 FormCalls: TFormCalls;
34
35
36implementation
37
38{$R *.fmx}
39
40uses
41 UFormMain;
42
43procedure TFormCalls.FormShow(Sender: TObject);
44begin
45 TabControl1Change(nil);
46end;
47
48procedure TFormCalls.SpeedButtonBackClick(Sender: TObject);
49begin
50 Close;
51end;
52
53procedure TFormCalls.TabControl1Change(Sender: TObject);
54var
55 IntervalFrom: TDateTime;
56 IntervalTo: TDateTime;
57 ListViewItem: TListViewItem;
58 Call: TCall;
59 CallHistory: TList<TCall>;
60begin
61 ListView1.Items.Clear;
62 IntervalTo := Now;
63 IntervalFrom := IntervalTo - OneHour * 24;
64 CallHistory := FormMain.OdorikApi.GetCallHistory(IntervalFrom, IntervalTo);
65 for Call in CallHistory do begin
66 ListViewItem := ListView1.Items.Add;
67 ListViewItem.Text := Call.SourceNumber;
68 end;
69end;
70
71end.
Note: See TracBrowser for help on using the repository browser.