mirror of
https://github.com/paleotronic/microm8-gui.git
synced 2024-06-25 10:29:37 +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
|
object GUIForm: TGUIForm
|
||||||
Left = 2260
|
Left = 2255
|
||||||
Height = 668
|
Height = 668
|
||||||
Top = 311
|
Top = 312
|
||||||
Width = 1014
|
Width = 1014
|
||||||
AlphaBlendValue = 128
|
AlphaBlendValue = 128
|
||||||
Caption = 'microM8 GUI'
|
Caption = 'microM8 GUI'
|
||||||
|
|
|
@ -469,6 +469,7 @@ type
|
||||||
procedure UpdateColorMode;
|
procedure UpdateColorMode;
|
||||||
procedure UpdateTintMode;
|
procedure UpdateTintMode;
|
||||||
function SimpleGet(url:String): string;
|
function SimpleGet(url:String): string;
|
||||||
|
function SimpleGetInt(url:String): integer;
|
||||||
procedure LaunchDisk(disk: string);
|
procedure LaunchDisk(disk: string);
|
||||||
procedure LaunchCommand(dialect: string; path: string; command: string);
|
procedure LaunchCommand(dialect: string; path: string; command: string);
|
||||||
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
||||||
|
@ -914,7 +915,7 @@ end;
|
||||||
|
|
||||||
procedure TGUIForm.miDisk2WPToggleClick(Sender: TObject);
|
procedure TGUIForm.miDisk2WPToggleClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
SimpleGet( baseUrl + '/api/control/hardware/disk/wp/1/toggle' );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGUIForm.miDiskMenuWPClick(Sender: TObject);
|
procedure TGUIForm.miDiskMenuWPClick(Sender: TObject);
|
||||||
|
@ -2046,6 +2047,10 @@ end;
|
||||||
function TGUIForm.SimpleGet(url:string): string;
|
function TGUIForm.SimpleGet(url:string): string;
|
||||||
begin
|
begin
|
||||||
result := '0';
|
result := '0';
|
||||||
|
|
||||||
|
if not MicroM8Process.Active then
|
||||||
|
exit;
|
||||||
|
|
||||||
try
|
try
|
||||||
result := self.httpc.Get(url)
|
result := self.httpc.Get(url)
|
||||||
except
|
except
|
||||||
|
@ -2055,6 +2060,22 @@ begin
|
||||||
end;
|
end;
|
||||||
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);
|
procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream);
|
||||||
begin
|
begin
|
||||||
try
|
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 UpdateColorMode;
|
||||||
procedure UpdateTintMode;
|
procedure UpdateTintMode;
|
||||||
function SimpleGet(url:String): string;
|
function SimpleGet(url:String): string;
|
||||||
|
function SimpleGetInt(url:String): integer;
|
||||||
procedure LaunchDisk(disk: string);
|
procedure LaunchDisk(disk: string);
|
||||||
procedure LaunchCommand(dialect: string; path: string; command: string);
|
procedure LaunchCommand(dialect: string; path: string; command: string);
|
||||||
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
procedure SimpleFormPost(url: String; body: string; var resp: TStringStream);
|
||||||
|
@ -2046,6 +2047,10 @@ end;
|
||||||
function TGUIForm.SimpleGet(url:string): string;
|
function TGUIForm.SimpleGet(url:string): string;
|
||||||
begin
|
begin
|
||||||
result := '0';
|
result := '0';
|
||||||
|
|
||||||
|
if not MicroM8Process.Active then
|
||||||
|
exit;
|
||||||
|
|
||||||
try
|
try
|
||||||
result := self.httpc.Get(url)
|
result := self.httpc.Get(url)
|
||||||
except
|
except
|
||||||
|
@ -2055,8 +2060,28 @@ begin
|
||||||
end;
|
end;
|
||||||
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);
|
procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
if not MicroM8Process.Active then
|
||||||
|
exit;
|
||||||
|
|
||||||
try
|
try
|
||||||
self.httpc.Get(url, S)
|
self.httpc.Get(url, S)
|
||||||
except
|
except
|
||||||
|
@ -2069,6 +2094,8 @@ end;
|
||||||
|
|
||||||
procedure TGUIForm.SimpleFormPost( url: string; body: string; var resp: TStringStream );
|
procedure TGUIForm.SimpleFormPost( url: string; body: string; var resp: TStringStream );
|
||||||
begin
|
begin
|
||||||
|
if not MicroM8Process.Active then
|
||||||
|
exit;
|
||||||
try
|
try
|
||||||
self.httpc.SimpleFormPost(url,body,resp)
|
self.httpc.SimpleFormPost(url,body,resp)
|
||||||
except
|
except
|
||||||
|
|
Loading…
Reference in New Issue
Block a user