示例#1
0
        private void OnVariableChanged(string propertyName, PythonVariableChangedAction action = PythonVariableChangedAction.Change)
        {
            PythonVariableChangedEventHandler handler = PropertyChanged;

            if (handler == null)
            {
                return;
            }
            handler(this, new PythonVariableChangedEventArgs(propertyName, action));
            ListChangedType changedType;

            switch (action)
            {
            case PythonVariableChangedAction.Add:
                changedType = ListChangedType.ItemAdded;
                break;

            case PythonVariableChangedAction.Delete:
                changedType = ListChangedType.ItemDeleted;
                break;

            default:
                changedType = ListChangedType.ItemChanged;
                break;
            }
            int index = this.Scope.GetVariableNames().ToList().IndexOf(propertyName);
            ListChangedEventArgs args = new ListChangedEventArgs(changedType, index);

            OnListChanged(args);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.ComponentModel.PropertyChangedEventArgs"/> class.
 /// </summary>
 /// <param name="propertyName">The name of the property that changed. </param>
 /// <param name="action">What happened</param>
 public PythonVariableChangedEventArgs(string propertyName, PythonVariableChangedAction action)
     : base(propertyName)
 {
     _action = action;
 }