unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ExtCtrls, StdCtrls, Buttons, ActnList;

type
  TFMain = class(TForm)
    Panel1: TPanel;
    sbStop: TSpeedButton;
    Label1: TLabel;
    Shape: TShape;
    sbRun: TSpeedButton;
    StatusBar1: TStatusBar;
    procedure sbStopClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure sbRunClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FMain: TFMain;

implementation

uses DataModule, FormOsoby;
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TFMain.FormShow(Sender: TObject);
begin
   if DM.SQLConnection.Connected  = True then begin
      Shape.Brush.Color := clGreen;
   end
   else begin
      Shape.Brush.Color := clRed;
   end;
end;

procedure TFMain.sbRunClick(Sender: TObject);
var
   ret : Boolean;

begin
   ret := Assigned(FOsoby);

   if not ret then begin
      FOsoby := TFOsoby.Create(Application);
      FOsoby.Show();
   end
   else begin
      FOsoby.Show();
   end;
end;

procedure TFMain.sbStopClick(Sender: TObject);
begin
	Close();
end;

end.
