Exemplo n.º 1
0
 internal override void _optionsMgr_OptionsChanged(IOptions sender, OptionsChangedEventArgs ea)
 {
     _optionsMgr_OptionsChanged_TimesCalled++;
 }
Exemplo n.º 2
0
 internal void _optionsMgr_OptionsChanged(IOptions sender, OptionsChangedEventArgs ea)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
Exemplo n.º 3
0
 public void ApplyChanges(IDictionary<string, object> changes)
 {
     IList<string> changedOptions = new List<string>();
     _suppressOptionsChangedEvent = true;
     foreach (string name in changes.Keys)
     {
         if (Items[name] != changes[name])
         {
             Items[name] = changes[name];
             changedOptions.Add(name);
         }
     }
     _suppressOptionsChangedEvent = false;
     OptionsChangedEventArgs ea = new OptionsChangedEventArgs(changedOptions);
     OnOptionsChanged(ea);
 }
Exemplo n.º 4
0
        public object this[string name]
        {
            get { return _items[name]; }
            set
            {
                if (value!=null)
                {
                    object defaultVal = _defaults[name];
                    // TODO  log and throw custom exception
                    if (defaultVal.GetType() != value.GetType())
                        throw new InvalidOperationException("Value type must match default value type");
                }

                object oldVal = _items[name];
                _items[name] = value;

                if (oldVal != _items[name] && !_suppressOptionsChangedEvent)
                {
                    OptionsChangedEventArgs ea = new OptionsChangedEventArgs(new string[] {name});
                    OnOptionsChanged(ea);
                }
            }
        }
Exemplo n.º 5
0
 protected virtual void OnOptionsChanged(OptionsChangedEventArgs ea)
 {
     if (OptionsChanged != null)
         OptionsChanged(this, ea);
 }
Exemplo n.º 6
0
        public void Reset()
        {
            _suppressOptionsChangedEvent = true;

            IList<string> changedOptions = new List<string>();
            foreach (string name in _defaults.Keys)
            {
                if (_items[name] != _defaults[name])
                {
                    _items[name] = _defaults[name];
                    changedOptions.Add(name);
                }
            }

            _suppressOptionsChangedEvent = false;
            OptionsChangedEventArgs ea = new OptionsChangedEventArgs(changedOptions);
            OnOptionsChanged(ea);
        }
Exemplo n.º 7
0
        public void Reset(string [] namesOfChangedOptions)
        {
            if (namesOfChangedOptions!=null && namesOfChangedOptions.Length>0)
            {
                _suppressOptionsChangedEvent = true;
                for (int i = 0; i < namesOfChangedOptions.Length; i++)
                {
                    _items[namesOfChangedOptions[i]] = _defaults[namesOfChangedOptions[i]];
                }
                _suppressOptionsChangedEvent = false;

                OptionsChangedEventArgs ea = new OptionsChangedEventArgs(namesOfChangedOptions);
                OnOptionsChanged(ea);
            }
        }