public void StartEncounter(uint mapId) { try { _encounter = new Encounter { StartTime = DateTime.Now, MapId = mapId }; _sqLiteConnection.InsertAsync(_encounter) .ContinueWith(t => LogHelper.Log(Logger, "Encounter " + _encounter.Id + " started.", LogLevel.Trace)); EncounterTimer.Start(); } catch (Exception ex) { LogHelper.Log(Logger, ex, LogLevel.Error); } }
public void EndEncounter() { _encounter.EndTime = DateTime.Now; var tempEncounter = _encounter; _sqLiteConnection.UpdateAsync(_encounter) .ContinueWith(t => LogHelper.Log(Logger, "Encounter " + tempEncounter.Id + " ended. Duration: " + (tempEncounter.EndTime - tempEncounter.StartTime).ToString(), LogLevel.Trace)); _encounter = null; PartyCaptured = false; EncounterTimer.Reset(); }