unit Step1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Spin, WizTmpl, MathDef;

type
  TDirResult=(wBack,wForward,wCancel);
  
type
  TStepOneForm = class(TForm)
    ForwardButton: TButton;
    CancelButton: TButton;
    Panel: TPanel;
    ImgPanel: TPanel;
    Image: TImage;
    TextPanel: TPanel;
    Welcome: TLabel;
    Bevel1: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    GBType: TGroupBox;
    RBFromGen: TRadioButton;
    RBCustom: TRadioButton;
    RBOld: TRadioButton;
    procedure FormShow(Sender: TObject);
    procedure ForwardButtonClick(Sender: TObject);
    procedure CancelButtonClick(Sender: TObject);
    procedure FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  public
    Result : TDirResult;
  end;

var
  StepOneForm: TStepOneForm;

implementation

{$R *.DFM}

function MakeEnvironmentWelcome:string;
var
  Time : TSYSTEMTIME;
begin
  GetLocalTime(Time);
  // Проверяем, не праздник ли ?
  // 01.25 - 01.01 новый год
  // Нет, трудовые будни.
  if((Time.wHour>23)or(Time.wHour<6)) then
  begin
    Result:='Доброй ночи !';
    exit;
  end;
  if((Time.wHour>6)and(Time.wHour<10)) then
  begin
    Result:='Доброе утро !';
    exit;
  end;
  if(Time.wHour<17) then
  begin
    Result:='Добрый день !';
    exit;
  end;
  Result:='Добрый вечер !';
end;

procedure TStepOneForm.FormShow(Sender: TObject);
begin
  Welcome.Caption:=' '+MakeEnvironmentWelcome;
  Result:=wCancel;
end;

procedure TStepOneForm.ForwardButtonClick(Sender: TObject);
begin
  Result:=wForward;
  Close;
end;

procedure TStepOneForm.CancelButtonClick(Sender: TObject);
begin
  Result:=wCancel;
  Close;
end;

procedure TStepOneForm.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
  190: // '>'
    if(ssAlt in Shift) then
      ForwardButtonClick(Self);
  VK_ESCAPE:
    begin
      Result:=wCancel;
      Close;
    end;
  end;
end;

end.

