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();
            }
        }
        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");
            }
        }
Beispiel #3
0
        private void RefreshHistoryWorkerCompleted(HistoryList hist)
        {
            if (!PendingClose)
            {
                if (hist != null)
                {
                    OnRefreshCommanders?.Invoke();

                    history.Clear();

                    foreach (var ent in hist.EntryOrder)
                    {
                        history.Add(ent);
                        Debug.Assert(ent.MaterialCommodity != null);
                    }

                    history.materialcommodititiesledger = hist.materialcommodititiesledger;
                    history.starscan            = hist.starscan;
                    history.shipinformationlist = hist.shipinformationlist;
                    history.CommanderId         = hist.CommanderId;

                    if (history.CommanderId != EdsmLogFetcher.CommanderId)
                    {
                        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();

                OnRefreshComplete?.Invoke();                            // History is completed

                refreshRequestedFlag = 0;
                readyForNewRefresh.Set();
            }
        }