-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathufraRetailPro.pas
108 lines (84 loc) · 2.7 KB
/
ufraRetailPro.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
unit ufraRetailPro;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, ActnList, StdActns,
//RDi units
uRDIConfigMgr, uRDIRPro8Settings, uRDISpringLogger;
type
TfraRetailPro = class(TFrame)
{$REGION 'Visual Components'}
grpRProPath: TGroupBox;
lblRProPath: TLabel;
lblRProPathInstructions: TLabel;
btnPRroPath: TSpeedButton;
edtRProPath: TEdit;
grpRProLicensing: TGroupBox;
lblWSNum: TLabel;
lblLicensingInstructions: TLabel;
edtWSNum: TEdit;
udWSNum: TUpDown;
ActionList: TActionList;
actBrowseRProPath: TBrowseForFolder;
Label1: TLabel;
{$ENDREGION}
procedure actBrowseRProPathAccept(Sender: TObject);
procedure actBrowseRProPathBeforeExecute(Sender: TObject);
procedure edtWSNumExit(Sender: TObject);
private
FConfigMgr: TRDIConfigManager;
FSettings: TRpro8Settings;
FLogger: TRDISpringLogger;
FSection: string;
procedure FillGUI;
public
procedure Load(const ASection: string);
procedure Save;
end;
implementation
uses
{$IFDEF UseCodeSite} CodeSiteLogging, {$ENDIF}
Spring.Container;
{$R *.dfm}
procedure TfraRetailPro.actBrowseRProPathAccept(Sender: TObject);
begin
edtRProPath.Text := actBrowseRProPath.Folder;
end;
procedure TfraRetailPro.actBrowseRProPathBeforeExecute(Sender: TObject);
begin
if Length(edtRProPath.Text) > 0 then
actBrowseRProPath.Folder := edtRProPath.Text;
end;
procedure TfraRetailPro.edtWSNumExit(Sender: TObject);
begin
If edtWSNum.Text = '0' then begin
ShowMessage('Workstation Number cannot be zero.');
edtWSNum.SetFocus;
end;
end;
procedure TfraRetailPro.FillGUI;
begin
edtRProPath.Text := FSettings.DBPath;
udWSNum.Position := FSettings.WSNum;
end;
procedure TfraRetailPro.Load(const ASection: string);
begin
{$IFDEF UseCodeSite}CodeSite.EnterMethod( Self, 'Load' );{$ENDIF}
FSection := ASection;
FConfigMgr := GlobalContainer.Resolve<TRDIConfigManager>;
FLogger := GlobalContainer.Resolve<TRDISpringLogger>;
if not Assigned(FSettings) then
FSettings := FConfigMgr.Items[FConfigMgr.GetIndexBySection(FSection)] as TRpro8Settings;
FillGUI;
{$IFDEF UseCodeSite} CodeSite.Send(Format('Loading Section "%s"', [FSection]), FSettings); {$ENDIF}
{$IFDEF UseCodeSite}CodeSite.ExitMethod( Self, 'Load' );{$ENDIF}
end;
procedure TfraRetailPro.Save;
begin
{$IFDEF UseCodeSite}CodeSite.EnterMethod( Self, 'Save' );{$ENDIF}
FSettings.DBPath := edtRProPath.Text;
FSettings.WSNum := udWSNum.Position;
{$IFDEF UseCodeSite} CodeSite.Send(Format('Saving Section "%s"', [FSection]), FSettings); {$ENDIF}
{$IFDEF UseCodeSite}CodeSite.ExitMethod( Self, 'Save' );{$ENDIF}
end;
end.