public void SetUp()
        {
            var resolver = ObjectResolver.Basic();

            theSource = new FolderAppSettingsXmlSource("Configuration");
            theProvider = new SettingsProvider(resolver, new ISettingsSource[]{theSource});
        }
        public override void Configure(Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            Plugins.Add(new SwaggerFeature());
            var manager = new InsteonManager(insteonSource);
            container.Register(manager);
            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Insteon"));
            var mySettings = settingsProvider.GetSettings<SmartThingsSettings>();

            container.Register(mySettings);

            manager.Network.Devices.DeviceStatusChanged += (sender, data) =>
            {
                logger.DebugFormat("{0}:{1}", data.Device.Address, data.DeviceStatus);
                var settings = container.Resolve<SmartThingsSettings>();
                var cb = new SmartThingsCallbacks(settings);
                cb.PushDeviceStatusUpdate(data.Device, data.DeviceStatus);
            };

            GlobalResponseFilters.Add((req, res, dto) =>
            {

                res.AddHeader("X-Insteon", ServiceName);

            });

            manager.Connect();

        }
 public SchedulerModel()
 {
     ControlDropCommand = new DropCommand(Command_OnDrop);
     SettingsProvider provider = new SettingsProvider();
     provider.SettingsLoaded += OnSettingsLoaded;
     provider.RequestSettings("");
 }
        /// <summary>
        /// Given certain conditions.
        /// </summary>
        protected override void Given()
        {
            titleProvider.Setup(a => a.Title).Returns("Test");
            descriptionProvider.Setup(a => a.Description).Returns("Description");

            classUnderTest = new SettingsProvider(titleProvider.Object, descriptionProvider.Object);
        }
 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<SmartThingsSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.RegisterAs<SmartThingsCallbacks, IParadoxEventCallbacks>();
 }
        private static void RegisterEverything()
        {
            var settingsProvider = new SettingsProvider(Environment.CurrentDirectory + SettingsPath);
            ServiceLocator.AddService<SettingsProvider>(settingsProvider);

            var drawer = new ConsolePrinter();
            ServiceLocator.AddService<IDrawer>(drawer);
        }
 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<ParadoxMqttSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.Register(new MqttClient(mySettings.BrokerUrl));
     container.RegisterAs<MqttCallbacks, IParadoxEventCallbacks>().ReusedWithin(ReuseScope.Container);
 }
        public object GetKey(string key)
        {
            IEnumerable<ISettingsSource> sources = new[]{new SettingsSource(new []{Data})};
            var sp = new SettingsProvider(null, sources);

            var result = sp.SettingFor(key);

            return result;
        }
        public void CalledApplicationEntity_ReturnsExpectedValue()
        {
            // Arrange
            SettingsProvider settingsProvider = new SettingsProvider();

            // Act
            var result = settingsProvider.CalledApplicationEntity;

            // Assert
            Assert.That(result, Is.EqualTo("ORTHANC"));
        }
        public void RemoteAddress_ReturnsExpectedValue()
        {
            // Arrange
            SettingsProvider settingsProvider = new SettingsProvider();

            // Act
            var result = settingsProvider.RemoteAddress;

            // Assert
            Assert.That(result, Is.EqualTo("127.0.0.1"));
        }
        public void LocalPort_ReturnsExpectedValue()
        {
            // Arrange
            SettingsProvider settingsProvider = new SettingsProvider();

            // Act
            var result = settingsProvider.LocalPort;

            // Assert
            Assert.That(result, Is.EqualTo(104));
        }
        public void DestinationApplicationEntity_ReturnsExpectedValue()
        {
            // Arrange
            SettingsProvider settingsProvider = new SettingsProvider();

            // Act
            var result = settingsProvider.DestinationApplicationEntity;

            // Assert
            Assert.That(result, Is.EqualTo("TAUCO"));
        }
        public void MethodArgumentsTest()
        {
            var provider = new SettingsProvider();
            var settings = new TestSettings() { Test = "Test1" };

            AssertHelper.ExpectedException<ArgumentNullException>(() => provider.SaveSettings(testSettingsPath, null));
            AssertHelper.ExpectedException<ArgumentException>(() => provider.SaveSettings(null, settings));
            AssertHelper.ExpectedException<ArgumentException>(() => provider.SaveSettings("MockSettings.xml", settings));

            AssertHelper.ExpectedException<ArgumentException>(() => provider.LoadSettings<TestSettings>(null));
            AssertHelper.ExpectedException<ArgumentException>(() => provider.LoadSettings<TestSettings>("MockSettings.xml"));
        }
