-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUMain.pas
58 lines (49 loc) · 1.39 KB
/
UMain.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit UMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.Edit, FMX.Controls.Presentation;
type
TFormMain = class(TForm)
lbl1: TLabel;
lbl2: TLabel;
edtVal1: TEdit;
edtVal2: TEdit;
lblResultat: TLabel;
jbhBtnAddition: TButton;
jbhBtnMultiplication: TButton;
procedure ExecuteCalcul(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
FormMain: TFormMain;
implementation
uses
UICalcul,
UTAddition,
// UTMultiplication
UTMultiplicationParAddition
;
{$R *.fmx}
/// <summary> - Exécute un calcul en fonction du bouton cliqué -
/// </summary>
/// <para> Chaque bouton définit le contexte utilisé pour le calcul.
/// </para>
/// <para> Chaque calcul est définit dans une classe implémentant l'interface ICalcul.
/// </para>
procedure TFormMain.ExecuteCalcul(Sender: TObject);
var
ResultatCalcul : ICalcul;
begin
if Sender.Equals(jbhBtnAddition) then
ResultatCalcul := TAddition.Create;
if Sender.Equals(jbhBtnMultiplication) then
// ResultatCalcul := TMultiplication.Create;
ResultatCalcul := TMultiplicationParAddition.Create;
lblResultat.Text := ResultatCalcul.Calcul(edtVal1.Text.ToInteger, edtVal2.Text.ToInteger).ToString;
end;
end.