Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms


************** Options Form4 ********



Download 59,89 Kb.
bet3/6
Sana04.04.2022
Hajmi59,89 Kb.
#528031
1   2   3   4   5   6
Bog'liq
dastur holati

************** Options Form4 ********
unit Options;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm4 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
CheckBox1: TCheckBox;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
begin
if (Form1.IdTCPServer1.Active)and
((Form1.IdTCPServer1.DefaultPort <> StrToInt(Edit1.Text)) or
(SPassword <> Edit2.Text)) then
begin
ShowMessage('Íåëüçÿ èçìåíèòü ïàðàìåòðû âî âðåìÿ ðàáîòû ñåðâåðà!');
Edit1.Text := IntToStr(Form1.IdTCPServer1.DefaultPort);
Edit2.Text := SPassword;
end
else
begin
Form1.SettingsSave;
Form4.Close;
end;
end;
procedure TForm4.CheckBox1Click(Sender: TObject);
begin
If CheckBox1.Checked then Edit2.PasswordChar := #0
else Edit2.PasswordChar := '*';
end;
procedure TForm4.Button2Click(Sender: TObject);
begin
Form4.Close;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
Form1.SettingsLoad;
end;
end.
****** Start Form2 ************
unit Start;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit3: TEdit;
Button2: TButton;
Button3: TButton;
OpenDialog1: TOpenDialog;
Label4: TLabel;
Edit4: TEdit;
Label5: TLabel;
Edit5: TEdit;
Label6: TLabel;
Edit6: TEdit;
CheckBox1: TCheckBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit5KeyPress(Sender: TObject; var Key: Char);
procedure CheckBox1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
i: integer;
implementation
uses Modul, Unit1, Info;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute;
Application.ProcessMessages;
Form2.Enabled := False;
if FileExists(OpenDialog1.FileName) then
begin
Edit1.Text := OpenDialog1.FileName;
PathOfTestFile := OpenDialog1.FileName;
CurDir := ExtractFilePath(OpenDialog1.FileName);
HtmlFolder := ExtractFileName(OpenDialog1.FileName);
if HtmlFolder[Length(HtmlFolder)-4] = '.' then
SetLength(HtmlFolder, Length(HtmlFolder)-4)
else SetLength(HtmlFolder, Length(HtmlFolder)-3);
HtmlFolder := HtmlFolder + 'files\';
GetQuestions;
AllQ := length(Questions);
SetLength(LOfQ, AllQ);
for i:=0 to AllQ-1 do LOfQ[i] := i;
CurQ := AllQ-1;
Randomize;
SetLength(OneTest, COfQ);
end;
Form2.Enabled := True;
end;
procedure TForm2.Button2Click(Sender: TObject);
var
str : string;
tmp: integer;
xx: integer;
Weight: array of real;
RightTmp, CountTmp: array of integer;
begin
If (CheckBox1.Checked)and(RadioButton1.Checked) then //èñïîëüçîâàíèå ñòàòèñòèêè
begin
{--------âû÷èñëåíèå âåñà êàæäîãî âîïðîñà òåñòà---------}
SetLength(RightTmp, AllQ);
SetLength(CountTmp, AllQ);
SetLength(Weight, AllQ);
AssignFile(Stats, CurDir + HtmlFolder + 'statistics.txt');
Reset(Stats);
while not(Eof(Stats)) do
begin
Read(Stats, tmp);
CountTmp[tmp-1] := CountTmp[tmp - 1] + 1;
Readln(Stats, xx);
RightTmp[tmp - 1] := RightTmp[tmp - 1] + xx;
end;
for i := 1 to AllQ do Weight[i-1] := 1 - RightTmp[i-1]/CountTmp[i-1];
CloseFile(Stats);
end;

if Edit2.Text = '' then Edit2.Text := '0';


if Edit4.Text = '' then Edit4.Text := '0';
if (Edit6.Text = '')or(Edit6.Text = '0') then Edit6.Text := '100';
if StrToInt(Edit2.Text) <= StrToInt(Edit5.Text) then
begin
if FileExists(OpenDialog1.FileName) then
Begin
{---- Ñòàòèñòèêà òåñòà----}
AssignFile(Stats, CurDir + HtmlFolder + 'statistics.txt');
if FileExists(CurDir + HtmlFolder + 'statistics.txt') then
Append(Stats) //îòêðûòèå ôàéëà ñòàòèñòèêè äëÿ äîçàïèñè
else ReWrite(Stats); //ñîçäàíèå åñëè îí íå ñóùåñòâóåò
{-------------------------}
TestName := Edit4.Text;
TImeOfTest := 60*StrToInt(Edit3.text);
MaxBall := StrToInt(Edit6.Text);
if Edit2.Text <> '0' Then COfQ := StrToInt(Edit2.text) else COfQ := AllQ;
Form1.IdTCPServer1.Active := True;
Form2.Close;
Form1.SetFocus;
with Form1 do
begin
BitBtn1.Enabled := False;
BitBtn2.Enabled := True;
BitBtn3.Enabled := True;
StatusBar1.Panels[2].Text := Form2.Edit4.Text;
StatusBar1.Panels[4].Text := DateTimeToStr(Now);
StatusBar1.Panels[8].Text := 'yuborilgan';
TheTime := 0;
Timer1.Enabled := True;
end;
with Form5.StringGrid1 do
begin
Cells[1,0] := Form2.Edit4.Text;
Cells[1,1] := OpenDialog1.FileName;
Cells[1,2] := IntToStr(AllQ);
Cells[1,3] := IntTOSTr(COfQ);
if Edit3.Text = '0' then Cells[1,5] := 'cheklanmagan' else Cells[1,5] := Edit3.Text;
Cells[1,4] := IntToStr(MaxBall);
Cells[1,6] := Form1.StatusBar1.Panels[4].Text;
Cells[1,7] := 'Ishlayapti';
Cells[1,8] := '0';
end;
End
Else
Begin
ShowMessage('Fayl "' + OpenDialog1.FileName + '" mavjud emas!');
Button1.SetFocus;
End;
end
else
begin
ShowMessage('Test topshiriqlari soni, umumiy test topshiriqlari sonidan ko`p bo`lishi mumkin emas');
Edit2.SetFocus;
end;
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
Form2.Close;
end;
procedure TForm2.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9', ',', #8]) then Key := #0;
end;
procedure TForm2.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9', ',', #8]) then Key := #0;
end;
procedure TForm2.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9', ',', #8]) then Key := #0;
end;
procedure TForm2.CheckBox1Click(Sender: TObject);
begin
If CheckBox1.Checked then
begin
RadioButton1.Enabled := True;
RadioButton2.Enabled := True;
end
else
begin
RadioButton1.Enabled := False;
RadioButton2.Enabled := False;
end;
end;
procedure TForm2.RadioButton2Click(Sender: TObject);
begin
If RadioButton2.Checked then
begin
end;
end;
end.

Download 59,89 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish