Example #1
0
	//*************************************************************************
	// Method:		get_FullExecutableName
	// Description: FullExecutableName property get method
	//
	// Parameters:
	//	None
	//
	// Return Value: the string representing the full path to the executable for this log
	//	data array
	//*************************************************************************
	String *LogPaneDataArray::get_FullExecutableName() 
	{
		String *applicationName = this->ExecutablePath;
		if (applicationName->CompareTo("") != 0)
			applicationName = String::Concat(applicationName, "\\", this->ExecutableFileName);
		else
			applicationName = this->ExecutableFileName;

		return applicationName;
	}
	//*************************************************************************
	// Method:		functionCheckChanged_Handler
	// Description: Called when the user checks a funtion in the treeview
	//				Updates the listview of selected functions
	//
	// Parameters:
	//	functionName - the list of selected functions
	//
	// Return Value: (ArrayList) updated list of selected functions
	//*************************************************************************
	void TestGetFunctionsListDialog::functionCheckChanged_Handler(String * functionName, bool IsChecked)
	{
		String * originalDLL = "";

		InterceptedFunction * func = this->tvFunctions->GetFunctionDefinitionFromFunctionName (functionName);
		if (!func)
			originalDLL = "Internal Symbol";
		else
			originalDLL = func->OriginalDll;

		if (IsChecked)
		{
			String * funcNameWithoutClass = functionName;
			
			int dotIndex = functionName->LastIndexOf('.');
			if (dotIndex != -1)
				funcNameWithoutClass = functionName->Substring(dotIndex + 1);

			//The listviewitem will have the function name only
			ListViewItem * newItem = new ListViewItem (funcNameWithoutClass);
			//The fullname (with class) will be stored in the tag information
			newItem->Tag = functionName;
			newItem->SubItems->Add (originalDLL);
			this->lvItems->Items->Add (newItem);
		}
		else
		{
			for (int i=0; i < this->lvItems->Items->Count; i++)
			{
				ListViewItem * lvItem = this->lvItems->Items->Item[i];
				String * fullFunctionName = dynamic_cast <String *> (lvItem->Tag);
				if ((fullFunctionName->CompareTo (functionName) == 0) &&
					(lvItem->SubItems->Item[1]->Text->CompareTo (originalDLL) == 0))
				{
					this->lvItems->Items->Remove (lvItem);
					break;
				}
			}
		}
	}
	//*************************************************************************
	// Method:		onParamListSelectedIndexChanged
	// Description: called when the selection changes in the list view
	//
	// Parameters:
	//	sender - the sender of this event
	//	args - the args representing this event
	//
	// Return Value: None
	//*************************************************************************
	void TestOutParamSelectionPage::onParamListSelectedIndexChanged(Object *sender, EventArgs *args)
	{
		if (paramListView->SelectedIndices->Count == 0)
			return;

		newValueComboBox->Items->Clear();

		ListViewItem *item = paramListView->Items->get_Item(paramListView->SelectedIndices->get_Item(0));
		ListViewItem::ListViewSubItem *currentValueItem = dynamic_cast<ListViewItem::ListViewSubItem *>(item->SubItems->get_Item(2));
		if (!currentValueItem)
			return;

		String *currentValue = currentValueItem->Text;
		if (!currentValue)
			currentValue = "";

		if (currentValue->CompareTo(OUT_PARAM_NO_CHANGE_STRING) != 0)
			newValueComboBox->Items->Add(currentValue);
		newValueComboBox->Items->Add(new String(OUT_PARAM_NO_CHANGE_STRING));

		newValueComboBox->SelectedIndex = 0;
	}
