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;
        }
 public TeamReportRound()
 {
     var appSettings = new AppSettings();
     Name = appSettings.ReportRoundName;
     StartTime = appSettings.ReportStartTime;
     EndTime = appSettings.ReportEndTime;
 }
Пример #3
0
 public static void Load(string fileName)
 {
     lock (Sync)
     {
         _instance = Load<AppSettings>(fileName);
     }
 }
Пример #4
0
        public BookModule(AppSettings appSettings)
            : base("/Book")
        {
            Before += ctx =>
                {
                    return ctx.Response;
                };

            After += ctx =>
                {
                };

            Get["/"] = o =>
                {
                    ViewBag.Dio = "Dio";
                    return View["Index.cshtml", new
                        {
                            Alma = appSettings.Alma,
                            Barack = appSettings.Barack,
                            Citrom = appSettings.Citrom
                        }];
                };

            Get["/Details/{id}"] = o =>
                {
                    return "BookId " + o.Id;
                };

            Post["/ReadModel"] = o =>
                {
                    var model = this.Bind<SimpleModel>();
                    return "succes";
                };
        }
Пример #5
0
        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());
        }
Пример #6
0
 public BombaJobEventArgs(bool ise, string eMsg, string xml, AppSettings.ServiceOp sOp)
 {
     this.isError = ise;
     this.errorMessage = eMsg;
     this.xmlContent = xml;
     this.serviceOp = sOp;
 }
    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;
    }
Пример #8
0
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     appSettings = new AppSettings();
     bookList = new BookList();
     BibleHubListBox.ItemsSource = bookList;
 }
Пример #9
0
        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);
            }
        }
Пример #10
0
            public override void Configure(Funq.Container container)
            {
                //Set JSON web services to return idiomatic JSON camelCase properties
                ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
                var appSettings = new AppSettings();
                //Registers authorization service and endpoints /auth and /auth{provider}

                Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                    new IAuthProvider[] {
                    new CredentialsAuthProvider(),              //HTML Form post of UserName/Password credentials
                    new TwitterAuthProvider(appSettings),       //Sign-in with Twitter
                    //new FacebookAuthProvider(appSettings),      //Sign-in with Facebook
                    new GoogleOpenIdOAuthProvider(appSettings), //Sign-in with Google OpenId
                }) {HtmlRedirect = "/Camper/SignIn"});

                //Provide service for new users to register so they can login with supplied credentials.
                Plugins.Add(new RegistrationFeature());

                NHibernateConfigurator.Initialize<CamperMapping>();
                //Store User Data into the referenced SqlServer database
                container.Register<IUserAuthRepository>(c =>
                    new NHibernateUserAuthRepository()); //Can Use OrmLite DB Connection to persist the UserAuth and AuthProvider info

                //override the default registration validation with your own custom implementation
                container.RegisterAs<MyRegistrationValidator, IValidator<Registration>>();

                var redisCon = ConfigurationManager.AppSettings["redisUrl"].ToString();
                container.Register<IRedisClientsManager>(new PooledRedisClientManager(20, 60, redisCon));
                container.Register<ICacheClient>(c => (ICacheClient)c.Resolve<IRedisClientsManager>().GetCacheClient());

                ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            }
Пример #11
0
    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;
    }
Пример #12
0
 public FacebookLoginViewModel(
     INavigationService navigationService, 
     AppSettings appSettings, 
     UsersRestService usersRestService)
     : base(navigationService, appSettings, usersRestService)
 {     
 }
Пример #13
0
        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;
            }
        }
Пример #14
0
		public App()
		{
			this.InitializeComponent();

			// Note that the constructor does not run on the UI thread.

#if DEBUG
			Log.Default.RegisterListener(new DebugLogListener());
#endif

			// AutoFlush means it can be a bit slow, unfortunately... do not use like this in real production scenario.
			var logFileStream = File.Open(LogFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
			Log.Default.RegisterListener(new StreamWriterLogListener(new StreamWriter(logFileStream, Encoding.UTF8)
			{
				AutoFlush = true
			}));

			Settings = new AppSettings();

			_log.Debug(Helpers.Debug.ToDebugString(Settings));

			Suspending += OnSuspending;
			Resuming += OnResuming;
			UnhandledException += OnUnhandledException;
		}
Пример #15
0
        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;
        }
