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


C# AppSettings类代码示例

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


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

示例1: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            var appSettings = new AppSettings();
            var connString = appSettings.Get("SQLSERVER_CONNECTION_STRING",
                                             ConfigUtils.GetConnectionString("UserAuth"));
            container.Register<IDbConnectionFactory>(
                new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider));

            //Using an in-memory cache
            container.Register<ICacheClient>(new MemoryCacheClient());
            ConfigureAuth(container);
            var dbFactory = container.Resolve<IDbConnectionFactory>();
            dbFactory.Run(d => d.CreateTableIfNotExists<UserAuth>());
            dbFactory.Run(db => db.CreateTableIfNotExists<Message>());
            dbFactory.Run(d => d.CreateTableIfNotExists<Device>());

            SetConfig(new EndpointHostConfig
            {
                DefaultContentType = ContentType.Json,
                EnableFeatures = Feature.All.Remove(Feature.Html).Remove(Feature.Xml),
                AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Json }
            });
            //Or if Haz Redis
            //container.Register<ICacheClient>(new PooledRedisClientManager());
        }
开发者ID:joshua1,项目名称:MvcPortal,代码行数:28,代码来源:AppHost.cs

示例2: And_settings_file_does_not_exist_it_should_be_created

        public void And_settings_file_does_not_exist_it_should_be_created()
        {
            var fileName = Guid.NewGuid() + ".config";
            var fullPathToConfigurationFile = TestHelpers.GetFullPathToConfigurationFile(fileName);

            try
            {
                Assert.IsFalse(System.IO.File.Exists(fullPathToConfigurationFile));

                var settings = new AppSettings(fullPathToConfigurationFile, FileOption.None);

                settings.SetValue("string", "a");
                settings.SetValue<int>("int", 1);
                settings.SetValue<int?>("nullableint", null);

                settings.Save();

                Assert.IsTrue(System.IO.File.Exists(fullPathToConfigurationFile));
                Assert.IsTrue(settings.FileExists);
            }
            finally
            {
                TestHelpers.DeleteIfExists(fullPathToConfigurationFile);
            }
        }
开发者ID:tparvi,项目名称:appsettings,代码行数:25,代码来源:When_saving_settings.cs

示例3: WindowMain

    public WindowMain()
    {
      InitializeComponent();

      fAppSettings = new AppSettings();
      fLastScanned = PageTypeEnum.Letter;

      fScanner = new Scanner();
      fPrinter = new Printer();
      fPdfExporter = new PdfExporter();
      fPdfImporter = new PdfImporter();
      fImageLoader = new ImageLoader();
      fImageSaver = new ImageSaver();

      fDocument = new Document();
      fDocument.OnPageAdded += fDocument_OnPageAdded;
      fDocument.OnPageRemoved += fDocument_OnPageRemoved;
      fDocument.OnPageUpdated += fDocument_OnPageUpdated;
      fDocument.OnPageMoved += fDocument_OnPageMoved;
       
      fInsertionMark = new InsertionMark();
      fDragStartItem = null;
      fScrollTimer = new System.Timers.Timer(150);
      fScrollTimer.Elapsed += fScrollTimer_Elapsed;
      fScrollTimer.AutoReset = false;

      this.KeyUp += WindowMain_KeyUp;

      fClosing = false;
      fDeleting = false;
    }
开发者ID:leighwoltman,项目名称:PDF-Scanning-App,代码行数:31,代码来源:WindowMain.xaml.cs

示例4: Main

        public static void Main(string[] args)
        {
            try
            {
                // Open the default app.config file which in this case is SimpleExample.exe.config
                // and it is located in the same folder as the SimpleExample.exe.
                settings = AppSettings.CreateForAssembly(Assembly.GetEntryAssembly(), FileOption.FileMustExist);

                // If you want to know the full path to the configuration file, use the FullPath property
                Console.WriteLine("Full path to configuration file is: {0}", settings.FullPath);

                ReadStringValues();
                ReadStandardDataTypes();
                ReadEnumerations();
                ReadNullableValues();
                ReadUsingCustomFormatProvider();
                ReadOptionalValues();
                ReadUsingCustomConversionFunction();
                ReadConnectionString();
                ReadingCustomConfigurationFile();

                UpdatingValues();
                CreatingAppSettings();
            }
            catch (Exception exp)
            {
                Console.Error.WriteLine(exp.Message);
                throw;
            }
        }
开发者ID:tparvi,项目名称:appsettings,代码行数:30,代码来源:Program.cs

