private void OnResourceStop() { try { if (weatherThread != null) { weatherThread.Abort(); } onWeatherDataReceived -= WeatherDataReceived; } catch (Exception e) { API.consoleOutput(e.ToString()); } }
private void OnResourceStart() { onWeatherDataReceived += WeatherDataReceived; var data = File.ReadAllText(API.getResourceFolder() + "/Weather/data.json"); weatherData = API.fromJson(data).ToObject <WeatherData>(); API.consoleOutput("~~~~~ Live Weather ~~~~~"); API.consoleOutput("City WoeID: " + weatherData.WoeID); API.consoleOutput("Refresh Rate: " + weatherData.RefreshRate); API.consoleOutput("Display Update: " + weatherData.DisplayUpdate); API.consoleOutput("~~~~~ Live Weather ~~~~~"); weatherThread = new Thread(WeatherCheck); weatherThread.Start(); }