/// <summary> /// Method for sending the motivation values to the tracker /// </summary> internal void sendMotivationValuesToTracker() { //get the tracker if (tracker == null) { if (AssetManager.Instance.findAssetsByClass("TrackerAsset").Count >= 1) { tracker = (TrackerAsset)AssetManager.Instance.findAssetsByClass("TrackerAsset")[0]; loggingMAs("Found tracker for tracking motivation values!"); } else { //no tracking loggingMAs("No tracker implemented - motivational state is not send to the server"); return; } } if (tracker.CheckHealth()) { loggingMAs(tracker.Health); MotivationAssessmentAssetSettings maas = (MotivationAssessmentAssetSettings)getMAsA().Settings; if (tracker.Login(maas.TrackerName, maas.TrackerPassword)) { loggingMAs("logged in - tracker"); } else { loggingMAs("Maybe you forgot to store name/password for the tracker to the Motivation Assessment Asset Settings."); } } if (tracker.Connected) { tracker.Start(); Dictionary <string, double> ms = getMotivationState().getMotivation(); foreach (string motivationAspect in ms.Keys) { tracker.setVar(motivationAspect, ms[motivationAspect].ToString()); } tracker.Completable.Completed("MotivationAssessmentAsset"); #if !PORTABLE new Thread(() => { //next line: thread is killed after all foreground threads are dead Thread.CurrentThread.IsBackground = true; tracker.Flush(); }).Start(); #else tracker.Flush(); #endif } else { loggingMAs("Not connected to tracker."); } }