Exemple #14
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            //Use RoamingAppDataStorage if you have the package version of SettingsProvider.net package
            settingsProvider = new SettingsProvider(new LocalAppDataStorage("WindowsIncognito"));
            appSettings = settingsProvider.GetSettings<IncognitoSettings>();

            MainWindow mw = new MainWindow();
            softwareRepository = new SoftwareRepository();
            var viewModel = new MainWindowViewModel(appSettings, softwareRepository);
            mw.DataContext = viewModel;
            mw.Show();
        }
        public ResponseStatus Get(SmartThingsSettingsResetRequest request)
        {
            settings.AccessToken = null;
            settings.Location = null;
            settings.ApplicationId = null;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return !cb.AuthorizationRevoke() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus();
        }
Exemple #16
0
		/// <summary>
		/// Constructor for the Application object.
		/// </summary>
		public App()
		{
            // Ensure the current culture passed into bindings 
            // is the OS culture. By default, WPF uses en-US 
            // as the culture, regardless of the system settings.
            LocalizationManager.GlobalStringLoader = new TelerikStringLoader();
		    Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentUICulture;
		    Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture;

			var radDiagnostics = new RadDiagnostics();
			radDiagnostics.EmailTo = "[email protected]";
			radDiagnostics.IncludeScreenshot = true;
			radDiagnostics.Init();
			(App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color = Color.FromArgb(0xFF, 0xD2, 0xDA, 0x86);
			_settingsProvider = new SettingsProvider();
			// Global handler for uncaught exceptions. 
			UnhandledException += Application_UnhandledException;

			// Standard Silverlight initialization
			InitializeComponent();

			// Phone-specific initialization
			InitializePhoneApplication();

			// Show graphics profiling information while debugging.
			if (Debugger.IsAttached) {
				// Display the current frame rate counters.
				Current.Host.Settings.EnableFrameRateCounter = false;

				// Show the areas of the app that are being redrawn in each frame.
				//Application.Current.Host.Settings.EnableRedrawRegions = true;

				// Enable non-production analysis visualization mode, 
				// which shows areas of a page that are handed off to GPU with a colored overlay.
				//Application.Current.Host.Settings.EnableCacheVisualization = true;

				// Disable the application idle detection by setting the UserIdleDetectionMode property of the
				// application's PhoneApplicationService object to Disabled.
				// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
				// and consume battery power when the user is not using the phone.
				PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
			}
			TimeDataInterface.CheckDatabase();
			ReturnVisitsInterface.CheckDatabase();
			RvPreviousVisitsDataInterface.CheckDatabase();
			RBCTimeDataInterface.CheckDatabase();
		    TerritoryCardsInterface.CheckDatabase();
            StreetBuildingInterface.CheckDatabase();
            House2HouseRecordsInterface.CheckDatabase();
		}
        public ResponseStatus Put(SmartThingsSettingsRequest request)
        {
            // always reset values
            settings.AccessToken = request.AccessToken;
            settings.Location = request.Location;
            settings.ApplicationId = request.AppId;

            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
            settingsProvider.SaveSettings(settings);

            var cb = new SmartThingsCallbacks(settings);

            return !cb.Authorization() ? new ResponseStatus("404", "Couldn't connect to ST hub") : new ResponseStatus();
        }
        public void BasicSaveAndLoadTest()
        {
            var provider = new SettingsProvider();

            var defaultSettings = provider.LoadSettings<TestSettings>(testSettingsPath);
            Assert.AreEqual("Default", defaultSettings.Test);

            var settings1 = new TestSettings() { Test = "Test1" };
            provider.SaveSettings(testSettingsPath, settings1);

            var settings2 = provider.LoadSettings<TestSettings>(testSettingsPath);

            Assert.AreNotEqual(settings1, settings2);
            Assert.AreEqual(settings1.Test, settings2.Test);
        }
        public SettingsProviderTests()
        {
            applicationSettingsStore = Substitute.For<ISettingsStorage>();
            backingStore = new Dictionary<string, string>();
            applicationSettingsStore.Load("TestSettings.settings").Returns(backingStore);
            applicationSettingsStore
                .When(s=>s.Save("TestSettings.settings", Arg.Any<Dictionary<string, string>>()))
                .Do(c=>
                    {
                        backingStore.Clear();
                        foreach (var setting in c.Arg<Dictionary<string, string>>())
                        {
                            backingStore.Add(setting.Key, setting.Value);
                        }
                    });

            settingsRetreiver = new SettingsProvider(applicationSettingsStore);
            settingsSaver = new SettingsProvider(applicationSettingsStore);
        }
        static void Main()
        {
            #region Setting initialization
            settings = new SettingsProvider("settings.info");
            settings.AddSetting("PathToDiffEditor", @"D:\Program Files (x86)\WinMerge\WinMergeU.exe");
            #endregion

            #region Repository initialization
            repoProvider = new RepositoryProvider(SimpleLocalHistory.Program.settings);
            #endregion

            #region Service functionality

            host = new WebServiceHost(typeof(RepositoryService),
                                                     new Uri(settings.GetStrSettingByName("ServiceUri", "http://localhost:8181/")));

            ServiceEndpoint ep = host.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), "");
            //DEBUG
            ServiceDebugBehavior sdb = host.Description.Behaviors.Find<ServiceDebugBehavior>();
            sdb.HttpHelpPageEnabled = true;

            host.Open();
            #endregion

            #region Main App run

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm mainApp = new MainForm();

            mainApp.FormClosing += mainApp_FormClosing;

            Application.Run(mainApp);

            #endregion
        }
        public void SetUp()
        {
            theSource = new CentralizedSettingsSource("Configuration");

            theProvider = new SettingsProvider(ObjectResolver.Basic(), theSource.FindSettingData());
        }
 public SettingsProperty(string name, Type propertyType, SettingsProvider provider, bool isReadOnly, object defaultValue, SettingsSerializeAs serializeAs, SettingsAttributeDictionary attributes, bool throwOnErrorDeserializing, bool throwOnErrorSerializing)
 {
 }
 public void SetUp()
 {
     var resolver = ObjectResolver.Basic();
     _settingsSource = new TestSettingsSource();
     theProvider = new SettingsProvider(resolver, new[] { _settingsSource });
 }
 /// <summary>
 /// Given certain conditions.
 /// </summary>
 protected override void Given()
 {
     classUnderTest = new SettingsProvider(titleProvider.Object, descriptionProvider.Object);
 }
        public void RemotePort_ReturnsExpectedValue()
        {
            // Arrange
            SettingsProvider settingsProvider = new SettingsProvider();

            // Act
            var result = settingsProvider.RemotePort;

            // Assert
            Assert.That(result, Is.EqualTo(4242));
        }
 private void PopulateContent()
 {
     SettingsProvider settingsProvider = new SettingsProvider();
     settingsProvider.SettingsLoaded += OnSettingLoaded;
     settingsProvider.RequestSettings("");
 }
 private void readSettingsFromProfileDotConfigFile()
 {
     var settingsData = new FolderAppSettingsXmlSource(_deployedFolderProfilePath).FindSettingData();
     _settingsProvider = SettingsProvider.For(settingsData.ToArray());
 }
Exemple #28
0
        /// <summary>
        /// Saves all settings specified to the database.
        /// </summary>
        /// <param name="settings">Dictionary, which holds the settings as key-value pairs</param>
        public static void SetSettings(Dictionary<string, string> settings)
        {
            if (settings == null) return;

            SettingsProvider provider = new SettingsProvider();

            using (IDbTransaction transaction = Connection.BeginTransaction())
            {
                foreach (KeyValuePair<string, string> setting in settings)
                {
                    provider.SetValueRaw(setting.Value, setting.Key, transaction);
                }

                transaction.Commit();
            }
        }
 // Constructors
 public SettingsLoadedEventArgs(SettingsProvider provider)
 {
 }
 public SettingsProviderTests()
 {
     store = new TestStorage();
     settingsRetreiver = new SettingsProvider(store);
     settingsSaver = new SettingsProvider(store);
 }