| 1 | unit UNewRoom;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|---|
| 7 | Dialogs, StdCtrls, ComCtrls, ToolWin, ExtCtrls;
|
|---|
| 8 |
|
|---|
| 9 | type
|
|---|
| 10 | TNewRoom = class(TForm)
|
|---|
| 11 | Label1: TLabel;
|
|---|
| 12 | Button2: TButton;
|
|---|
| 13 | CheckBox1: TCheckBox;
|
|---|
| 14 | Button1: TButton;
|
|---|
| 15 | Edit1: TEdit;
|
|---|
| 16 | procedure Button2Click(Sender: TObject);
|
|---|
| 17 | procedure Button1Click(Sender: TObject);
|
|---|
| 18 | procedure FormShow(Sender: TObject);
|
|---|
| 19 | private
|
|---|
| 20 | { Private declarations }
|
|---|
| 21 | public
|
|---|
| 22 | { Public declarations }
|
|---|
| 23 | end;
|
|---|
| 24 |
|
|---|
| 25 | var
|
|---|
| 26 | NewRoom: TNewRoom;
|
|---|
| 27 |
|
|---|
| 28 | implementation
|
|---|
| 29 |
|
|---|
| 30 | uses ULocalization, UMainWindow, SunriseChatCoreUnit;
|
|---|
| 31 |
|
|---|
| 32 | {$R *.dfm}
|
|---|
| 33 |
|
|---|
| 34 | procedure TNewRoom.Button2Click(Sender: TObject);
|
|---|
| 35 | begin
|
|---|
| 36 | Close;
|
|---|
| 37 | end;
|
|---|
| 38 |
|
|---|
| 39 | procedure TNewRoom.Button1Click(Sender: TObject);
|
|---|
| 40 | begin
|
|---|
| 41 | if Edit1.Text <> '' then begin
|
|---|
| 42 | with MainWindow, SunriseChatNetworkCore1 do begin
|
|---|
| 43 | ActiveRoom := TRoom.Create(SunriseChatNetworkCore1);
|
|---|
| 44 | with ActiveRoom do begin
|
|---|
| 45 | Name := NewRoom.Edit1.Text;
|
|---|
| 46 | if NewRoom.CheckBox1.Checked then Typ := rtPrivate else Typ := rtPublic;
|
|---|
| 47 | end;
|
|---|
| 48 | RoomList.Add(ActiveRoom);
|
|---|
| 49 | // if not InputQuery('Vytvoření místnosti','Zadejte jméno místnosti:',RoomName) then Exit;
|
|---|
| 50 |
|
|---|
| 51 | if ActiveRoom.Typ = rtPrivate then
|
|---|
| 52 | SendCommand(scCreateRoom, '', LocalUser.Id.Machine, LocalUser.Id.User)
|
|---|
| 53 | else SendCommand(scCreateRoom);
|
|---|
| 54 | end;
|
|---|
| 55 | Close;
|
|---|
| 56 | end else ShowMessage('Zadajte jméno místnosti!');
|
|---|
| 57 | end;
|
|---|
| 58 |
|
|---|
| 59 | procedure TNewRoom.FormShow(Sender: TObject);
|
|---|
| 60 | begin
|
|---|
| 61 | with Localization do begin
|
|---|
| 62 | NewRoom.Caption:= Item('NewRoom');
|
|---|
| 63 | Label1.Caption:= Item('EnterRoomName');
|
|---|
| 64 | Button1.Caption:= Item('Ok');
|
|---|
| 65 | Button2.Caption:= Item('Cancel');
|
|---|
| 66 | CheckBox1.Caption:= Item('PrivateRoom');
|
|---|
| 67 | end;
|
|---|
| 68 | end;
|
|---|
| 69 |
|
|---|
| 70 | end.
|
|---|