private async Task ExecuteRemoteCommand(Func <ProxyClient, Task <bool> > remoteCommandAction) { try { if (!ValidateAppSettings()) { return; } await dialogsService.ShowLoading("Executing command...", async() => { var client = await lazyProxyClient.GetProxyClient(appSettings.RemoteAddress, appSettings.Port); var remoteCommandActionResult = await remoteCommandAction(client); if (remoteCommandActionResult) { UpdateConnectedStatus(true); } }); } catch (Exception exc) { UpdateConnectedStatus(false); await dialogsService.Error(exc.Message); } }