unit MainForm;

interface

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

type
  TFMain = class(TForm)
    Panel1: TPanel;
    StatusBar1: TStatusBar;
    sbStop: TSpeedButton;
    ActionList1: TActionList;
    ActionClose: TAction;
    Label1: TLabel;
    Shape: TShape;
    sbRun: TSpeedButton;
    ActionRun: TAction;
    procedure ActionCloseExecute(Sender: TObject);
    procedure ActionRunExecute(Sender: TObject);
    procedure FormActivate(Sender: TObject);

  private

  public

  end;

var
  FMain: TFMain;

implementation

uses DataModule, FormOsoby;
{$R *.dfm}

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

procedure TFMain.FormActivate(Sender: TObject);
begin
   if DM.SQLConnection1.Connected  = True then begin
      Shape.Brush.Color := clGreen;
   end
   else begin
      Shape.Brush.Color := clRed;
   end;
end;

procedure TFMain.ActionRunExecute(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;

end.
