コード例 #1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void Initialise()
        {
            if (!_Initialised)
            {
                lock (_SyncLock) {
                    if (!_Initialised)
                    {
                        _Initialised = true;
                        _Storage     = Factory.ResolveSingleton <ITileServerSettingsStorage>();

                        try {
                            if (!_Storage.DownloadedSettingsFileExists())
                            {
                                DoDownloadTileServerSettings(InitialiseTimeoutSeconds);
                            }
                        } catch (ThreadAbortException) {
                            ;
                        } catch (Exception ex) {
                            var log = Factory.ResolveSingleton <ILog>();
                            log.WriteLine("Caught exception while downloading tile server settings at startup: {0}", Describe.ExceptionMultiLine(ex));
                        }

                        LoadTileServerSettings();
                        _Storage.CreateReadme();

                        var heartbeat = Factory.ResolveSingleton <IHeartbeatService>();
                        heartbeat.SlowTick += Heartbeat_SlowTick;
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void Initialise()
        {
            if (!_Initialised)
            {
                lock (_SyncLock) {
                    if (!_Initialised)
                    {
                        _Initialised = true;
                        _Storage     = Factory.ResolveSingleton <ITileServerSettingsStorage>();
                        var reportErrors = new StringBuilder();

                        CatchErrorsDuringInitialise(reportErrors, "downloading tile server settings", () => {
                            if (!_Storage.DownloadedSettingsFileExists())
                            {
                                DoDownloadTileServerSettings(InitialiseTimeoutSeconds);
                            }
                        });

                        CatchErrorsDuringInitialise(reportErrors, "loading tile server settings", () => {
                            LoadTileServerSettings();
                        });

                        CatchErrorsDuringInitialise(reportErrors, "creating tile server settings readme", () => {
                            _Storage.CreateReadme();
                        });

                        if (reportErrors.Length > 0)
                        {
                            var messageBox = Factory.Resolve <IMessageBox>();
                            messageBox.Show(reportErrors.ToString(), "Errors While Initialising Tile Server Settings Manager");
                        }

                        var heartbeat = Factory.ResolveSingleton <IHeartbeatService>();
                        heartbeat.SlowTick += Heartbeat_SlowTick;
                    }
                }
            }
        }