/// <summary>
        /// Initializes a new instance of TextEditorOptions by copying all values
        /// from <paramref name="options"/> to the new instance.
        /// </summary>
        public TextEditorOptions(TextEditorOptions options)
        {
            // get all the fields in the class
            FieldInfo[] fields = typeof(TextEditorOptions).GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

            // copy each value over to 'this'
            foreach(FieldInfo fi in fields) {
                if (!fi.IsNotSerialized)
                    fi.SetValue(this, fi.GetValue(options));
            }
        }
Example #2
0
 void OnOptionsChanged(TextEditorOptions oldValue, TextEditorOptions newValue)
 {
     if (oldValue != null)
     {
         PropertyChangedWeakEventManager.RemoveListener(oldValue, this);
     }
     textArea.Options = newValue;
     if (newValue != null)
     {
         PropertyChangedWeakEventManager.AddListener(newValue, this);
     }
     OnOptionChanged(new PropertyChangedEventArgs(null));
 }