-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUForm.pas
More file actions
133 lines (119 loc) · 3.47 KB
/
UForm.pas
File metadata and controls
133 lines (119 loc) · 3.47 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
unit UForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, param;
type
TUpdateForm = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Image1: TImage;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
ProgressBar1: TProgressBar;
Timer1: TTimer;
Label7: TLabel;
Label8: TLabel;
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
UpdateForm: TUpdateForm;
Updates:integer;
MBNeed:integer;
implementation
uses Main;
{$R *.dfm}
procedure TUpdateForm.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TUpdateForm.FormActivate(Sender: TObject);
begin
MainForm.Timer1.Enabled:=false;
If AntivCount>45 then
Updates:=(AntivCount div 5)
else
Updates:=0;
MBNeed:=Updates div 3;
Label2.Caption:=MainForm.Label30.Caption;
Label4.Caption:=IntToStr(inetspeed)+' áèò/ñåê';
Label6.Caption:=IntToStr(Updates);
Label8.Caption:=IntToStr(MBNeed)+' Ìá';
ProgressBar1.Position := 0;
If Updates>0 then
Button1.Enabled:=true
else
Button1.Enabled:=false;
end;
procedure TUpdateForm.Button1Click(Sender: TObject);
begin
If InetTraffic>=MBNeed then begin
Timer1.Interval:=1025-(InetSpeed div 1000);
Button1.Enabled:=false;
Timer1.Enabled:=true;
end
else
Application.MessageBox('Íåâîçìîæíî çàêà÷àòü âñå îáíîâëåíèÿ äëÿ îïåðàöèîííîé ñèñòåìû ïîñêîëüêó íåäîñòàòî÷íî ïðåîïëà÷åííîãî òðàôèêà çà èíòåðíåò.','Ïîìîùü!',MB_ICONSTOP);
end;
procedure TUpdateForm.Timer1Timer(Sender: TObject);
begin
If ProgressBar1.Position<ProgressBar1.Max then
ProgressBar1.Position:=ProgressBar1.Position+InetSpeed
else
begin
ProgressBar1.Position:=0;
Updates:=Updates-1;
If Updates>2 then
InetTraffic:=InetTraffic-(MBneed div (Updates div 2));
Label6.Caption:=IntToStr(Updates);
If Updates<=0 then begin
Timer1.Enabled:=false;
Button1.Enabled:=false;
Application.MessageBox('Çàãðóçêà îáíîâëåíèé óñïåøíî çàâåðøåíà!','Ñèñòåìà çàãðóçêè îáíîâëåíèé',MB_ICONINFORMATION);
AntivCount:=0;
end;
end;
end;
procedure TUpdateForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
If Timer1.Enabled=true then begin
Timer1.Enabled:=false;
CanClose:=Application.MessageBox('Âíèìàíèå! Çàãðóçêà îáíîâëåíèé åùå íå çàâåðøåíà. Ðåêîìåíäóåòñÿ äîæäàòüñÿ çàãðóçêè âñåõ îáíîâëåíèé íà êîìïüþòåð.  ïðîòèâíîì ñëó÷àå ìû íå ìîæåì ãàðàíòèðîâàòü ïîëíóþ çàùèòó âàøåãî êîìïüþòåðà! Ïîäòâåðæäàåòå îïåðàöèþ âûõîäà?','Âíèìàíèå!',MB_ICONWARNING+MB_YESNO)=IDYES;
If not CanClose then
Timer1.Enabled:=true
else
MainForm.Timer1.Enabled:=true;
end
else
MainForm.Timer1.Enabled:=true;
end;
procedure TUpdateForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (key=VK_ESCAPE) then
Button2.OnClick(self);
end;
end.