1 | unit UFormSettings;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
---|
7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
|
---|
8 | FMX.Controls.Presentation, FMX.Layouts, FMX.Objects, FMX.DialogService;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TFormSettings = class(TForm)
|
---|
12 | ToolBar1: TToolBar;
|
---|
13 | SpeedButtonBack: TSpeedButton;
|
---|
14 | Label1: TLabel;
|
---|
15 | VertScrollBox1: TVertScrollBox;
|
---|
16 | RectangleUserName: TRectangle;
|
---|
17 | Label2: TLabel;
|
---|
18 | Label3: TLabel;
|
---|
19 | RectanglePassword: TRectangle;
|
---|
20 | Label4: TLabel;
|
---|
21 | Label5: TLabel;
|
---|
22 | RectangleServerUrl: TRectangle;
|
---|
23 | Label6: TLabel;
|
---|
24 | Label7: TLabel;
|
---|
25 | Rectangle1: TRectangle;
|
---|
26 | procedure SpeedButtonBackClick(Sender: TObject);
|
---|
27 | procedure RectangleServerUrlClick(Sender: TObject);
|
---|
28 | procedure RectanglePasswordClick(Sender: TObject);
|
---|
29 | procedure RectangleUserNameClick(Sender: TObject);
|
---|
30 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
31 | private
|
---|
32 | procedure ServerUrlQuery(const AResult: TModalResult; const AValues: array of string);
|
---|
33 | procedure PasswordQuery(const AResult: TModalResult; const AValues: array of string);
|
---|
34 | procedure UserNameQuery(const AResult: TModalResult; const AValues: array of string);
|
---|
35 | public
|
---|
36 | { Public declarations }
|
---|
37 | end;
|
---|
38 |
|
---|
39 | var
|
---|
40 | FormSettings: TFormSettings;
|
---|
41 |
|
---|
42 | implementation
|
---|
43 |
|
---|
44 | {$R *.fmx}
|
---|
45 |
|
---|
46 | uses
|
---|
47 | UFormMain;
|
---|
48 |
|
---|
49 | procedure TFormSettings.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
50 | begin
|
---|
51 | FormMain.SaveConfig;
|
---|
52 | FormMain.ReloadPending := True;
|
---|
53 | end;
|
---|
54 |
|
---|
55 | procedure TFormSettings.PasswordQuery(const AResult: TModalResult;
|
---|
56 | const AValues: array of string);
|
---|
57 | begin
|
---|
58 | if AResult = mrOk then
|
---|
59 | FormMain.OdorikApi.Password := AValues[0];
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure TFormSettings.RectanglePasswordClick(Sender: TObject);
|
---|
63 | begin
|
---|
64 | TDialogService.InputQuery('Password', ['Password'], [FormMain.OdorikApi.Password], PasswordQuery);
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TFormSettings.RectangleServerUrlClick(Sender: TObject);
|
---|
68 | begin
|
---|
69 | TDialogService.InputQuery('Server URL', ['Server URL'], [FormMain.OdorikApi.ServerUrl], ServerUrlQuery);
|
---|
70 | end;
|
---|
71 |
|
---|
72 | procedure TFormSettings.RectangleUserNameClick(Sender: TObject);
|
---|
73 | begin
|
---|
74 | TDialogService.InputQuery('User name', ['User name'], [FormMain.OdorikApi.UserName], UserNameQuery);
|
---|
75 | end;
|
---|
76 |
|
---|
77 | procedure TFormSettings.ServerUrlQuery(const AResult: TModalResult;
|
---|
78 | const AValues: array of string);
|
---|
79 | begin
|
---|
80 | if AResult = mrOk then
|
---|
81 | FormMain.OdorikApi.ServerUrl := AValues[0];
|
---|
82 | end;
|
---|
83 |
|
---|
84 | procedure TFormSettings.SpeedButtonBackClick(Sender: TObject);
|
---|
85 | begin
|
---|
86 | Close;
|
---|
87 | end;
|
---|
88 |
|
---|
89 | procedure TFormSettings.UserNameQuery(const AResult: TModalResult;
|
---|
90 | const AValues: array of string);
|
---|
91 | begin
|
---|
92 | if AResult = mrOk then
|
---|
93 | FormMain.OdorikApi.UserName := AValues[0];
|
---|
94 | end;
|
---|
95 |
|
---|
96 | end.
|
---|