Пример #1
0
		/// <summary>
		/// This event is fired whenever the column information is fired.
		/// </summary>
		/// <param name="sender">Who sent the event</param>
		/// <param name="args">What parameters where sent</param>
		private void OnColumnChange(object sender, SmartColumnValueCollectionEventArgs args)
		{
			if ( OnChanged!= null )
			{
				EventArgs e = new EventArgs();
				OnChanged(this, e);
			}
		}
		/// <summary>
		/// The Column Value has changed.
		/// </summary>
		/// <param name="sender">Who sent the event</param>
		/// <param name="e">What parameters where sent</param>
		private void OnColumnValueChange(object sender, EventArgs e)
		{
			SmartColumnValue sc = sender as SmartColumnValue;
			if ( sc != null && OnModified != null)
			{
				SmartColumnValueCollectionEventArgs args = new SmartColumnValueCollectionEventArgs(sc, SmartChangeType.Modified);
				OnModified(this, args);
			}
		}
		/// <summary>
		/// Add the new column value to the collection
		/// </summary>
		/// <param name="column">The column to be collected</param>
		/// <returns>The index position it was added to.</returns>
		public int Add(SmartColumnValue column)
		{
			int idx = -1;
			idx = List.Add(column);
			column.OnChange +=new EventHandler(OnColumnValueChange);
			if ( OnNew != null )
			{
				SmartColumnValueCollectionEventArgs args = new SmartColumnValueCollectionEventArgs(column, SmartChangeType.New);
				OnNew(this, args);
			}			
			return idx;
		}
Пример #4
0
		private void Columns_OnNew(object sender, SmartColumnValueCollectionEventArgs args)
		{
			Assert.IsNotNull(args, "The Smart Column Value Events object is null!");
		}
		/// <summary>
		/// Remove the specified column using the name provided
		/// </summary>
		/// <param name="name">Name to remove</param>
		public void Remove( string name )
		{
			int idx = IndexOf(name);
			if ( idx > -1 )
			{
				SmartColumnValue sc = this[name];
				List.RemoveAt(idx);
				if ( OnRemoved != null )
				{
					SmartColumnValueCollectionEventArgs args = new SmartColumnValueCollectionEventArgs(sc, SmartChangeType.Removed);
					OnRemoved(this, args);
				}
			}
		}
		/// <summary>
		/// Remove the specified column
		/// </summary>
		/// <param name="value">Column to be removed</param>
		public void Remove( SmartColumnValue value )  
		{
			List.Remove( value );
			if ( OnRemoved != null )
			{
				SmartColumnValueCollectionEventArgs args = new SmartColumnValueCollectionEventArgs(value, SmartChangeType.Removed);
				OnRemoved(this, args);
			}
		}
		/// <summary>
		/// Insert the column at the specified position
		/// </summary>
		/// <param name="index">Index position</param>
		/// <param name="value">The column to insearch</param>
		public void Insert( int index, SmartColumnValue value )  
		{
			List.Insert( index, value );
			value.OnChange +=new EventHandler(OnColumnValueChange);
			if ( OnInserted != null )
			{
				SmartColumnValueCollectionEventArgs args = new SmartColumnValueCollectionEventArgs(value, SmartChangeType.New);
				OnInserted(this, args);
			}
		}