/** * @return void **/ public void updateUser() { while (this.isMonitoring) { try { src.WebConnection.WebConnection useronlinerequest = new src.WebConnection.WebConnection("http://ontrackapp.org/ajax/updateUserOnlineStatus/" + User.username, "POST", "method=client app"); useronlinerequest.getResponse(); } catch (Exception e) { this.isConnected = false; Debug.WriteLine(e.Message); } Thread.Sleep(1000); } }
/** * @return void **/ public void updateMachine() { while (this.isMonitoring) { try { src.WebConnection.WebConnection deviceonlinerequest = new src.WebConnection.WebConnection("http://ontrackapp.org/ajax/updateDeviceOnlineStatus", "POST", "machine-name=" + machine.getMachineName() + "&username="******"&uptime=" + machine.getMachineUpTime()); if (deviceonlinerequest.getRequestStatusDescription() == "OK") { this.isConnected = true; } else { this.isConnected = false; } deviceonlinerequest.getResponse(); } catch (Exception) { this.isConnected = false; } Thread.Sleep(1000); } }
/** * @return void **/ public void run() { while (this.isMonitoring) { if (machine.isProcessRunning("Steam") || machine.isProcessRunning("Origin")) { this.timePlaying++; Debug.WriteLine("Playing - " + this.timePlaying); if ((this.timePlaying % 5) == 0) { src.WebConnection.WebConnection webrequest = new src.WebConnection.WebConnection("http://ontrackapp.org/update/playing", "POST", "username="******"&time="+this.timePlaying); Debug.WriteLine(webrequest.getResponse()); this.timePlaying = 0; } } else { } /** * @note check if process is running every 1000ms **/ Thread.Sleep(1000); } }