Пример #16
0
        /* Uncomment to enable ServiceStack Authentication and CustomUserSession */
        private void ConfigureAuth(Funq.Container container)
        {
            var appSettings = new AppSettings();

            //Default route: /auth/{provider}
            Plugins.Add(new AuthFeature(() => new CustomUserSession(),
                new IAuthProvider[] {
                    new CredentialsAuthProvider(appSettings),
                    new FacebookAuthProvider(appSettings),
                    new TwitterAuthProvider(appSettings),
                    new BasicAuthProvider(appSettings),
                }));

            //Default route: /register
            Plugins.Add(new RegistrationFeature());

            //Requires ConnectionString configured in Web.Config
            var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString;
            container.Register<IDbConnectionFactory>(c =>
                new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));

            container.Register<IUserAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));

            container.Resolve<IUserAuthRepository>().InitSchema();
        }
        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);
        }
Пример #18
0
        public PivotLandingPage()
        {
            InitializeComponent();
            CreateApplicationBar();

            // Setup our context menus.
            OverdueList.AddContextMenu(TaskListContextMenuClick);
            TodayList.AddContextMenu(TaskListContextMenuClick);
            TomorrowList.AddContextMenu(TaskListContextMenuClick);
            WeekList.AddContextMenu(TaskListContextMenuClick);
            NoDueList.AddContextMenu(TaskListContextMenuClick);

            IsLoading = false;

            // Start on the pivot that the user has selected on the settings page.
            AppSettings settings = new AppSettings();
            if (settings.StartPageSetting == 0)
            {
                Pivot.SelectedItem = TasksPanel;
            }
            else if (settings.StartPageSetting == 1)
            {
                Pivot.SelectedItem = ListsPanel;
            }
            else if (settings.StartPageSetting == 2)
            {
                Pivot.SelectedItem = TagsPanel;
            }
        }
Пример #19
0
 public GravatarProvider(
     IOptions<AppSettings> appSettings
     , ApplicationUserManager userManager)
 {
     _appSettings = appSettings.Value;
     _userManager = userManager;
 }
 private AppSettings GetAppSettings(DirectoryEntry entry)
 {
     string path = entry.Path;
     AppSettings settings = null;
     object obj2 = this.webApps[path];
     if (obj2 == null)
     {
         lock (this.webApps)
         {
             obj2 = this.webApps[path];
             if (obj2 == null)
             {
                 settings = new AppSettings(entry);
                 this.webApps[path] = settings;
             }
             goto Label_0063;
         }
     }
     settings = (AppSettings) obj2;
 Label_0063:
     if (!settings.AccessRead)
     {
         return null;
     }
     return settings;
 }
Пример #21
0
        public static AppSettings Load(string filepath)
        {
            AppSettings settings = new AppSettings();

            Stream fileStream = null;
            try
            {
                fileStream = File.OpenRead(filepath);
            }
            catch
            {
                Logger.Warn("Failed to load settings file. Creating a default one...");
                Save(settings, filepath);
                return settings;
            }

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(AppSettings));
                settings = (AppSettings)serializer.Deserialize(fileStream);
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("Failed to load settings file. Is it correct? Exception detail: {0}", ex));
            }

            fileStream.Close();

            return settings;
        }
Пример #22
0
        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            var connectionString = ConfigurationManager.ConnectionStrings["conString"].ToString();
            Register<IDbConnectionFactory>(new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));

            var appSettings = new AppSettings();
            Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[]
                {
                    new CredentialsAuthProvider(),
                    new FacebookAuthProvider(appSettings),
                    new GoogleOpenIdOAuthProvider(appSettings),
                }));

            Plugins.Add(new RegistrationFeature());

            var userRep = new OrmLiteAuthRepository(container.Resolve<IDbConnectionFactory>());
            container.Register<IUserAuthRepository>(userRep);
            var redisCon = ConfigurationManager.AppSettings["redisUrl"].ToString();
            container.Register<IRedisClientsManager>(new PooledRedisClientManager(20, 60, redisCon));
            container.Register<ICacheClient>(c => (ICacheClient)c.Resolve<IRedisClientsManager>().GetCacheClient());

            userRep.CreateMissingTables();
            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }
Пример #23
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.NavigationMode == NavigationMode.New)
            {
                IDictionary<string, string> parameters = this.NavigationContext.QueryString;
                if (parameters.ContainsKey("ONLINE"))
                {
                    offline = false;
                }

                dat = new AppSettings();
                String regno;
                bool firstRun;

                firstRun = dat.TryGetSetting<string>("REGNO", out regno);

                //CHECK IF FIRST RUN
                if (firstRun)
                {
                    loadData();

                    //CHECK IF ONLINE OR OFFLINE
                    if (offline) { dat.StoreSetting("OFFLINE", Convert.ToString(offline)); App.ViewModel.LoadData(); }
                    else { offline = false; show_captcha(); }
                }

                else { Controller.DefaultItem = Controller.Items[2]; offline = false; }
            }
        }
Пример #24
0
 public VkontakteLoginViewModel(
     INavigationService navigationService,
     AppSettings appSettings,
     UsersRestService usersRestService)
     : base(navigationService, appSettings, usersRestService)
 {
 }
Пример #25
0
        // 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();
        }
Пример #26
0
 public ProfileLoader(IFileSystem fileSystem, IDirectorySystem directorySystem, IAppDirectoriesBuilder appDirBuilder, AppSettings settings)
 {
     _fileSystem = fileSystem;
     _directorySystem = directorySystem;
     _appDirBuilder = appDirBuilder;
     _settings = settings;
 }
Пример #27
0
        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());
        }
Пример #28
0
 public MainPage()
 {
     this.InitializeComponent();
     this.NavigationCacheMode = NavigationCacheMode.Required;
     _settings = new AppSettings();
     UIHelper.ShowSystemTrayAsync(Color.FromArgb(255, 48, 169, 62), Colors.White);
 }
        public void And_connection_string_does_not_exist_Then_connection_string_should_be_stored()
        {
            var settings = new AppSettings("NonExistingFile", FileOption.None);
            settings.SetConnectionString("cs", "a");

            Assert.AreEqual("a", settings.GetConnectionString("cs"));
        }
        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;
            }

        }