void IRailConnection::OnTransactionReadyToRead(HttpSession& httpSession,
		HttpTransaction& httpTransaction, int availableBodyLen) {
	//LEZEN werkt !
	ArrayListT<Connection> connections;
	connections.Construct(10);
	HttpResponse* resp = httpTransaction.GetResponse();
	ByteBuffer* buf = (resp->ReadBodyN());
	xmlDocPtr doc =
			xmlParseMemory((char*) (buf->GetPointer()), buf->GetLimit());
	if (doc != null) {
		xmlNodePtr connection = null;
		xmlNodePtr pRoot = xmlDocGetRootElement(doc);
		for (connection = pRoot->children; connection; connection
				= connection->next) {
			xmlNodePtr child = null;
			Connection con;
			for (child = connection->children; child; child = child->next) {
				if (child->type == XML_ELEMENT_NODE) {

					String nodeName;
					Osp::Base::Utility::StringUtil::Utf8ToString(
							(char*) child->name, nodeName);
					if (nodeName.CompareTo("departure") == 0) {
						xmlNodePtr child1 = null;
						for (child1 = child->children; child1; child1
								= child1->next) {
							if (child1->type == XML_ELEMENT_NODE) {
								String nodeName1;
								Osp::Base::Utility::StringUtil::Utf8ToString(
										(char*) child1->name, nodeName1);
								if (nodeName1.CompareTo("time") == 0) {
									xmlAttrPtr isoTime = child1->properties;
									if (isoTime != null && isoTime->type
											== XML_ATTRIBUTE_NODE) {
										String time;
										Osp::Base::Utility::StringUtil::Utf8ToString(
												(char*) isoTime->children->content,
												time);
										con.setFromTime(time);
									}
								} else if (nodeName1.CompareTo("station") == 0) {
									String station;
									Osp::Base::Utility::StringUtil::Utf8ToString(
											(char*) child1->children->content,
											station);
									con.setFromStation(station);
								}
							}
						}
					} else if (nodeName.CompareTo("arrival") == 0) {
						xmlNodePtr child1 = null;
						for (child1 = child->children; child1; child1
								= child1->next) {
							if (child1->type == XML_ELEMENT_NODE) {
								String nodeName1;
								Osp::Base::Utility::StringUtil::Utf8ToString(
										(char*) child1->name, nodeName1);
								if (nodeName1.CompareTo("time") == 0) {
									xmlAttrPtr isoTime = child1->properties;
									if (isoTime != null && isoTime->type
											== XML_ATTRIBUTE_NODE) {
										String time;
										Osp::Base::Utility::StringUtil::Utf8ToString(
												(char*) isoTime->children->content,
												time);
										con.setToTime(time);
									}
								} else if (nodeName1.CompareTo("station") == 0) {
									String station;
									Osp::Base::Utility::StringUtil::Utf8ToString(
											(char*) child1->children->content,
											station);
									con.setToStation(station);
								}
							}
						}
					} else if (nodeName.CompareTo("duration") == 0) {
						String duration_;
						Osp::Base::Utility::StringUtil::Utf8ToString(
								(char*) child->children->content, duration_);
						int duration;
						Integer::Parse(duration_, duration);
						con.setDuration(duration);
					}
				}
			}
			if(con != null) {
				connections.Add(con);
			}
		}
		xmlFreeDoc(doc);
		this->pTrainsResultsForm->setConnections(connections);
	} else {
		AppLog("parsing internet file failed");
	}
}
void VKUServiceProxy::OnMessageReceivedN(RemoteMessagePort* pRemoteMessagePort, IMap* pMessage) {
	AppLog("VKU : A response message is Received.");

	VKUApp* pApp = static_cast<VKUApp*>(App::GetInstance());

	if (pApp != null) {
		String* event = static_cast<String*>(pMessage->GetValue(String(L"event")));
		if (event != null) {

			if(event->CompareTo(L"newmessage") == 0) {
				int messageId;
				Integer::Parse(*static_cast<String *>(pMessage->GetValue(String(L"messageid"))), messageId);

				Frame* frame = pApp->GetFrame(FRAME_NAME);
				Form* form = frame->GetCurrentForm();
				if (form->GetName() == IDF_DIALOG) {
					VKUDialogPanel* pDialogPanel = static_cast<VKUDialogPanel*>(form->GetControl(IDC_PANEL_DIALOG));
					if (pDialogPanel != null) {
						pDialogPanel->LoadNewMessage(messageId);
					}
				}
			} else if(event->CompareTo(L"typing") == 0) {
				Frame* frame = pApp->GetFrame(FRAME_NAME);
				Form* form = frame->GetCurrentForm();
				if (form->GetName() == IDF_DIALOG) {
					VKUDialogPanel* pDialogPanel = static_cast<VKUDialogPanel*>(form->GetControl(IDC_PANEL_DIALOG));
					if (pDialogPanel != null) {
						pDialogPanel->OnTyping();
					}
				}
			} else if(event->CompareTo("read") == 0) {
				int messageId;
				Integer::Parse(*static_cast<String *>(pMessage->GetValue(String(L"msg_id"))), messageId);

				if(_readEventListener != null) {
					_readEventListener->OnReadEvent(messageId);
				}
			} else if(event->CompareTo(L"status") == 0) {
				int userId;
				bool online;
				bool current;

				Integer::Parse(*static_cast<String *>(pMessage->GetValue(String(L"user_id"))), userId);
				online = static_cast<String *>(pMessage->GetValue(String(L"status")))->CompareTo(L"online") == 0;
				current = static_cast<String *>(pMessage->GetValue(String(L"current")))->CompareTo(L"true") == 0;

				// TODO: status processing
				// current = user in current dialog?
			} else if(event->CompareTo("audio-progress") == 0) {
				long duration, position;

				Long::Parse(*static_cast<String *>(pMessage->GetValue(String(L"duration"))), duration);
				Long::Parse(*static_cast<String *>(pMessage->GetValue(String(L"position"))), position);

				if(_audioProgressListener != null) {
					_audioProgressListener->OnAudioProgress(duration, position);
				}

				if(_audioElement != null) {
					_audioElement->OnProgress((int)(((double)position / (double)duration)*100));
				}
			}
		}
	}


	delete pMessage;
}