📄 datahf.pas
字号:
unit datahf;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, backup, StdCtrls, Gauges, Buttons, ExtCtrls;
type
Tsjhf = class(TForm)
Panel2: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Panel1: TPanel;
Label1: TLabel;
SpeedButton4: TSpeedButton;
Gauge1: TGauge;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
BackupFile1: TBackupFile;
OpenDialog1: TOpenDialog;
procedure BackupFile1NeedDisk(Sender: TObject; DiskID: Word;
var Continue: Boolean);
procedure BackupFile1Progress(Sender: TObject; Filename: String;
Percent: TPercentage; var Continue: Boolean);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
sjhf: Tsjhf;
implementation
uses mainfrm, datafrm;
{$R *.dfm}
procedure Tsjhf.BackupFile1NeedDisk(Sender: TObject; DiskID: Word;
var Continue: Boolean);
begin
Continue := MessageDlg('请插入下一张磁盘' +inttostr(DiskID)+'后并按下OK键以继续',mtInformation, mbOKCancel, 0) = mrOK;
end;
procedure Tsjhf.BackupFile1Progress(Sender: TObject; Filename: String;
Percent: TPercentage; var Continue: Boolean);
begin
sjhf.Label2.caption:= extractfilename(filename);
sjhf.Gauge1.Progress:= percent;
sjhf.Label3.caption:=inttostr(sjhf.BackupFile1.FilesProcessed)+'/'+inttostr(sjhf.BackupFile1.FilesTotal)+'已完成';
if sjhf.SpeedButton2.down then Continue := false;
end;
procedure Tsjhf.SpeedButton4Click(Sender: TObject);
begin
sjhf.OpenDialog1.InitialDir:=extractfilepath(application.ExeName)+'backup';
sjhf.OpenDialog1.Execute;
if fileexists(sjhf.OpenDialog1.FileName) then
sjhf.Edit1.Text:=sjhf.OpenDialog1.FileName
else
messagebox(sjhf.handle,'请选择正确的备份文件名。','营房工作管理系统',16);
end;
procedure Tsjhf.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure Tsjhf.SpeedButton1Click(Sender: TObject);
var
filename,path:string;
begin
if sjhf.Edit1.Text<>'' then
begin
if fileexists(sjhf.Edit1.Text) then
begin
filename:=sjhf.Edit1.Text;
path:=extractfilepath(application.ExeName)+'data\';
sjhf.SpeedButton1.Enabled:=false;
sjhf.SpeedButton2.Enabled:=false;
main.Timer1.Enabled:=false;
yfgldata.Free;
if sjhf.BackupFile1.Restore(filename,path) then
messagebox(sjhf.handle,pansichar('数据还原完毕,共有'+inttostr(sjhf.BackupFile1.FilesTotal)+'个文件,'+inttostr(sjhf.BackupFile1.SizeTotal)+'字节。'),'营房工作管理系统',mb_iconexclamation)
else
messagebox(sjhf.handle,'数据还原出错。','营房工作管理系统',16);
application.CreateForm(tyfgldata,yfgldata);
main.Timer1.Enabled:=true;
sjhf.Close;
end
else
begin
messagebox(sjhf.handle,'该文件不存在。','营房工作管理系统',16);
end;
end
else
messagebox(sjhf.handle,'请选择备份文件路径。','营房工作管理系统',16);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -