Example #1
0
	//*************************************************************************
	// Method:		customfilter_DestinationIP_RefreshValues
	// Description: Called whenever the visible state of the form is changed.
	//				Used to update "Available" values in the form.
	//
	// Parameters:
	//		sender	- the calling object
	//		e		- event arguments
	//
	// Return Value: None
	//*************************************************************************
	void NetworkLogListView::customfilter_DestinationIP_RefreshValues(System::Object * sender, EventArgs * e)
	{
		if (this->destinationIPFilterForm->Visible)
		{
			NetworkLogPane *logPane = dynamic_cast <NetworkLogPane *> (this->Parent);
			ArrayList *destinationIPList = new ArrayList();
			String *itemText;

			//Get the index of the incoming header
			int destinationIPColumnIndex = this->Columns->IndexOf (this->destIPHeader);

			//Get the last MAX_DISPLAY_RETURNVALS return values from the current log
			for (int i=0; destinationIPList->Count < MAX_DISPLAY_RETURNVALS && i < logPane->LogCount; i++)
			{
				ContainerListViewItem *item = logPane->OnQueryContainerListViewItem(i);
				if (!item)
					continue;

				// minus 1 because of the text field of the item whereas the column index is the column id
				itemText = item->SubItems->get_Item(destinationIPColumnIndex - 1)->ToString();
				if (!destinationIPList->Contains (itemText))
					destinationIPList->Add (itemText);
			}
			
			// sort the values
			destinationIPList->Sort ();
			
			// convert to an array
			Array *destinationIPArray = destinationIPList->ToArray();

			this->destinationIPFilterForm->AvailableList = destinationIPArray;
		}
	}