private void OnNewEntry(HistoryEntry he, HistoryList hl) { last_he = he; if (last_he != null) { // hmm. not checking EDSM for scan data.. do we want to ? prob not. JournalScan sd = discoveryform.history.GetScans(he.System.Name).Where(sc => sc.BodyName == he.WhereAmI).FirstOrDefault(); bodyRadius = sd?.nRadius; switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.Screenshot: JournalScreenshot js = he.journalEntry as JournalScreenshot; latitude = js.nLatitude; longitude = js.nLongitude; break; case JournalTypeEnum.Touchdown: JournalTouchdown jt = he.journalEntry as JournalTouchdown; if (jt.PlayerControlled.HasValue && jt.PlayerControlled.Value) { latitude = jt.Latitude; longitude = jt.Longitude; } break; case JournalTypeEnum.Location: JournalLocation jl = he.journalEntry as JournalLocation; latitude = jl.Latitude; longitude = jl.Longitude; break; case JournalTypeEnum.Liftoff: JournalLiftoff jlo = he.journalEntry as JournalLiftoff; if (jlo.PlayerControlled.HasValue && jlo.PlayerControlled.Value) { latitude = jlo.Latitude; longitude = jlo.Longitude; } break; case JournalTypeEnum.LeaveBody: latitude = null; longitude = null; break; case JournalTypeEnum.FSDJump: // to allow us to do PopulateBookmark.. break; default: return; } PopulateBookmarkCombo(); DisplayCompass(); } }
private void Display(HistoryEntry he, HistoryList hl) { last_he = he; if (last_he != null) { JournalScan sd = discoveryform.history.GetScans(he.System.Name).Where(sc => sc.BodyName == he.WhereAmI).FirstOrDefault(); bodyRadius = sd?.nRadius; switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.Screenshot: JournalScreenshot js = he.journalEntry as JournalScreenshot; latitude = js.nLatitude; longitude = js.nLongitude; break; case JournalTypeEnum.Touchdown: JournalTouchdown jt = he.journalEntry as JournalTouchdown; if (jt.PlayerControlled.HasValue && jt.PlayerControlled.Value) { latitude = jt.Latitude; longitude = jt.Longitude; } break; case JournalTypeEnum.Location: JournalLocation jl = he.journalEntry as JournalLocation; latitude = jl.Latitude; longitude = jl.Longitude; break; case JournalTypeEnum.Liftoff: JournalLiftoff jlo = he.journalEntry as JournalLiftoff; if (jlo.PlayerControlled.HasValue && jlo.PlayerControlled.Value) { latitude = jlo.Latitude; longitude = jlo.Longitude; } break; case JournalTypeEnum.LeaveBody: latitude = null; longitude = null; break; default: return; } Display(); } }
private async void OnNewEntry(HistoryEntry he, HistoryList hl) { last_he = he; if (last_he != null) { if (bodyRadius == null || lastradiusbody != he.WhereAmI) // try and get radius, this is cleared on target selection { StarScan.SystemNode last_sn = await discoveryform.history.StarScan.FindSystemAsync(he.System, false); // find scan if we have one JournalScan sd = last_sn?.Find(he.WhereAmI)?.ScanData; // find body scan data if present, null if not bodyRadius = sd?.nRadius; if (bodyRadius.HasValue) { lastradiusbody = he.WhereAmI; System.Diagnostics.Debug.WriteLine("Compass Radius Set " + lastradiusbody + " " + bodyRadius.Value); } } switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.Screenshot: JournalScreenshot js = he.journalEntry as JournalScreenshot; latitude = js.nLatitude; longitude = js.nLongitude; altitude = js.nAltitude; break; case JournalTypeEnum.Touchdown: JournalTouchdown jt = he.journalEntry as JournalTouchdown; if (jt.PlayerControlled.HasValue && jt.PlayerControlled.Value) { latitude = jt.Latitude; longitude = jt.Longitude; altitude = 0; } break; case JournalTypeEnum.Location: JournalLocation jl = he.journalEntry as JournalLocation; latitude = jl.Latitude; longitude = jl.Longitude; altitude = null; break; case JournalTypeEnum.Liftoff: JournalLiftoff jlo = he.journalEntry as JournalLiftoff; if (jlo.PlayerControlled.HasValue && jlo.PlayerControlled.Value) { latitude = jlo.Latitude; longitude = jlo.Longitude; altitude = 0; } break; case JournalTypeEnum.LeaveBody: latitude = null; longitude = null; altitude = null; break; case JournalTypeEnum.FSDJump: // to allow us to do PopulateBookmark.. case JournalTypeEnum.CarrierJump: break; default: return; } PopulateBookmarkCombo(); DisplayCompass(); } }