www.pudn.com > AVideoCapture.rar > UserPowerUnt.pas
unit UserPowerUnt;
interface
uses
LiveSrvCastUnt, MainUnt, AVideoStatusUnt, AVideoFunctionUnt, CastOprUnt, SockUnt, Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, RainForm, RainButton;
type
TUserPower = class(TForm)
RainForm1: TRainForm;
UserLab: TLabel;
UserEdt: TEdit;
PsWordLab: TLabel;
PsWordEdt: TEdit;
YesBtn: TRainButton;
NoBtn: TRainButton;
procedure BtnClick(Sender: TObject);
procedure EdtKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
procedure MySerOpr_Query();
end;
procedure UserPowerTimerevent();
procedure MyLocSerOpr_Allow();
var
UserPower: TUserPower;
implementation
{$R *.dfm}
procedure MyLocSerOpr_Allow();
var
i: Integer;
begin
for i := 0 to 2 do
myStopCast(IntToStr(i));
if Desktop then begin //自动授权
Desktop := False; //操作权交服务器
Main.TrayIconPopupMenuSet.Enabled := False;
Main.TrayIcon.Hidemainform; //隐藏程序界面
sendcommand(SocketClient, Desktop_Quit, '');
end
else if autoclose = False then begin
Desktop := True;
autoclose := True;
Main.TrayIconPopupMenuSet.Enabled := True;
Main.TrayIcon.Showmainform; //显示程序界面
Main.DesktopTimer.Enabled := True;
end;
sendcommand(SocketClient, Back + desktopstatus, BackBoolToStr(Desktop));
end;
procedure TUserPower.MySerOpr_Query(); //弹出UserPower窗体
begin
if Desktop then begin //true->false 桌面->服务器
Caption := '服务器要求操作权';
UserLab.Caption := '是否结束桌面直播,以便赋权?';
PsWordLab.Caption := FloatToStr(Main.UserPowerTimer.Interval / 1000) + '秒钟后自动赋权...';
UserEdt.Visible := False;
PsWordEdt.Visible := False;
end
else begin //服务器->桌面
Caption := '请输入用户、密码,' + FloatToStr(Main.UserPowerTimer.Interval / 1000) + '秒钟后自动关闭...';
UserLab.Caption := '用 户';
PsWordLab.Caption := '密 码';
UserEdt.Visible := True;
PsWordEdt.Visible := True;
UserEdt.Text := '';
PsWordEdt.Text := '';
end;
autoclose := True;
Main.UserPowerTimer.Enabled := True;
Main.TrayIcon.MinimizeToTray := False;
ShowModal;
end;
procedure TUserPower.BtnClick(Sender: TObject);
begin
if TRainButton(Sender).tag = 2 then begin
if Desktop then {//本地->服务器}
UserPowerTimerevent
else begin //服务器
if UserEdt.Text = '' then begin
UserEdt.SetFocus;
Exit;
end;
if PsWordEdt.Text = '' then begin
PsWordEdt.SetFocus;
Exit;
end;
close;
autoclose := False;
sendcommand(SocketClient, locopr_query, UserEdt.Text + FieldEnd + PsWordEdt.Text + FieldEnd);
TrayIconHint(13);
end;
end;
Main.UserPowerTimer.Enabled := False;
Main.TrayIcon.MinimizeToTray := True;
close;
end;
procedure UserPowerTimerevent();
begin
MyLocSerOpr_Allow;
Main.UserPowerTimer.Enabled := False;
Main.TrayIcon.MinimizeToTray := True;
UserPower.close; //自动关闭
end;
procedure TUserPower.EdtKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case TEdit(Sender).tag of
1: if Key = 13 then
PsWordEdt.SetFocus;
2: if Key = 13 then
TRainButton(YesBtn).Click;
end;
end;
end.