void StartNode() { Trace.WriteLine("Node starting ..."); // Light client nodeProcess = StartProcess($"{nodeBinPath} -d {nodeBasePath} --chain={nodeChainSpecPath} --light --no-prometheus --no-telemetry"); // Full node - Should give the possibility to run either light or full node in the UI //nodeProcess = StartProcess($"{nodeBinPath} -d {nodeBasePath} --chain={nodeChainSpecPath} --no-prometheus --no-telemetry"); _ = Task.Factory.StartNew(async() => { using var input = new InputStreamReader(nodeProcess.ErrorStream); using var reader = new BufferedReader(input); bool ready = false; string line; while (!string.IsNullOrEmpty((line = reader.ReadLine()))) { if (!ready && line.Contains("idle", StringComparison.InvariantCultureIgnoreCase)) { Toast.ShowShortToast("Node is ready."); EventAggregator.GetEvent <NodeStatusEvent>().Publish(NodeStatus.NodeReady); ready = true; } logs.OnNext(line); } reader.Close(); await nodeProcess.WaitForAsync(); }, TaskCreationOptions.LongRunning); }
private async Task <bool> PingGoogleServer() { try { mIpAddrProcess = runtime.Exec("/system/bin/ping -c 1 8.8.8.8"); int mExitValue = await mIpAddrProcess.WaitForAsync(); if (mExitValue == 0) { Dismiss(); return(true); } else { progress.Visibility = ViewStates.Invisible; btnRetry.Enabled = true; btnRetry.SetText(retryText1); noNetHeader.SetText(headerText1); noNetSub.SetText(subTitle1); return(false); } } catch (InterruptedException) { } catch (IOException) { } return(false); }