Пример #31
0
 public UserService(IOptions <AppSettings> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Пример #32
0
 public TokenService(IOptions <AppSettings> appSettings, UserManager <Useraquito> userManager)
 {
     _appSettings = appSettings.Value;
     _userManager = userManager;
 }
Пример #33
0
 public HomeController(AppSettings appSettings)
 {
     _appSettings = appSettings;
 }
Пример #34
0
 public UsuariosController(IUsuariosApplication _Application,
                           IOptions <AppSettings> appSettings)
 {
     this._Application = _Application;
     _appSettings      = appSettings.Value;
 }
Пример #35
0
        private void addButton_Click(object sender, EventArgs e)
        {
            var hostnameValidation    = UserInputValidator.ValidateNetworkHostname(hostnameTextBox.Text);
            var portValidation        = UserInputValidator.ValidateNetworkPortNumber(portTextBox.Text);
            var apiKeyValidation      = UserInputValidator.ValidateSyncthingApiKey(apiKeyTextBox.Text);
            var displayNameValidation = UserInputValidator.ValidateSyncthingDisplayName(customNameTextBox.Text);

            var errorMessages = new List <string>();

            // Validate port number
            if (!portValidation.IsValid)
            {
                errorMessages.Add(portValidation.Message);
            }

            // Validate hostname
            if (!hostnameValidation.IsValid)
            {
                errorMessages.Add(hostnameValidation.Message);
            }

            // Validate API key
            if (!apiKeyValidation.IsValid)
            {
                errorMessages.Add(apiKeyValidation.Message);
            }

            if (errorMessages.Count > 0)
            {
                MetroMessageBox.Show(this, String.Join(Environment.NewLine, errorMessages),
                                     "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            var instance = new ManagedInstance
            {
                UseHttps = useHttpsToggle.Checked,
                ApiKey   = apiKeyValidation.ValidatedValue
            };

            instance.PossibleEndpoints.Add(new RestEndpoint
            {
                Hostname   = hostnameValidation.ValidatedValue,
                Port       = portValidation.ValidatedValue,
                Priority   = 100,
                IsPingable = true
            });

            // Assign display name
            if (displayNameValidation.IsValid)
            {
                instance.CustomName = customNameTextBox.Text.Trim();
            }

            Log.Logger.Information("New Syncthing instance created: {@Instance}", instance);

            Singleton <SyncthingInstanceManager> .Instance.Add(instance);

            AppSettings.Save(ParentForm);

            Close();
        }
Пример #36
0
 public AuthFilter(IOptions <AppSettings> appSettings)
 {
     _appSettings = appSettings?.Value;
 }
Пример #37
0
 public HomeController(IOptions <AppSettings> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Пример #38
0
 public UserController(IUserServices userServices,
                       IOptions <AppSettings> appSettings)
 {
     _userServices = userServices;
     _appSettings  = appSettings.Value;
 }
Пример #39
0
 public IndexModel(IOptions <AppSettings> settings)
 {
     AppSettings = settings.Value;
 }
Пример #40
0
 public AzAppConfigurationController(IOptionsSnapshot <AppSettings> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Пример #41
0
 public ViewMeetingRepository(
     IOptions <AppSettings> config
     )
 {
     _config = config.Value;
 }
Пример #42
0
 public BaseService(IOptionsSnapshot <AppSettings> settings, IEngine engine)
 {
     _settings = settings.Value;
     _engine   = engine;
 }
Пример #43
0
 public ValuesController(IOptions <AppSettings> settings)
 {
     AppSettings          = settings.Value;
     RedisHelp.REDIS_HOST = AppSettings.REDIS_HOST;
 }
 public OrdersController(IOptions<AppSettings> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Пример #45
0
 public UserRepository(ConnectionString connectionString, AppSettings appSettings)
 {
     ConnectionString = connectionString.Value;
     _appSettings     = appSettings;
 }
Пример #46
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="logger">ロガー</param>
 /// <param name="timePrivder">DateTimeの提供元</param>
 /// <param name="dbPolly">DB接続用のPolly</param>
 /// <param name="appSettings">アプリケーション設定</param>
 public DtAlmilogAnalysisResultRepository(ILogger <DtAlmilogAnalysisResultRepository> logger, ITimeProvider timePrivder, DBPolly dbPolly, AppSettings appSettings)
 {
     Assert.IfNull(logger);
     Assert.IfNull(timePrivder);
     Assert.IfNull(dbPolly);
     Assert.IfNull(appSettings);
     _logger      = logger;
     _timePrivder = timePrivder;
     _dbPolly     = dbPolly;
     _appSettings = appSettings;
 }
Пример #47
0
        /// <summary>
        /// Compare a fileIndex item and update items if there are changed in the updateObject
        /// append => (propertyName == "Tags" add it with comma space or with single space)
        /// </summary>
        /// <param name="sourceIndexItem">the source object</param>
        /// <param name="updateObject">the item with changed values</param>
        /// <returns>list of changed types</returns>
        public static List <string> Compare(AppSettings sourceIndexItem, object updateObject = null)
        {
            if (updateObject == null)
            {
                updateObject = new AppSettings();
            }
            PropertyInfo[] propertiesA = sourceIndexItem.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
            PropertyInfo[] propertiesB = updateObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

            var differenceList = new List <string>();

            foreach (var propertyB in propertiesB)
            {
                // only for when TransferObject is Nullable<bool> and AppSettings is bool
                var propertyInfoFromA = propertiesA.FirstOrDefault(p => p.Name == propertyB.Name);
                if (propertyInfoFromA == null)
                {
                    continue;
                }
                if (propertyInfoFromA.PropertyType == typeof(bool?) && propertyB.PropertyType == typeof(bool?))
                {
                    var oldBoolValue = (bool?)propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newBoolValue = (bool?)propertyB.GetValue(updateObject, null);
                    CompareBool(propertyB.Name, sourceIndexItem, oldBoolValue, newBoolValue, differenceList);
                }

                if (propertyB.PropertyType == typeof(string))
                {
                    var oldStringValue = (string)propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newStringValue = (string)propertyB.GetValue(updateObject, null);
                    CompareString(propertyB.Name, sourceIndexItem, oldStringValue, newStringValue, differenceList);
                }

                if (propertyB.PropertyType == typeof(int))
                {
                    var oldIntValue = (int)propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newIntValue = (int)propertyB.GetValue(updateObject, null);
                    CompareInt(propertyB.Name, sourceIndexItem, oldIntValue, newIntValue, differenceList);
                }

                if (propertyB.PropertyType == typeof(AppSettings.DatabaseTypeList))
                {
                    var oldListStringValue = (AppSettings.DatabaseTypeList)propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newListStringValue = (AppSettings.DatabaseTypeList)propertyB.GetValue(updateObject, null);
                    CompareDatabaseTypeList(propertyB.Name, sourceIndexItem, oldListStringValue,
                                            newListStringValue, differenceList);
                }

                if (propertyB.PropertyType == typeof(List <string>))
                {
                    var oldListStringValue = (List <string>)propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newListStringValue = (List <string>)propertyB.GetValue(updateObject, null);
                    CompareListString(propertyB.Name, sourceIndexItem, oldListStringValue,
                                      newListStringValue, differenceList);
                }

                if (propertyB.PropertyType == typeof(Dictionary <string, List <AppSettingsPublishProfiles> >))
                {
                    var oldListPublishProfilesValue = (Dictionary <string, List <AppSettingsPublishProfiles> >)
                                                      propertyInfoFromA.GetValue(sourceIndexItem, null);
                    var newListPublishProfilesValue = (Dictionary <string, List <AppSettingsPublishProfiles> >)
                                                      propertyB.GetValue(updateObject, null);
                    CompareListPublishProfiles(propertyB.Name, sourceIndexItem, oldListPublishProfilesValue,
                                               newListPublishProfilesValue, differenceList);
                }
            }
            return(differenceList);
        }
Пример #48
0
 public HubController(IOptions <AppSettings> _appSettingsOptions)
 {
     this.appSettings = _appSettingsOptions.Value;
 }
Пример #49
0
        public void DoDump(object sender, DoWorkEventArgs e)
        {
            _bw = (BackgroundWorker)sender;
            string argument = string.Empty;

            string status = Processing.GetResourceString("mplayer_dump_status");
            
            _bw.ReportProgress(-10, status);
            _bw.ReportProgress(0, status);

            using (Process encoder = new Process())
            {
                if (_jobInfo.Input == InputType.InputDvd)
                {
                    string dumpOutput =
                        Processing.CreateTempFile(
                            string.IsNullOrEmpty(_jobInfo.TempOutput) ? _jobInfo.OutputFile : _jobInfo.TempOutput,
                            "dump.mpg");

                    _jobInfo.DumpOutput = dumpOutput;

                    string chapterText = string.Empty;
                    if (_jobInfo.SelectedDvdChapters.Length > 0)
                    {
                        int posMinus = _jobInfo.SelectedDvdChapters.IndexOf('-');
                        chapterText = string.Format(posMinus == -1 ? "-chapter {0}-{0}" : "-chapter {0}",
                                                    _jobInfo.SelectedDvdChapters);
                    }

                    string inputFile = _jobInfo.InputFile;

                    if (string.IsNullOrEmpty(Path.GetDirectoryName(inputFile)))
                    {
                        int pos = inputFile.LastIndexOf(Path.DirectorySeparatorChar);
                        inputFile = inputFile.Remove(pos);
                    }

                    argument +=
                        string.Format("-dvd-device \"{0}\" dvdnav://{1:g} {3} -nocache -dumpstream -dumpfile \"{2}\"",
                                      inputFile, _jobInfo.TrackId, dumpOutput, chapterText);
                }

                string localExecutable = Path.Combine(AppSettings.ToolsPath, Executable);

                ProcessStartInfo parameter = new ProcessStartInfo(localExecutable)
                    {
                        Arguments = argument,
                        CreateNoWindow = true,
                        UseShellExecute = false,
                        RedirectStandardOutput = true
                    };

                encoder.StartInfo = parameter;

                encoder.OutputDataReceived += OnDataReceived;

                Log.InfoFormat("mplayer {0:s}", argument);

                bool started;
                try
                {
                    started = encoder.Start();
                }
                catch (Exception ex)
                {
                    started = false;
                    Log.ErrorFormat("mplayer exception: {0}", ex);
                    _jobInfo.ExitCode = -1;
                }

                if (started)
                {
                    encoder.PriorityClass = AppSettings.GetProcessPriority();
                    encoder.BeginOutputReadLine();

                    _bw.ReportProgress(-1, status);

                    while (!encoder.HasExited)
                    {
                        if (_bw.CancellationPending)
                            encoder.Kill();
                        Thread.Sleep(200);
                    }
                    encoder.WaitForExit(10000);
                    encoder.CancelOutputRead();

                    _jobInfo.ExitCode = encoder.ExitCode;
                    Log.InfoFormat("Exit Code: {0:g}", _jobInfo.ExitCode);
                }
            }
            _bw.ReportProgress(100);
            _jobInfo.CompletedStep = _jobInfo.NextStep;

            e.Result = _jobInfo;

        }
Пример #50
0
 public QueryRequestDb(IOptions <AppSettings> appSettings)
 {
     _appSettings = appSettings.Value;
 }
Пример #51
0
 public AuthController(SignInManager <IdentityUser> signInManager, UserManager <IdentityUser> userManager, IOptions <AppSettings> appSettings)
 {
     _signInManager = signInManager;
     _userManager   = userManager;
     _appSettings   = appSettings.Value;
 }
Пример #52
0
        public async static Task <bool> ValidateToken(string authToken)
        {
            try
            {
                // string decodedToken = Encoding.UTF8.GetString(Convert.FromBase64String(authToken));


                string decodedToken = Authentication.Base64Decode(authToken);
                string userName     = decodedToken.Substring(0, decodedToken.IndexOf(":"));
                string password     = decodedToken.Substring(decodedToken.IndexOf(":") + 1);

                // bool result = true;
                string output = await Authentication.CRMAuthenticate(userName, password, AppSettings.GetByKey("DOMAIN"));

                if (output != null && output != string.Empty)
                {
                    SoapCredential.UserName = userName;
                    SoapCredential.Password = password;
                    SoapCredential.Password = AppSettings.GetByKey("DOMAIN");
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(false);
        }
 public ServiceBusSupport(ITopicClientFactory topicClientFactory, AppSettings appSettings)
 {
     this.topicClientFactory = topicClientFactory;
     this.appSettings        = appSettings;
 }
        /// <summary>
        /// Register services and interfaces
        /// </summary>
        /// <param name="services">Collection of service descriptors</param>
        /// <param name="typeFinder">Type finder</param>
        /// <param name="appSettings">App settings</param>
        public virtual void Register(IServiceCollection services, ITypeFinder typeFinder, AppSettings appSettings)
        {
            //installation localization service
            services.AddScoped <IInstallationLocalizationService, InstallationLocalizationService>();

            //common factories
            services.AddScoped <IAclSupportedModelFactory, AclSupportedModelFactory>();
            services.AddScoped <IDiscountSupportedModelFactory, DiscountSupportedModelFactory>();
            services.AddScoped <ILocalizedModelFactory, LocalizedModelFactory>();
            services.AddScoped <IStoreMappingSupportedModelFactory, StoreMappingSupportedModelFactory>();

            //admin factories
            services.AddScoped <IBaseAdminModelFactory, BaseAdminModelFactory>();
            services.AddScoped <IActivityLogModelFactory, ActivityLogModelFactory>();
            services.AddScoped <IAddressModelFactory, AddressModelFactory>();
            services.AddScoped <IAddressAttributeModelFactory, AddressAttributeModelFactory>();
            services.AddScoped <IAffiliateModelFactory, AffiliateModelFactory>();
            services.AddScoped <IBlogModelFactory, BlogModelFactory>();
            services.AddScoped <ICampaignModelFactory, CampaignModelFactory>();
            services.AddScoped <ICategoryModelFactory, CategoryModelFactory>();
            services.AddScoped <ICheckoutAttributeModelFactory, CheckoutAttributeModelFactory>();
            services.AddScoped <ICommonModelFactory, CommonModelFactory>();
            services.AddScoped <ICountryModelFactory, CountryModelFactory>();
            services.AddScoped <ICurrencyModelFactory, CurrencyModelFactory>();
            services.AddScoped <ICustomerAttributeModelFactory, CustomerAttributeModelFactory>();
            services.AddScoped <ICustomerModelFactory, CustomerModelFactory>();
            services.AddScoped <ICustomerRoleModelFactory, CustomerRoleModelFactory>();
            services.AddScoped <IDiscountModelFactory, DiscountModelFactory>();
            services.AddScoped <IEmailAccountModelFactory, EmailAccountModelFactory>();
            services.AddScoped <IExternalAuthenticationMethodModelFactory, ExternalAuthenticationMethodModelFactory>();
            services.AddScoped <IForumModelFactory, ForumModelFactory>();
            services.AddScoped <IGiftCardModelFactory, GiftCardModelFactory>();
            services.AddScoped <IHomeModelFactory, HomeModelFactory>();
            services.AddScoped <ILanguageModelFactory, LanguageModelFactory>();
            services.AddScoped <ILogModelFactory, LogModelFactory>();
            services.AddScoped <IManufacturerModelFactory, ManufacturerModelFactory>();
            services.AddScoped <IMeasureModelFactory, MeasureModelFactory>();
            services.AddScoped <IMessageTemplateModelFactory, MessageTemplateModelFactory>();
            services.AddScoped <IMultiFactorAuthenticationMethodModelFactory, MultiFactorAuthenticationMethodModelFactory>();
            services.AddScoped <INewsletterSubscriptionModelFactory, NewsletterSubscriptionModelFactory>();
            services.AddScoped <INewsModelFactory, NewsModelFactory>();
            services.AddScoped <IOrderModelFactory, OrderModelFactory>();
            services.AddScoped <IPaymentModelFactory, PaymentModelFactory>();
            services.AddScoped <IPluginModelFactory, PluginModelFactory>();
            services.AddScoped <IPollModelFactory, PollModelFactory>();
            services.AddScoped <IProductModelFactory, ProductModelFactory>();
            services.AddScoped <IProductAttributeModelFactory, ProductAttributeModelFactory>();
            services.AddScoped <IProductReviewModelFactory, ProductReviewModelFactory>();
            services.AddScoped <IReportModelFactory, ReportModelFactory>();
            services.AddScoped <IQueuedEmailModelFactory, QueuedEmailModelFactory>();
            services.AddScoped <IRecurringPaymentModelFactory, RecurringPaymentModelFactory>();
            services.AddScoped <IReturnRequestModelFactory, ReturnRequestModelFactory>();
            services.AddScoped <IReviewTypeModelFactory, ReviewTypeModelFactory>();
            services.AddScoped <IScheduleTaskModelFactory, ScheduleTaskModelFactory>();
            services.AddScoped <ISecurityModelFactory, SecurityModelFactory>();
            services.AddScoped <ISettingModelFactory, SettingModelFactory>();
            services.AddScoped <IShippingModelFactory, ShippingModelFactory>();
            services.AddScoped <IShoppingCartModelFactory, ShoppingCartModelFactory>();
            services.AddScoped <ISpecificationAttributeModelFactory, SpecificationAttributeModelFactory>();
            services.AddScoped <IStoreModelFactory, StoreModelFactory>();
            services.AddScoped <ITaxModelFactory, TaxModelFactory>();
            services.AddScoped <ITemplateModelFactory, TemplateModelFactory>();
            services.AddScoped <ITopicModelFactory, TopicModelFactory>();
            services.AddScoped <IVendorAttributeModelFactory, VendorAttributeModelFactory>();
            services.AddScoped <IVendorModelFactory, VendorModelFactory>();
            services.AddScoped <IWidgetModelFactory, WidgetModelFactory>();

            //factories
            services.AddScoped <Factories.IAddressModelFactory, Factories.AddressModelFactory>();
            services.AddScoped <Factories.IBlogModelFactory, Factories.BlogModelFactory>();
            services.AddScoped <Factories.ICatalogModelFactory, Factories.CatalogModelFactory>();
            services.AddScoped <Factories.ICheckoutModelFactory, Factories.CheckoutModelFactory>();
            services.AddScoped <Factories.ICommonModelFactory, Factories.CommonModelFactory>();
            services.AddScoped <Factories.ICountryModelFactory, Factories.CountryModelFactory>();
            services.AddScoped <Factories.ICustomerModelFactory, Factories.CustomerModelFactory>();
            services.AddScoped <Factories.IForumModelFactory, Factories.ForumModelFactory>();
            services.AddScoped <Factories.IExternalAuthenticationModelFactory, Factories.ExternalAuthenticationModelFactory>();
            services.AddScoped <Factories.INewsModelFactory, Factories.NewsModelFactory>();
            services.AddScoped <Factories.INewsletterModelFactory, Factories.NewsletterModelFactory>();
            services.AddScoped <Factories.IOrderModelFactory, Factories.OrderModelFactory>();
            services.AddScoped <Factories.IPollModelFactory, Factories.PollModelFactory>();
            services.AddScoped <Factories.IPrivateMessagesModelFactory, Factories.PrivateMessagesModelFactory>();
            services.AddScoped <Factories.IProductModelFactory, Factories.ProductModelFactory>();
            services.AddScoped <Factories.IProfileModelFactory, Factories.ProfileModelFactory>();
            services.AddScoped <Factories.IReturnRequestModelFactory, Factories.ReturnRequestModelFactory>();
            services.AddScoped <Factories.IShoppingCartModelFactory, Factories.ShoppingCartModelFactory>();
            services.AddScoped <Factories.ITopicModelFactory, Factories.TopicModelFactory>();
            services.AddScoped <Factories.IVendorModelFactory, Factories.VendorModelFactory>();
            services.AddScoped <Factories.IWidgetModelFactory, Factories.WidgetModelFactory>();
        }
Пример #55
0
 public JapaneseSegmenterClient(AppSettings appSettings)
 {
     this.appSettings = appSettings;
     this.httpClient  = new HttpClient();
 }
Пример #56
0
 public UserService(IOptions <AppSettings> appSettings, AuthenticationShopContext context, IHttpContextAccessor httpContextAccessor)
 {
     _appSettings         = appSettings.Value;
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
 }
 public MaterialLiquiController(IOptions <AppSettings> settings)
 {
     _settings = settings.Value;
 }
Пример #58
0
 public OrderingService(IOptions <AppSettings> settings, HttpClient httpClient)
 {
     this.appSettings = settings.Value;
     this.apiClient   = httpClient;
 }
 public UsuarioController(IOptions <AppSettings> appSettings, ApiContext context)
 {
     _appSettings = appSettings.Value;
     _db          = context;
 }
Пример #60
0
 public JwtAuthenticationManager(IOptions <AppSettings> appSettings, IUserRepository userRepository)
 {
     _appSettings    = appSettings.Value;
     _userRepository = userRepository;
 }