示例5: FormMain

    public FormMain()
    {
      InitializeComponent();
      this.Text = AppInfo.GetApplicationName();

      // Create PictureBoxPreview from special component;
      this.PictureBoxPreview = new Cyotek.Windows.Forms.ImageBox();
      this.PictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
      this.PictureBoxPreview.TabStop = false;
      this.PictureBoxPreview.BorderStyle = BorderStyle.None;
      this.PictureBoxPreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
      this.PanelPreview.Controls.Add(this.PictureBoxPreview);

      fAppSettings = new AppSettings();

      fScanner = new Scanner();
      fPrinter = new Printer();
      fPdfExporter = new PdfExporter();
      fPdfImporter = new PdfImporter();
      fImageLoader = new ImageLoader();
      fImageSaver = new ImageSaver();

      fDocument = new Document();
      fDocument.OnPageAdded += fDocument_OnPageAdded;
      fDocument.OnPageRemoved += fDocument_OnPageRemoved;
      fDocument.OnPageUpdated += fDocument_OnPageUpdated;
      fDocument.OnPageMoved += fDocument_OnPageMoved;

      fClosing = false;
      fDeleting = false;

      MenuSettingsPrinterUsePreview.Checked = true;
    }
开发者ID:leighwoltman,项目名称:PDF-Scanning-App,代码行数:33,代码来源:FormMain.cs

示例6: SaveReportSettings

        public void SaveReportSettings(AgrimanagrReportSettingViewModel setting)
        {
            var reporturl = _settingsRepository.GetByKey(SettingsKeys.ReportServerUrl);
            if (reporturl == null) reporturl = new AppSettings(Guid.NewGuid());
            reporturl.Key = SettingsKeys.ReportServerUrl;
            reporturl.Value = setting.Server;
            _settingsRepository.Save(reporturl);

            var reportusername = _settingsRepository.GetByKey(SettingsKeys.ReportServerUsername);
            if (reportusername == null) reportusername = new AppSettings(Guid.NewGuid());
            reportusername.Key = SettingsKeys.ReportServerUsername;
            reportusername.Value = setting.ReportUsername;
            _settingsRepository.Save(reportusername);

            var reportpassword = _settingsRepository.GetByKey(SettingsKeys.ReportServerPassword);
            if (reportpassword == null) reportpassword = new AppSettings(Guid.NewGuid());
            reportpassword.Key = SettingsKeys.ReportServerPassword;
            reportpassword.Value = VCEncryption.EncryptString(setting.ReportPassword);
            _settingsRepository.Save(reportpassword);

            var reportfolder = _settingsRepository.GetByKey(SettingsKeys.ReportServerFolder);
            if (reportfolder == null) reportfolder = new AppSettings(Guid.NewGuid());
            reportfolder.Key = SettingsKeys.ReportServerFolder;
            reportfolder.Value = setting.ReportFolder;
            _settingsRepository.Save(reportfolder);
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:26,代码来源:AgrimanagrSettingsViewModelBuilder.cs

示例7: GetAppSettings

        public AppSettings GetAppSettings()
        {
            var _appConfig = new AppSettings()
            {
                TenantAdminUrl = ConfigurationHelper.Get(TENANT_ADMIN_URL_KEY),
                SPHostUrl = ConfigurationHelper.Get(SPHOSTURL_KEY),
                ClientID = ConfigurationHelper.Get(CLIENTID_KEY),
                ClientSecret = ConfigurationHelper.Get(CLIENTSECRET_KEY),
                SupportEmailNotification = ConfigurationHelper.Get(SUPPORTTEAMNOTIFICATION_KEY),
            };

            ////TODO ENCRYPTION
            //_appConfig.TenantAdminAccount = ConfigurationHelper.Get(TENANTADMINACCOUNT_KEY);
            //_appConfig.TenantAdminAccountPwd = ConfigurationHelper.Get(TENANTADMINACCOUNTPWD_KEY);

            // we need to handle the boolean checks
            var _autoApprove = ConfigurationHelper.Get(AUTOAPPROVESITES_KEY);

            bool _result = false;
            if(Boolean.TryParse(_autoApprove, out _result)) {
                _appConfig.AutoApprove = _result;
            }
         
            return _appConfig;
        }
开发者ID:Calisto1980,项目名称:PnP,代码行数:25,代码来源:AppSetttingsManager.cs

示例8: ConfigureServices

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<AppSettings>(s =>
            {
                var appSettings = new AppSettings();
                Configuration.GetSection("AppSettings").Bind(appSettings);
                return appSettings;
            });

            services.AddSingleton<Client>(s =>
            {
                var appEnv = s.GetService<IApplicationEnvironment>();
                var settings = s.GetService<AppSettings>();

                var markdownCache = new SqliteMarkdownCache(
                    Path.Combine(
                        appEnv.ApplicationBasePath,
                        "releases-db.sqlite"));

                return new Client(
                    settings.AccessToken,
                    markdownCache,
                    s.GetService<ILogger<Client>>(),
                    string.IsNullOrEmpty(settings.Company) ? Client.DefaultUserAgent : settings.Company
                );
            });

            services.AddLogging();

            // Add framework services.
            services.AddMvc();
        }
开发者ID:huoxudong125,项目名称:releases,代码行数:33,代码来源:Startup.cs

