当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationManager类代码示例

本文整理汇总了C#中ConfigurationManager的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationManager类的具体用法?C# ConfigurationManager怎么用?C# ConfigurationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurationManager类属于命名空间,在下文中一共展示了ConfigurationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Manager

 private Manager()
 {
     ConfigurationManager = new ConfigurationManager();
     InstanceManager = new InstanceManager();
     VersionManager = new VersionManager();
     DownloadManager = new DownloadManager();
 }
开发者ID:Ghosttje,项目名称:GhostLauncher,代码行数:7,代码来源:Manager.cs

示例2: OpenIdConnectCachingSecurityTokenProvider

        public OpenIdConnectCachingSecurityTokenProvider(string metadataEndpoint)
        {
            _metadataEndpoint = metadataEndpoint;
            _configManager = new ConfigurationManager<OpenIdConnectConfiguration>(metadataEndpoint);

            RetrieveMetadata();
        }
开发者ID:dstrockis,项目名称:aad-msa-channel9-demo,代码行数:7,代码来源:OpenIdConnectCachingSecurityTokenProvider.cs

示例3: btnCreate_Click

        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            if (txtAppId.Text.IsNullOrEmpty())
            {
                MessageBox.Show("Application Id не может быть пустым");
                return;
            }

            using (ConfigurationManager man = new ConfigurationManager())
            {
                UserData data = new UserData();
                data.UserName = txtUserName.Text;
                data.Password = txtUserPassword.Text;
                data.Email = txtEmail.Text;

                data.AppId = long.Parse(txtAppId.Text);
                data.AccessKey = txtAccessKey.Text;
                if (man.CreateUser(data))
                    MessageBox.Show("Пользователь успешено создан", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Information);

                else
                    MessageBox.Show("Ошибка создания пользователя", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Error);
            }
            Refresh();
        }
开发者ID:OleksandrKulchytskyi,项目名称:VkManager,代码行数:27,代码来源:SelectUserWindow.xaml.cs

