예제 #1
0
 /// <summary>
 /// Reloads the application settings property values from persistent storage.
 /// </summary>
 public void Reload()
 {
     if (PropertyValues != null)
     {
         PropertyValues.Clear();
     }
 }
예제 #2
0
        /// <summary>
        /// Causes a reload to happen on next setting access, by clearing the cached values.
        /// </summary>
        public void Reload()
        {
            PropertyValues?.Clear();

            foreach (SettingsProperty sp in Properties)
            {
                PropertyChangedEventArgs pe = new PropertyChangedEventArgs(sp.Name);
                OnPropertyChanged(this, pe);
            }
        }
예제 #3
0
        /// <summary>
        /// Updates the PropertyValues dictionary
        /// </summary>
        internal void UpdatePropertyValues()
        {
            PropertyValues.Clear();

            foreach (string prop in Properties.Keys)
            {
                if (CssBox._properties.ContainsKey(prop))
                {
                    PropertyValues.Add(CssBox._properties[prop], Properties[prop]);
                }
            }
        }
        public void Reload()
        {
#if (CONFIGURATION_DEP)
            /* Clear out the old property values so they will be reloaded on request */
            if (PropertyValues != null)
            {
                PropertyValues.Clear();
            }
            foreach (SettingsProperty prop in Properties)
            {
                /* emit PropertyChanged for every property */
                OnPropertyChanged(this, new PropertyChangedEventArgs(prop.Name));
            }
#endif
        }
        public void PropertyValuesContainer()
        {
            PropertyValues properties = new PropertyValues();
            properties.Add("key1", "oleg");

            Assert.AreEqual(1, properties.GetCodes().Count);
            Assert.AreEqual(1, properties.GetValues("key1").Count);
            Assert.AreEqual("oleg", properties.GetValues("key1")[0]);
            Assert.AreEqual(0, properties.GetValues("key2").Count);

            properties.Add("key1", "shuruev");
            properties.Add("key2", "hello");

            Assert.AreEqual(2, properties.GetCodes().Count);
            Assert.AreEqual(2, properties.GetValues("key1").Count);
            Assert.AreEqual("oleg", properties.GetValues("key1")[0]);
            Assert.AreEqual("shuruev", properties.GetValues("key1")[1]);
            Assert.AreEqual(1, properties.GetValues("key2").Count);
            Assert.AreEqual("hello", properties.GetValues("key2")[0]);

            properties.Clear("key1");
            properties.Clear("key3");

            Assert.AreEqual(1, properties.GetCodes().Count);
            Assert.AreEqual(1, properties.GetValues("key2").Count);
            Assert.AreEqual("hello", properties.GetValues("key2")[0]);

            foreach (string word in this.emptyWords)
            {
                TestHelper.Throws(delegate
                {
                    properties.Add(word, "hello");
                });

                TestHelper.Throws(delegate
                {
                    properties.Add("key1", word);
                });
            }
        }