private void RefreshHistoryWorkerCompleted(HistoryList hist) { if (!PendingClose) { if (hist != null) { history.Copy(hist); OnRefreshCommanders?.Invoke(); if (history.CommanderId >= 0 && history.CommanderId != EdsmLogFetcher.CommanderId) // not hidden, and not last cmdr { EdsmLogFetcher.StopCheck(); // ENSURE stopped. it was asked to be stop on the refresh, so should be EdsmLogFetcher = new EDSMLogFetcher(history.CommanderId, LogLine); EdsmLogFetcher.OnDownloadedSystems += () => RefreshHistoryAsync(); } ReportProgress(-1, ""); LogLine("Refresh Complete."); RefreshDisplays(); } HistoryRefreshed?.Invoke(this, EventArgs.Empty); // Internal hook call journalmonitor.StartMonitor(); EdsmLogFetcher.Start(); // EDSM log fetcher was stopped, restart it.. ignored if not a valid commander or disabled. OnRefreshComplete?.Invoke(); // History is completed refreshRequestedFlag = 0; readyForNewRefresh.Set(); } }
// Called on foreground after history has refreshed private void ForegroundHistoryRefreshComplete(HistoryList hist) { Debug.Assert(System.Windows.Forms.Application.MessageLoop); if (!PendingClose) { Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh history worker completed"); if (hist != null) { history.Copy(hist); OnRefreshCommanders?.Invoke(); EdsmLogFetcher.StopCheck(); Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh Displays"); OnHistoryChange?.Invoke(history); Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh Displays Completed"); } Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " JM On"); journalmonitor.StartMonitor(); Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Call Refresh Complete"); OnRefreshComplete?.Invoke(); // History is completed if (history.CommanderId >= 0) { EdsmLogFetcher.Start(EDCommander.Current); } refreshHistoryRequestedFlag = 0; readyForNewRefresh.Set(); LogLine("History refresh complete.".Tx(this, "HRC")); ReportRefreshProgress(-1, ""); Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh history complete"); } }
private void RefreshHistoryWorkerCompleted(HistoryList hist) { if (!PendingClose) { Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " Refresh history worker completed"); if (hist != null) { history.Copy(hist); OnRefreshCommanders?.Invoke(); EdsmLogFetcher.StopCheck(); ReportProgress(-1, ""); LogLine("Refresh Complete."); RefreshDisplays(); Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " Refresh Displays Completed"); } Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " HR Refresh"); HistoryRefreshed?.Invoke(this, EventArgs.Empty); // Internal hook call Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " JMOn"); journalmonitor.StartMonitor(); Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " RFcomplete"); OnRefreshComplete?.Invoke(); // History is completed if (history.CommanderId >= 0) { EdsmLogFetcher.Start(EDCommander.Current); } refreshRequestedFlag = 0; readyForNewRefresh.Set(); Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " refresh history complete"); } }