コード例 #1
0
ファイル: EDSMResponder.cs プロジェクト: lagoth/EDDI
        public void Reload()
        {
            // Set up the star map service
            starMapService = new StarMapService();
            if (ignoredEvents == null)
            {
                ignoredEvents = starMapService?.getIgnoredEvents();
            }

            if (starMapService != null && updateThread == null)
            {
                // Spin off a thread to download & sync flight logs & system comments from EDSM in the background
                updateThread = new Thread(() => DataProviderService.syncFromStarMapService())
                {
                    IsBackground = true,
                    Name         = "EDSM updater"
                };
                updateThread.Start();
            }
        }
コード例 #2
0
        public void Reload()
        {
            // Set up the star map service
            starMapService = null;
            StarMapConfiguration starMapCredentials = StarMapConfiguration.FromFile();

            if (starMapCredentials != null && starMapCredentials.apiKey != null)
            {
                // Commander name might come from star map credentials or the companion app's profile
                string commanderName = null;
                if (starMapCredentials.commanderName != null)
                {
                    commanderName = starMapCredentials.commanderName;
                }
                else if (EDDI.Instance.Cmdr != null)
                {
                    commanderName = EDDI.Instance.Cmdr.name;
                }
                if (commanderName != null)
                {
                    starMapService = new StarMapService(starMapCredentials.apiKey, commanderName);
                }
                if (ignoredEvents == null)
                {
                    ignoredEvents = starMapService?.getIgnoredEvents();
                }
            }

            if (starMapService != null && updateThread == null)
            {
                // Spin off a thread to download & sync EDSM flight logs & system comments in the background
                updateThread = new Thread(() => starMapService.Sync(starMapCredentials.lastSync));
                updateThread.IsBackground = true;
                updateThread.Name         = "EDSM updater";
                updateThread.Start();
            }
        }