コード例 #1
0
		/// <summary>
		/// Adds the specified event args e.
		/// </summary>
		/// <param name="e">The <see cref="Altaxo.Main.SelfAccumulateableEventArgs" /> instance containing the event data.</param>
		/// <exception cref="System.ArgumentOutOfRangeException">
		/// Argument e should be of type SimpleCollectionChangedEventArgs
		/// or
		/// Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.
		/// </exception>
		public override void Add(SelfAccumulateableEventArgs e)
		{
			var other = e as SimpleCollectionChangedEventArgs;
			if (other == null)
				throw new ArgumentOutOfRangeException("Argument e should be of type SimpleCollectionChangedEventArgs");
			if (!object.ReferenceEquals(this.Originator, other.Originator))
				throw new ArgumentOutOfRangeException("Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.");
		}
コード例 #2
0
ファイル: InstanceChangedEvent.cs プロジェクト: Altaxo/Altaxo
		public override void Add(SelfAccumulateableEventArgs e)
		{
			if (e == null)
				throw new ArgumentNullException("e");
			var other = e as InstanceChangedEventArgs;
			if (null == other)
				throw new ArgumentException("e is not of type: " + this.GetType().Name);
			if (!object.ReferenceEquals(this._newObject, other._oldObject))
				throw new ArgumentException("this.NewObject should be other.OldObject, but this is not the case. The overrides for GetHashCode and Equals should ensure this. Please debug.");

			this._newObject = other._newObject;
		}
コード例 #3
0
        /// <summary>
        /// Adds the specified event args e.
        /// </summary>
        /// <param name="e">The <see cref="Altaxo.Main.SelfAccumulateableEventArgs" /> instance containing the event data.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// Argument e should be of type SimpleCollectionChangedEventArgs
        /// or
        /// Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.
        /// </exception>
        public override void Add(SelfAccumulateableEventArgs e)
        {
            var other = e as SimpleCollectionChangedEventArgs;

            if (other == null)
            {
                throw new ArgumentOutOfRangeException("Argument e should be of type SimpleCollectionChangedEventArgs");
            }
            if (!object.ReferenceEquals(Originator, other.Originator))
            {
                throw new ArgumentOutOfRangeException("Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.");
            }
        }
コード例 #4
0
        public override void Add(SelfAccumulateableEventArgs e)
        {
            var other = e as NamedObjectCollectionChangedEventArgs;

            if (other == null)
            {
                throw new ArgumentOutOfRangeException("Argument e should be of type NamedObjectCollectionEventArgs");
            }
            if (!object.ReferenceEquals(_item, other._item))
            {
                throw new ArgumentOutOfRangeException("Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.");
            }

            // MultipleChanges overrrides everything
            if (_operation.HasFlag(NamedObjectCollectionChangeType.MultipleChanges))
            {
                return;
            }
            if (other._operation.HasFlag(NamedObjectCollectionChangeType.MultipleChanges))
            {
                _operation   = NamedObjectCollectionChangeType.MultipleChanges;
                _item        = MultipleChangesItem;
                _newItemName = null;
                _oldItemName = null;
                return;
            }

            // Normal changes

            _newItemName = other._newItemName;
            _operation  |= other._operation;

            if (other._operation.HasFlag(NamedObjectCollectionChangeType.ItemAdded))
            {
                _operation = _operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemRemoved);
                if (_oldItemName != _newItemName)
                {
                    _operation = _operation.WithSetFlag(NamedObjectCollectionChangeType.ItemRenamed);
                }
            }
            else if (other._operation.HasFlag(NamedObjectCollectionChangeType.ItemRemoved))
            {
                _operation = _operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemAdded);
                _operation = _operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemRenamed);
            }
        }
コード例 #5
0
        public override void Add(SelfAccumulateableEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            var other = e as InstanceChangedEventArgs;

            if (null == other)
            {
                throw new ArgumentException("e is not of type: " + GetType().Name);
            }
            if (!object.ReferenceEquals(_newObject, other._oldObject))
            {
                throw new ArgumentException("this.NewObject should be other.OldObject, but this is not the case. The overrides for GetHashCode and Equals should ensure this. Please debug.");
            }

            _newObject = other._newObject;
        }
コード例 #6
0
		public override void Add(SelfAccumulateableEventArgs e)
		{
			var other = e as NamedObjectCollectionChangedEventArgs;
			if (other == null)
				throw new ArgumentOutOfRangeException("Argument e should be of type NamedObjectCollectionEventArgs");
			if (!object.ReferenceEquals(this._item, other._item))
				throw new ArgumentOutOfRangeException("Argument e has an item which is not identical to this item. This should not happen since Equals and GetHashCode are overriden.");

			// MultipleChanges overrrides everything
			if (this._operation.HasFlag(NamedObjectCollectionChangeType.MultipleChanges))
				return;
			if (other._operation.HasFlag(NamedObjectCollectionChangeType.MultipleChanges))
			{
				this._operation = NamedObjectCollectionChangeType.MultipleChanges;
				this._item = MultipleChangesItem;
				this._newItemName = null;
				this._oldItemName = null;
				return;
			}

			// Normal changes

			this._newItemName = other._newItemName;
			this._operation |= other._operation;

			if (other._operation.HasFlag(NamedObjectCollectionChangeType.ItemAdded))
			{
				this._operation = this._operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemRemoved);
				if (_oldItemName != _newItemName)
					this._operation = this._operation.WithSetFlag(NamedObjectCollectionChangeType.ItemRenamed);
			}
			else if (other._operation.HasFlag(NamedObjectCollectionChangeType.ItemRemoved))
			{
				this._operation = this._operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemAdded);
				this._operation = this._operation.WithClearedFlag(NamedObjectCollectionChangeType.ItemRenamed);
			}
		}
コード例 #7
0
		/// <summary>
		/// Adds the specified event args e.
		/// </summary>
		/// <param name="e">The <see cref="Altaxo.Main.SelfAccumulateableEventArgs"/> instance containing the event data.</param>
		public abstract void Add(SelfAccumulateableEventArgs e);
コード例 #8
0
		public override void Add(SelfAccumulateableEventArgs e)
		{
		}
コード例 #9
0
 /// <summary>
 /// Adds the specified event args e.
 /// </summary>
 /// <param name="e">The <see cref="Altaxo.Main.SelfAccumulateableEventArgs"/> instance containing the event data.</param>
 public abstract void Add(SelfAccumulateableEventArgs e);