private void Stop() { // if LogList is populated and we have a connection if (LogList.Count > 0 && DataAnalytics.GetConnectedState()) { // For each element in LogList, send a request to DataAnalytics for Log Sending foreach (string temp in LogList) { DataAnalytics.AddLog(temp); } } // Else if LogList is populated and we do not have a connection else if (LogList.Count > 0 && DataAnalyticsStructure.GetConnectedState()) { // For each element in LogList, send a request to LogLoader for Local Saving foreach (string temp in LogList) { LogLoader.WriteLogLocal(filePath, temp); } // Clear LogList LogList.Clear(); } }
// In the event where connection is false, we save the log onto the list and send it back. public static List <string> SendLog(List <string> LogList, string log) { if (DataAnalytics.GetConnectedState()) { DataAnalytics.AddLog(log); } else { LogList.Add(log); } return(LogList); }
public static void Log(string log) { // If there is no Connection, add it to the List if (!DataAnalytics.GetConnectedState()) { LogList.Add(log); } // If there is a Connection, immediately send the log else { LogLoader.SendLog(LogList, log); } }