示例4: XrmUriEditor

        internal XrmUriEditor(ConfigurationManager configManager)
        {
            InitializeComponent();

            this.configManager = configManager;
            XrmUri = new XrmUri();
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:7,代码来源:XrmUriEditor.xaml.cs

示例5: OnStart

        protected override void OnStart(string[] args)
        {
            logger.Info("Starting service...");

            try
            {
                container = new UnityContainer();
                container.RegisterInstance(container);
                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

                configuration = new ConfigurationManager(HostMetadata.PortalApp, SpecialFolder.CommonApplicationData);
                container.RegisterInstance(configuration);

                settings = configuration.GetSection<PortalSettings>(PortalSettings.SectionKey);
                container.RegisterInstance(settings);

                loginSettings = configuration.GetSection<LoginSettings>(LoginSettings.SectionKey);
                container.RegisterInstance(loginSettings);

                portalServiceSettings = configuration.GetSection<PortalServiceSettings>(PortalServiceSettings.SectionKey);
                container.RegisterInstance(portalServiceSettings);

                portal = new PortalInstance(settings, loginSettings);
                portal.Start();

                logger.Info("Service started");
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
开发者ID:breslavsky,项目名称:queue,代码行数:33,代码来源:PortalService.cs

示例6: LoadOpenIdConnectConfigurationAsync

        private async Task LoadOpenIdConnectConfigurationAsync()
        {
            var discoAddress = _settings.Authority + "/.well-known/openid-configuration";

            var manager = new ConfigurationManager<OpenIdConnectConfiguration>(discoAddress);
            _config = await manager.GetConfigurationAsync();
        }
开发者ID:RobGibbens,项目名称:IdentityServer3.Samples,代码行数:7,代码来源:LoginWebView.xaml.cs

示例7: Main

        public static int Main(string [] args)
        {
            var configurationManager = new ConfigurationManager ();
            if (!configurationManager.LoadCommandLineArgs (args))
                return 1;

            // Show the help and exit.
            if (configurationManager.Help) {
                configurationManager.PrintHelp ();
            #if DEBUG
                Console.WriteLine ("Press any key...");
                Console.ReadKey ();
            #endif
                return 0;
            }

            // Show the version and exit.
            if (configurationManager.Version) {
                Version.Show ();
                return 0;
            }

            if (!configurationManager.LoadConfigFile ())
                return 1;

            configurationManager.SetupLogger ();

            #if DEBUG
            // Log everything while debugging
            Logger.Level = LogLevel.All;
            #endif

            Logger.Write (LogLevel.Debug, Assembly.GetExecutingAssembly ().GetName ().Name);

            string configDir = configurationManager.ConfigDir;
            if (String.IsNullOrEmpty (configDir)) {
                Logger.Write (LogLevel.Error, "You MUST provide a configuration directory with the --config-dir parameter");
                return 1;
            }

            var configDirInfo = new DirectoryInfo (configDir);
            if (!configDirInfo.Exists) {
                Logger.Write (LogLevel.Error, "The configuration directory \"{0}\" does not exist!", configDir);
                return 1;
            }

            Logger.Write (LogLevel.Debug, "Configuration directory exists, loading configuration files");

            ChildrenManager.StartChildren (configDirInfo.GetFiles("*.xml"), configurationManager);

            if (!configurationManager.Stoppable)
                return 0;

            Console.WriteLine ("Hit Return to stop the server.");
            Console.ReadLine ();

            ChildrenManager.TermChildren();
            ChildrenManager.KillChildren();
            return 0;
        }
开发者ID:ryepup,项目名称:xsp,代码行数:60,代码来源:main.cs

示例8: MainForm

        public MainForm()
        {
            InitializeComponent();

            var container = new UnityContainer();
            container.RegisterInstance(container);
            ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

            string exePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), HostMetadata.PortalServiceExe);
            serviceManager = new ServiceManager(HostMetadata.PortalServiceName, exePath);

            configuration = new ConfigurationManager(HostMetadata.PortalApp, Environment.SpecialFolder.CommonApplicationData);
            container.RegisterInstance(configuration);

            settings = configuration.GetSection<PortalSettings>(PortalSettings.SectionKey);
            container.RegisterInstance(settings);

            portalSettingsBindingSource.DataSource = settings;

            loginSettings = configuration.GetSection<LoginSettings>(LoginSettings.SectionKey);
            container.RegisterInstance(loginSettings);

            loginSettingsControl.Settings = loginSettings;

            portalServiceSettings = configuration.GetSection<PortalServiceSettings>(PortalServiceSettings.SectionKey);
            container.RegisterInstance(portalServiceSettings);

            portalServiceSettingsBindingSource.DataSource = portalServiceSettings;

            loginSettingsControl.UserRole = UserRole.Administrator;
        }
开发者ID:breslavsky,项目名称:queue,代码行数:31,代码来源:MainForm.cs

示例9: AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway

        public void AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway()
        {
            // Arrange
            var secondary = new Config
                {
                    Age = 12,
                    Name = "Timothy"
                };

            var primary = new Config();

            var expected = new Config
                {
                    Name = "Timothy"
                };

            var configManager = new ConfigurationManager<Config>(
                new DummyConfigurationSource<Config>(secondary),
                new DummyConfigurationSource<Config>(primary));

            configManager.AlwaysSerialize(t => t.Name);

            var actualManager = new DummyConfigurationSource<Config>(new Config());
            configManager.SaveChanges(actualManager);

            Assert.IsTrue(new ConfigComparer().Equals(
                expected, actualManager.SavedObject));
        }
开发者ID:ZhangYueqiu,项目名称:smartconf,代码行数:28,代码来源:SmartConfUnitTest.cs

示例10: OnStart

        protected override void OnStart(string[] args)
        {
            logger.Info("Starting service...");

            try
            {
                container = new UnityContainer();
                container.RegisterInstance(container);
                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

                configuration = new ConfigurationManager(HostMetadata.ServerApp, SpecialFolder.CommonApplicationData);
                container.RegisterInstance(configuration);

                settings = configuration.GetSection<ServerSettings>(ServerSettings.SectionKey);
                container.RegisterInstance(settings);

                templateServiceSettings = configuration.GetSection<TemplateServiceSettings>(TemplateServiceSettings.SectionKey);
                container.RegisterInstance(templateServiceSettings);

                var culture = settings.Language.GetCulture();
                Thread.CurrentThread.CurrentCulture = culture;
                CultureInfo.DefaultThreadCurrentCulture = culture;

                server = new ServerInstance(settings);
                server.Start();

                logger.Info("Service started");
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
开发者ID:breslavsky,项目名称:queue,代码行数:34,代码来源:ServerService.cs

示例11: Analyze_EmptyFile_ThrowsException

        public void Analyze_EmptyFile_ThrowsException()
        {
            LoggingFacility.Logger = Substitute.For<ILogger>();

            ConfigurationManager cm = new ConfigurationManager();
            bool configured = cm.IsConfigured("something");
            //rest of test
        }
开发者ID:ndphuong,项目名称:aout2,代码行数:8,代码来源:Listing7.1.cs

示例12: Init

        public void Init()
        {
            InitCache();

            _confMan = ConfigurationManager.Instance;
            Isolate.WhenCalled(() => _confMan.AddInMemorySqLiteEnvironment<TestMapping>("Test")).CallOriginal();
            RepositoryFixture.CreateInMemorySqLiteRepository<TestMapping>("Test");
        }
开发者ID:rdvanbuuren,项目名称:NhRepository,代码行数:8,代码来源:TheFactoryMethodCreateInMemoryEntityRepositoryShould.cs

示例13: ClearTheFakeObject

 public void ClearTheFakeObject()
 {
     _fackProjObj = null;
     _fakeActiveConfiguration = null;
     _fakeConfigurationManager = null;
     _fakeCollection = null;
     _fakeVcConfiguration = null;
 }
开发者ID:God-Staff,项目名称:vs-boost-unit-test-adapter,代码行数:8,代码来源:ProjectOutPutCheckerVs12Nunit.cs

示例14: Analyze_EmptyFile_ThrowsException

 public void Analyze_EmptyFile_ThrowsException()
 {
    FakeTheLogger();
    
    ConfigurationManager cm = new ConfigurationManager();
    bool configured = cm.IsConfigured("something");
     //rest of test
 }
开发者ID:ndphuong,项目名称:aout2,代码行数:8,代码来源:Listing7.2.cs

示例15: DoProjectConfigurations

 private static void DoProjectConfigurations(
     ConfigurationManager configurationManager
     )
 {
     foreach (Configuration configuration in configurationManager)
     {
         DoProjectConfiguration(configuration);
     }
 }
开发者ID:dpvreony,项目名称:nucleotide,代码行数:9,代码来源:Build.cs


注:本文中的ConfigurationManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。