mirror of
https://github.com/paleotronic/microm8-gui.git
synced 2025-02-16 09:31:49 +00:00
dont make net request if process not active
This commit is contained in:
parent
2af364c09a
commit
c708f41130
@ -1,7 +1,7 @@
|
||||
object GUIForm: TGUIForm
|
||||
Left = 2260
|
||||
Left = 2255
|
||||
Height = 668
|
||||
Top = 311
|
||||
Top = 312
|
||||
Width = 1014
|
||||
AlphaBlendValue = 128
|
||||
Caption = 'microM8 GUI'
|
||||
|
@ -469,6 +469,7 @@ type
|
||||
procedure UpdateColorMode;
|
||||
procedure UpdateTintMode;
|
||||
function SimpleGet(url:String): string;
|
||||
function SimpleGetInt(url:String): integer;
|
||||
procedure LaunchDisk(disk: string);
|
||||
procedure LaunchCommand(dialect: string; path: string; command: string);
|
||||
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
||||
@ -914,7 +915,7 @@ end;
|
||||
|
||||
procedure TGUIForm.miDisk2WPToggleClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
SimpleGet( baseUrl + '/api/control/hardware/disk/wp/1/toggle' );
|
||||
end;
|
||||
|
||||
procedure TGUIForm.miDiskMenuWPClick(Sender: TObject);
|
||||
@ -2046,6 +2047,10 @@ end;
|
||||
function TGUIForm.SimpleGet(url:string): string;
|
||||
begin
|
||||
result := '0';
|
||||
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
|
||||
try
|
||||
result := self.httpc.Get(url)
|
||||
except
|
||||
@ -2055,6 +2060,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGUIForm.SimpleGetInt(url:string): integer;
|
||||
begin
|
||||
result := 0;
|
||||
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
|
||||
try
|
||||
result := StrToInt(self.httpc.Get(url))
|
||||
except
|
||||
on e: Exception do begin
|
||||
// nothing much
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream);
|
||||
begin
|
||||
try
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
main.pas
27
main.pas
@ -469,6 +469,7 @@ type
|
||||
procedure UpdateColorMode;
|
||||
procedure UpdateTintMode;
|
||||
function SimpleGet(url:String): string;
|
||||
function SimpleGetInt(url:String): integer;
|
||||
procedure LaunchDisk(disk: string);
|
||||
procedure LaunchCommand(dialect: string; path: string; command: string);
|
||||
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
||||
@ -2046,6 +2047,10 @@ end;
|
||||
function TGUIForm.SimpleGet(url:string): string;
|
||||
begin
|
||||
result := '0';
|
||||
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
|
||||
try
|
||||
result := self.httpc.Get(url)
|
||||
except
|
||||
@ -2055,8 +2060,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGUIForm.SimpleGetInt(url:string): integer;
|
||||
begin
|
||||
result := 0;
|
||||
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
|
||||
try
|
||||
result := StrToInt(self.httpc.Get(url))
|
||||
except
|
||||
on e: Exception do begin
|
||||
// nothing much
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream);
|
||||
begin
|
||||
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
|
||||
try
|
||||
self.httpc.Get(url, S)
|
||||
except
|
||||
@ -2069,6 +2094,8 @@ end;
|
||||
|
||||
procedure TGUIForm.SimpleFormPost( url: string; body: string; var resp: TStringStream );
|
||||
begin
|
||||
if not MicroM8Process.Active then
|
||||
exit;
|
||||
try
|
||||
self.httpc.SimpleFormPost(url,body,resp)
|
||||
except
|
||||
|
Loading…
x
Reference in New Issue
Block a user