Exemplo n.º 1
0
        private void Load()
        {
            if (_loaded)
            {
                return;
            }

            _loaded = true;

            try
            {
                _settings.Load();
            }
            catch (ConfigurationException ex)
            {
                if (!(ex.InnerException is ConfigurationErrorsException configError) ||
                    string.IsNullOrEmpty(configError.Filename))
                {
                    throw;
                }

                File.Delete(configError.Filename);
                SingleInstanceApplication.ReleaseSingleInstanceLock();
                Process.Start(System.Windows.Application.ResourceAssembly.Location);
                Environment.Exit(0);
            }
        }