/// <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;
		}
		/// <summary>
		/// Creates a new instance of SmartColumnCollectionEventArgs which will contain the entry that fired the event
		/// </summary>
		public SmartColumnValueCollectionEventArgs(SmartColumnValue entry, SmartChangeType type)
		{
			m_type = type;
			m_entry = entry;
		}
Пример #3
0
		/// <summary>
		/// This method will add the LDAP entry to the list
		/// </summary>
		/// <param name="member">The LDAP entry to be added</param>
		private void AddLdapMemberToList( LdapSearchResult member )
		{
			// Make sure we have not already added this to the list
			if ( m_listView.Rows.ContainsValue("email", member.DisplayName) == false )
			{
				if ( member != null )
				{
					SmartRow rc = new SmartRow((member.ResultType == LdapSearchResultType.Group ? 0 : 2));
					if ( member.DomainAccount == "[No Domain Account]" )
					{
						rc.IconNumber = 1;
						m_numberInvalid++;
					}
					SmartColumnValue scv1 = new SmartColumnValue("email", member.DisplayName);
					SmartColumnValue scv2 = new SmartColumnValue("role",m_defValue);
					rc.Columns.Add(scv1);
					rc.Columns.Add(scv2);
					rc.Tag = member;
					m_listView.Rows.Add(rc);
				}
			}
			pbMain.Value += 1;
			if ( pbMain.Value >= 100 )
				pbMain.Value = 50;
			Application.DoEvents();
		}
Пример #4
0
		public void Test_08_SmartListControl()
		{
			SmartListControl slc = new SmartListControl();			

			Assert.IsNotNull(slc, "Smart List Control object is NULL!");
			slc.Columns.OnNew += new SmartColumnCollectionEventHandler(scc_OnNew);
			slc.Rows.OnNew +=new SmartRowCollectionEventHandler(Rows_OnNew);

			SmartColumn sc = new SmartColumn( "email", "Email Address", SmartColumnType.ReadOnly, SmartColumnDataType.Text, 300);
			Assert.IsNotNull(sc, "Smart Column object is NULL!");
			slc.Columns.Add(sc);

			SmartRow sr = new SmartRow();
			Assert.IsNotNull(sr, "Smart Row object is NULL!");
			sr.Columns.OnNew +=new SmartColumnValueCollectionEventHandler(Columns_OnNew);

			SmartColumnValue sv = new SmartColumnValue("email", "*****@*****.**");
			Assert.IsNotNull(sv, "Smart Column Value object is NULL!");

			sr.Columns.Add(sv);

			slc.Rows.Add(sr);

			Assert.IsTrue(slc.Rows[0].Columns["email"].ColumnValue.ToString() == "*****@*****.**",
				"Email Address does not match !!");

		}
		/// <summary>
		/// Get the index position of the column
		/// </summary>
		/// <param name="column">The column to search for</param>
		/// <returns>Index position found or -1 if not found</returns>
		public int IndexOf(SmartColumnValue column)
		{
			return List.IndexOf(column);
		}
		/// <summary>
		/// Does the specified column exist in the collection
		/// </summary>
		/// <param name="value">Column to check for</param>
		/// <returns>True if it does</returns>
		public bool Contains( SmartColumnValue value )  
		{
			// If value is not of type SmartListControlColumn, this will return false.
			return( List.Contains( value ) );
		}
		/// <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);
			}
		}