frmConfig.pas
上传用户:youjie821
上传日期:2013-01-27
资源大小:459k
文件大小:4k
- unit frmConfig;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ActnList, RzTabs, ExtCtrls, RzDlgBtn, StdCtrls, Mask, RzEdit,
- RzRadChk, RzPanel, RzButton, RzCmboBx, RzLabel;
- type
- TConfigForm = class(TForm)
- RzDialogButtons1: TRzDialogButtons;
- pcMain: TRzPageControl;
- RzTabSheet1: TRzTabSheet;
- RzTabSheet2: TRzTabSheet;
- ActionList1: TActionList;
- actOk: TAction;
- actCancel: TAction;
- actHelp: TAction;
- Label1: TLabel;
- RzGroupBox1: TRzGroupBox;
- chkServerInspect: TRzCheckBox;
- Label2: TLabel;
- edtServerUser: TRzEdit;
- Label3: TLabel;
- edtServerPass: TRzEdit;
- RzLabel1: TRzLabel;
- cbxConnectType: TRzComboBox;
- RzGroupBox2: TRzGroupBox;
- chkUseProxy: TRzCheckBox;
- edtProxyIP: TRzEdit;
- Label4: TLabel;
- edtProxyPort: TRzEdit;
- Label5: TLabel;
- edtProxyPass: TRzEdit;
- Label6: TLabel;
- Label7: TLabel;
- edtProxyUser: TRzEdit;
- edtServerIP: TRzEdit;
- edtServerPort: TRzEdit;
- Label8: TLabel;
- actUserProxy: TAction;
- procedure actOkExecute(Sender: TObject);
- procedure actCancelExecute(Sender: TObject);
- procedure actHelpExecute(Sender: TObject);
- procedure chkServerInspectClick(Sender: TObject);
- procedure cbxConnectTypeChange(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure actUserProxyUpdate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- procedure ShowConfigForm;
- implementation
- uses
- hxClientApp;
- {$R *.dfm}
- procedure ShowConfigForm;
- begin
- with TConfigForm.Create(nil) do
- try
- ShowModal;
- finally
- Free;
- end;
- end;
- procedure TConfigForm.actOkExecute(Sender: TObject);
- begin
- ModalResult:= mrOk;
- end;
- procedure TConfigForm.actCancelExecute(Sender: TObject);
- begin
- ModalResult:= mrCancel;
- end;
- procedure TConfigForm.actHelpExecute(Sender: TObject);
- begin
- MessageBox(0, '显示 LiveUpdate 的帮助信息', '提示', MB_ICONINFORMATION or MB_OK)
- end;
- procedure TConfigForm.chkServerInspectClick(Sender: TObject);
- begin
- edtServerUser.Enabled:= chkServerInspect.Checked;
- edtServerPass.Enabled:= chkServerInspect.Checked;
- end;
- procedure TConfigForm.cbxConnectTypeChange(Sender: TObject);
- begin
- chkUseProxy.Enabled:= cbxConnectType.ItemIndex = 1;
- end;
- procedure TConfigForm.FormCreate(Sender: TObject);
- begin
- with GetClientApp.Settings do
- begin
- if ConnectType = ctDirect then
- cbxConnectType.ItemIndex:= 0
- else
- cbxConnectType.ItemIndex:= 1;
- chkUseProxy.Checked:= UseProxy;
- edtProxyIP.Text:= ProxyIP;
- edtProxyPort.Text:= IntToStr(ProxyPort);
- edtProxyUser.Text:= ProxyUser;
- edtProxyPass.Text:= ProxyPass;
- edtProxyPort.Text:= IntToStr(ProxyPort);
- edtServerIP.Text:= ServerIP;
- edtServerPort.Text:= IntToStr(ServerPort);
- edtServerUser.Text:= ServerUser;
- edtServerPass.Text:= ServerPass;
- end;
- pcMain.ActivePageIndex:= 0;
- end;
- procedure TConfigForm.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- if ModalResult = mrOk then
- begin
- with GetClientApp.Settings do
- begin
- if cbxConnectType.ItemIndex = 0 then
- ConnectType:= ctDirect
- else
- ConnectType:= ctProxy;
- UseProxy:= chkUseProxy.Checked;
- ProxyIP:= edtProxyIP.Text;
- ProxyPort:= StrToInt(edtProxyPort.Text);
- ProxyUser:= edtProxyUser.Text;
- ProxyPass:= edtProxyPass.Text;
- ProxyPort:= StrToInt(edtProxyPort.Text);
- ServerIP:= edtServerIP.Text;
- ServerPort:= StrToInt(edtServerPort.Text);
- ServerUser:= edtServerUser.Text;
- ServerPass:= edtServerPass.Text;
- end;
- end;
- end;
- procedure TConfigForm.actUserProxyUpdate(Sender: TObject);
- begin
- chkUseProxy.Enabled:= cbxConnectType.ItemIndex = 1;
- edtProxyIP.Enabled:= chkUseProxy.Enabled and chkUseProxy.Checked;
- edtProxyPort.Enabled:= chkUseProxy.Enabled and chkUseProxy.Checked;
- edtProxyUser.Enabled:= chkUseProxy.Enabled and chkUseProxy.Checked;
- edtProxyPass.Enabled:= chkUseProxy.Enabled and chkUseProxy.Checked;
- end;
- end.