示例9: ProfileLoader

 public ProfileLoader(IFileSystem fileSystem, IDirectorySystem directorySystem, IAppDirectoriesBuilder appDirBuilder, AppSettings settings)
 {
     _fileSystem = fileSystem;
     _directorySystem = directorySystem;
     _appDirBuilder = appDirBuilder;
     _settings = settings;
 }
开发者ID:joemcbride,项目名称:outlander,代码行数:7,代码来源:IProfileLoader.cs

示例10: ListBoxItem_Tap

        private void ListBoxItem_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            AppSettings settings = new AppSettings();

            ListBoxItem item = sender as ListBoxItem;
            settings.SearchItem = (item.Content.ToString());
        }
开发者ID:shegg77,项目名称:Contacts,代码行数:7,代码来源:SearchControl.xaml.cs

示例11: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     this.NavigationCacheMode = NavigationCacheMode.Required;
     _settings = new AppSettings();
     UIHelper.ShowSystemTrayAsync(Color.FromArgb(255, 48, 169, 62), Colors.White);
 }
开发者ID:VShangxiao,项目名称:WP-SPTCCBalance,代码行数:7,代码来源:MainPage.xaml.cs

示例12: SettingsPage

        public SettingsPage()
        {
            InitializeComponent();
            settings = new AppSettings();

            if (settings.GPSModeSetting == GPSMode.Automatic)
            {
                GPSModeSwitch.IsChecked = true;
                LatitudeTextBox.IsEnabled = false;
                LongitudeTextBox.IsEnabled = false;
            }
            else
            {
                GPSModeSwitch.IsChecked = false;
                LatitudeTextBox.IsEnabled = true;
                LongitudeTextBox.IsEnabled = true;
            }

            LatitudeTextBox.Text = settings.GPSLatitudeSetting.ToString("0.000").Replace(",", ".");
            LongitudeTextBox.Text = settings.GPSLongitudeSetting.ToString("0.000").Replace(",", ".");

            if (settings.TemperatureUnitSetting == TemperatureUnit.C)
            {
                CelciusRadioButton.IsChecked = true;
            }
            else if (settings.TemperatureUnitSetting == TemperatureUnit.F)
            {
                FahrenheitRadioButton.IsChecked = true;
            }

        }
开发者ID:Hitchhikrr,项目名称:7Timer-Astro-Weather-Windows-Phone-App,代码行数:31,代码来源:SettingsPage.xaml.cs

示例13: VibrateListBoxPage

        public VibrateListBoxPage()
        {
            InitializeComponent();

            mainSettings = new AppSettings();

            // Vibrate Device
            MainVibrateController = VibrateController.Default;

            // Events
            TrillVibrate.Tap += TrillVibrate_Tap;
            TrillVibrateButton.Tap += TrillVibrateButton_Tap;
            SpicatoVibrate.Tap += SpicatoVibrate_Tap;
            SpicatoVibrateButton.Tap += SpicatoVibrateButton_Tap;
            PizzicatoVibrate.Tap += PizzicatoVibrate_Tap;
            PizzicatoVibrateButton.Tap += PizzicatoVibrateButton_Tap;
            StaccatoVibrate.Tap += StaccatoVibrate_Tap;
            StaccatoVibrateButton.Tap += StaccatoVibrateButton_Tap;
            TenutoVibrate.Tap += TenutoVibrate_Tap;
            TenutoVibrateButton.Tap += TenutoVibrateButton_Tap;
            FermataVibrate.Tap += FermataVibrate_Tap;
            FermataVibrateButton.Tap += FermataVibrateButton_Tap;
            SnakeVibrate.Tap += SnakeVibrate_Tap;
            SnakeVibrateButton.Tap += SnakeVibrateButton_Tap;
            ZigZagVibrate.Tap += ZigZagVibrate_Tap;
            ZigZagVibrateButton.Tap += ZigZagVibrateButton_Tap;
            RandomVibrate.Tap += RandomVibrate_Tap;
            RandomVibrateButton.Tap += RandomVibrateButton_Tap;
        }
开发者ID:joseph-zhong,项目名称:CommuterBuddy,代码行数:29,代码来源:VibrateListBoxPage.xaml.cs

示例14: TeamReportRound

 public TeamReportRound()
 {
     var appSettings = new AppSettings();
     Name = appSettings.ReportRoundName;
     StartTime = appSettings.ReportStartTime;
     EndTime = appSettings.ReportEndTime;
 }
开发者ID:Self-Education-Association,项目名称:SITE,代码行数:7,代码来源:TeamManageModels.cs

示例15: GravatarProvider

 public GravatarProvider(
     IOptions<AppSettings> appSettings
     , ApplicationUserManager userManager)
 {
     _appSettings = appSettings.Value;
     _userManager = userManager;
 }
开发者ID:CWISoftware,项目名称:accounts,代码行数:7,代码来源:GravatarProvider.cs


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