コード例 #1
0
        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();
            }
        }
コード例 #2
0
        // Called on foreground after history has refreshed

        private void ForegroundHistoryRefreshCompleteonUI(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();       // say i'm okay for another refresh
                System.Diagnostics.Debug.WriteLine("Refresh completed, allow another refresh");

                LogLine("History refresh complete.".T(EDTx.EDDiscoveryController_HRC));

                ReportRefreshProgress(-1, "");

                Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh history complete");
            }
        }
コード例 #3
0
        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");
            }
        }
コード例 #4
0
        // Called on foreground after history has refreshed

        private void ForegroundHistoryRefreshComplete(HistoryList hist)
        {
            Debug.Assert(System.Windows.Forms.Application.MessageLoop);

            if (!PendingClose)
            {
                Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " Refresh history worker completed");

                if (hist != null)
                {
                    history.Copy(hist);

                    OnRefreshCommanders?.Invoke();

                    EdsmLogFetcher.StopCheck();

                    ReportProgress(-1, "");

                    RefreshDisplays();
                    Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " Refresh Displays Completed");
                }

                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);
                }

                refreshHistoryRequestedFlag = 0;
                readyForNewRefresh.Set();

                LogLine("History refresh complete.");

                Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " refresh history complete");
            }
        }
コード例 #5
0
        // Called on foreground after history has refreshed

        private void ForegroundHistoryRefreshCompleteonUI(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(true);

                Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Call Refresh Complete");

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

                FrontierCAPI.Disconnect();         // Disconnect capi from current user, but don't clear their credential file

                // available, and not hidden commander, and we have logged in before
                if (FrontierCAPI.ClientIDAvailable && EDCommander.Current.Id >= 0 && FrontierCAPI.GetUserState(EDCommander.Current.Name) != CAPI.CompanionAPI.UserState.NeverLoggedIn)
                {
                    System.Threading.Tasks.Task.Run(() =>             // don't hold up the main thread, do it in a task, as its a HTTP operation
                    {
                        FrontierCAPI.LogIn(EDCommander.Current.Name); // try and get to Active.  May cause a new frontier login

                        if (FrontierCAPI.Active)                      // if active, indicate
                        {
                            LogLine("CAPI User Logged in");
                        }
                        else
                        {
                            LogLine("CAPI Require Log in");
                        }
                    });
                }

                if (history.CommanderId >= 0)
                {
                    EdsmLogFetcher.Start(EDCommander.Current);
                }

                refreshHistoryRequestedFlag = 0;
                readyForNewRefresh.Set();       // say i'm okay for another refresh
                System.Diagnostics.Debug.WriteLine("Refresh completed, allow another refresh");

                LogLine("History refresh complete.".T(EDTx.EDDiscoveryController_HRC));

                ReportRefreshProgress(-1, "");

                Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Refresh history complete");
            }
        }