Beautify status bar
MODIFY
HiddenWallet/HiddenWallet.GUI/HiddenWallet.GUI.njsproj
HiddenWallet/HiddenWallet.GUI/HiddenWallet.GUI.njsproj
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
+ <Compile Include="app\js\cleanup.js" />
<Compile Include="app\js\decryption-phase.js" />
<Compile Include="app\js\status.js" />
<Compile Include="app\js\wallet-phase.js" />

ADD
HiddenWallet/HiddenWallet.GUI/app/js/cleanup.js
+// Object to capture process exits and call app specific cleanup function
+
+function noOp() { };
+
+exports.Cleanup = function Cleanup(callback) {
+
+ // attach user callback to the process event emitter
+ // if no callback, it will still exit gracefully on Ctrl-C
+ callback = callback || noOp;
+ process.on('cleanup', callback);
+
+ // do app specific cleaning before exiting
+ process.on('exit', function () {
+ process.emit('cleanup');
+ });
+
+ // catch ctrl+c event and exit normally
+ process.on('SIGINT', function () {
+ console.log('Ctrl-C...');
+ process.exit(2);
+ });
+
+ //catch uncaught exceptions, trace, then exit normally
+ process.on('uncaughtException', function (e) {
+ console.log('Uncaught Exception...');
+ console.log(e.stack);
+ process.exit(99);
+ });
+};
\ No newline at end of file

MODIFY
HiddenWallet/HiddenWallet.GUI/app/js/status.js
HiddenWallet/HiddenWallet.GUI/app/js/status.js
@@ -74,6 +74,9 @@ function periodicStatusUpdate() {
progressType = "success";
text = walletState + ", " + connectionText + ", Headers: " + headerHeight + ", Blocks left: " + blocksLeft + ", MemPool txs: " + memPoolTransactionCount;
}
+ if (connectedNodeCount === 0 && walletState.toUpperCase() !== "NotStarted".toUpperCase()) {
+ text = "Connecting. . .";
+ }
if (progress < 50) statusShow(50, text, progressType); //mincheck
else if (progress > 100) statusShow(100, text, progressType); //maxcheck

MODIFY
HiddenWallet/HiddenWallet.GUI/main.js
HiddenWallet/HiddenWallet.GUI/main.js
@@ -64,7 +64,9 @@ function startApi() {
var proc = require('child_process').spawn;
// run server
var apipath = path.join(__dirname, '..\\HiddenWallet.API\\bin\\dist\\win\\HiddenWallet.API.exe');
- apiProcess = proc(apipath);
+ apiProcess = proc(apipath, {
+ detached: true
+ });
apiProcess.stdout.on('data', (data) => {
writeLog(`stdout: ${data}`);
@@ -74,14 +76,16 @@ function startApi() {
});
}
-//Kill process when electron exits
-process.on('exit', function () {
- writeLog('exit');
+// loads module and registers app specific cleanup callback...
+var cleanup = require('./app/js/cleanup').Cleanup(myCleanup);
+// defines app specific callback...
+
var request = require('request');
- request('http://localhost:5000/api/v1/wallet/shutdown', function (error, response, body) {
- apiProcess.kill();
- });
-});
+function myCleanup() {
+ writeLog('exit');
+};
+// Prevents the program from closing instantly
+process.stdin.resume();
function writeLog(msg) {
console.log(msg);

Beautify status bar