Exemplo n.º 1
0
void
WebForm::LaunchBrowser(const String& url) {
	ArrayList* pDataList = null;
	pDataList = new ArrayList();
	pDataList->Construct();

	String* pData = null;
	pData = new String(L"url:");
	pData->Append(url);
	AppLogDebug("Launching Stock Browser with %S", pData->GetPointer());
	pDataList->Add(*pData);

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_BROWSER, "");
	if(pAc) {
		pAc->Start(pDataList, null);
		delete pAc;
	}
	pDataList->RemoveAll(true);
	delete pDataList;
}
Exemplo n.º 2
0
	//*************************************************************************
	// Method:		onDeleteFault
	// Description: Called when a ui pane deletes a fault
	//
	// Parameters:
	//	dataNode - the node to delete
	//
	// Return Value: none
	//*************************************************************************
	void FaultPaneDataArray::onDeleteFault(DisplayableDataNode *dataNode)
	{
		FaultPaneDataNode *faultNode = dynamic_cast <FaultPaneDataNode*> (dataNode);
		if (!faultNode)
		{
			faultNode = dynamic_cast <FaultPaneDataNode*> (dataNode->DataArray);
			if (!faultNode)
				return;
		}

		if (!faultNode->DeletedDelegate)
			return;
		else if (faultNode->processID == processID)
		{
			switch (faultNode->Type)
			{
			case UIData::DiskFault:
			case UIData::MemoryFault:
			case UIData::NetworkFault:
			case UIData::RegistryFault:
			case UIData::ProcessFault:
			case UIData::CustomFault:
				faultNode = FindFaultNode(faultNode->Type, faultNode->threadID);
				if (!faultNode)
					return;
				break;
			}

			ArrayList *list = new ArrayList();
			list->Add(__box(faultNode->threadID));
			Array *threadList = list->ToArray();
			holoScriptApp->RemoveFault(threadList, faultNode->FaultID);
			if (internalDelete)
				this->itemList->Remove(faultNode->ID);
			else
				DeleteDataNode(faultNode);
			Object *args[] = __gc new Object*[1];
			args[0] = faultNode;
			faultNode->DeletedDelegate->DynamicInvoke(args);
		}
	}
Exemplo n.º 3
0
void
LoginForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ArrayList* pList = new (std::nothrow)ArrayList;
	AppAssert(pList);
	pList->Construct();

	switch(actionId)
	{
	case IDA_BUTTON_JOIN:
		pList->Add( new Tizen::Base::Integer(1) );	// isJoin
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_JOIN, SCENE_TRANSITION_ANIMATION_TYPE_DEPTH_IN), pList);
		break;
	case IDA_BUTTON_LOGIN:
		doLogin();
		break;
	}
}
Exemplo n.º 4
0
void
Kamera::GetPicture() {
	AppLogDebug("Taking picture");

	ArrayList* pDataList = null;
	pDataList = new ArrayList();
	pDataList->Construct();

	String* pData = null;
	pData = new String(L"type:camera");
	pDataList->Add(*pData);

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_CAMERA, OPERATION_CAPTURE);
	if(pAc)
	{
	  pAc->Start(pDataList, this);
	  delete pAc;
	}
	pDataList->RemoveAll(true);
	delete pDataList;
}
Exemplo n.º 5
0
/**
 * The entry function of Tizen C++ application called by the operating system.
 */
int
OspMain(int argc, char* pArgv[])
{
	result r = E_SUCCESS;

	AppLog("Application started.");
	ArrayList args;
	args.Construct();
	for (int i = 0; i < argc; i++)
	{
		args.Add(*(new (std::nothrow) String(pArgv[i])));
	}

	r = Tizen::App::Application::Execute(WebViewer::CreateInstance, &args);
	TryLog(r == E_SUCCESS, "Application execution failed-[%s].", GetErrorMessage(r));

	args.RemoveAll(true);
	AppLog("Application finished.");

	return static_cast< int >(r);
}
Exemplo n.º 6
0
/**
 * The entry function of bada application called by the operating system.
 */
int OspMain(int argc, char *pArgv[]) {
	result r = E_SUCCESS;

	AppLog("Application started.");
	ArrayList* pArgs = new ArrayList();
	pArgs->Construct();
	for (int i = 0; i < argc; i++)
		pArgs->Add(*(new String(pArgv[i])));

	start_profile();
	r = Osp::App::Application::Execute(LearnABC::CreateInstance, pArgs);
	if (IsFailed(r)) {
		AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
		r &= 0x0000FFFF;
	}
	end_profile();

	pArgs->RemoveAll(true);
	delete pArgs;
	AppLog("Application finished.");

	return static_cast<int>(r);
}
Exemplo n.º 7
0
    // Returns the full paths of files in the current directory.
    ArrayList<TString> DirectoryInfo::GetFiles() const
    {
        WIN32_FIND_DATA data; 
        ArrayList<TString> files;
        TCHAR curDir[MAX_PATH];

        GetCurrentDirectory(MAX_PATH, curDir);
        SetCurrentDirectory(_path);

        HANDLE handle = FindFirstFile("*", &data);
        if (handle != INVALID_HANDLE_VALUE)
        {
            do
            {
                if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
                    files.Add(_path + "\\" + data.cFileName);

            } while (FindNextFile(handle, &data));
        }

        SetCurrentDirectory(curDir);
        return files;
    }
Exemplo n.º 8
0
void UserForm::OpenDialog() {
	ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);

	JsonObject *dialogJson = new JsonObject();
	dialogJson->Construct();

	int uid;
	JsonParseUtils::GetInteger(*_pUserJson, L"id", uid);

	const String * userId = new String(L"user_id");
	JsonNumber *const userIdNumber = new JsonNumber(uid);
	dialogJson->Add(userId, userIdNumber);

	const String * userJson = new String(L"user_json");
	JsonObject *const constPtr = _pUserJson->CloneN();
	dialogJson->Add(userJson, constPtr);

	pList->Construct(1);
	pList->Add(dialogJson);

	SceneManager* pSceneManager = SceneManager::GetInstance();
	pSceneManager->GoForward(ForwardSceneTransition(SCENE_DIALOG, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pList);
}
Exemplo n.º 9
0
/**
 * The entry function of Tizen application called by the operating system.
 */
int
OspMain(int argc, char *pArgv[])
{
    result r = E_SUCCESS;

    ArrayList* pArgs = new ArrayList();
    pArgs->Construct();
    for (int i = 0; i < argc; i++)
    {
        pArgs->Add(*(new String(pArgv[i])));
    }

    r = Tizen::App::UiApp::Execute(QrCodeRecognizer::CreateInstance, pArgs);
    if (IsFailed(r))
    {
        AppSecureLogException("Application execution failed-[%s].", GetErrorMessage(r));
        r &= 0x0000FFFF;
    }

    pArgs->RemoveAll(true);
    delete pArgs;

    return static_cast<int>(r);
}
Exemplo n.º 10
0
	Bitmap *AddSubscriber(Control *control) {
		AppLog("BITMAPCACHE: add subscriber %ls", _url.GetPointer());

		_subscribers.Add(control);
		switch(_state) {
		case CACHE_ENTRY_STATE_NOT_FOUND:
			AppLog("new subscriber on cache entry, entry not found, downloading...");
			StartDownloading();
			break;
		case CACHE_ENTRY_STATE_FILE:
			AppLog("new subscriber on cache entry, entry in file, loading...");
			StartLoading();
			break;
		case CACHE_ENTRY_STATE_MEMORY:
			AppLog("new subscriber on cache entry, entry in memory, send bitmap...");
			//SendEvent(control);
			return _bitmap;
			break;
		default:
			break;
		}

		return null;
	}
Exemplo n.º 11
0
	void SendEvent(Control *control) {
		ArrayList *list = new ArrayList(NoOpDeleter);
		list->Construct(1);
		list->Add(_bitmap);
		control->SendUserEvent(BITMAP_LOADED, list); // BITMAP_LOADED_EVENT
	}
Exemplo n.º 12
0
void
EditEventForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	result r = E_SUCCESS;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ScrollPanel* pScrollPanel = static_cast< ScrollPanel* >(GetControl(0));
	AppAssert(pScrollPanel);

	static const int CONTEXT_POSITION = 200;

	switch (actionId)
	{
	case ID_BUTTON_REMINDER:
		__pReminderContextMenu->SetAnchorPosition(Point(__pReminderContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pReminderContextMenu->SetFocusable(true);
		__pReminderContextMenu->SetShowState(true);
		__pReminderContextMenu->Show();
		break;

	case ID_CONTEXT_REMINDER_MINUTE:
		__selectedReminder = REMINDER_TIME_UNIT_MINUTE;
		__pReminderContextButton->SetText(L"Minute(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_HOUR:
		__selectedReminder = REMINDER_TIME_UNIT_HOUR;
		__pReminderContextButton->SetText(L"Hour(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_DAY:
		__selectedReminder = REMINDER_TIME_UNIT_DAY;
		__pReminderContextButton->SetText(L"Day(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_WEEK:
		__selectedReminder = REMINDER_TIME_UNIT_WEEK;
		__pReminderContextButton->SetText(L"Week(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_BUTTON_RECURRENCE:
	{
		ArrayList* pList = new (std::nothrow) ArrayList();
		pList->Construct();

		DateTime startDate = __pStartEditDate->GetDate();
		DateTime endDate = __pEndEditDate->GetDate();

		pList->Add(*(new (std::nothrow) DateTime(startDate)));
		pList->Add(*(new (std::nothrow) DateTime(endDate)));

		if (__pRecurrence != null)
		{
			pList->Add(*(new (std::nothrow) Recurrence(*__pRecurrence)));
		}

		pSceneManager->GoForward(ForwardSceneTransition(SCENE_EVENT_SETRECURRENCE), pList);
	}
	break;

	case ID_BUTTON_PRIORITY:
		__pPriorityContextMenu->SetAnchorPosition(Point(__pPriorityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pPriorityContextMenu->SetFocusable(true);
		__pPriorityContextMenu->SetShowState(true);
		__pPriorityContextMenu->Show();
		break;

	case ID_CONTEXT_PRIORITY_HIGH:
		__selectedPriority = EVENT_PRIORITY_HIGH;
		__pPriorityContextButton->SetText(L"High");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_NORMAL:
		__selectedPriority = EVENT_PRIORITY_NORMAL;
		__pPriorityContextButton->SetText(L"Normal");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_LOW:
		__selectedPriority = EVENT_PRIORITY_LOW;
		__pPriorityContextButton->SetText(L"Low");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_SENSITIVITY:
		__pSensitivityContextMenu->SetAnchorPosition(Point(__pSensitivityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pSensitivityContextMenu->SetFocusable(true);
		__pSensitivityContextMenu->SetShowState(true);
		__pSensitivityContextMenu->Show();
		break;

	case ID_CONTEXT_SENSITIVITY_PUBLIC:
		__selectedSensitivity = SENSITIVITY_PUBLIC;
		__pSensitivityContextButton->SetText(L"Public");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_PRIVATE:
		__selectedSensitivity = SENSITIVITY_PRIVATE;
		__pSensitivityContextButton->SetText(L"Private");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_CONFIDENTIAL:
		__selectedSensitivity = SENSITIVITY_CONFIDENTIAL;
		__pSensitivityContextButton->SetText(L"Confidential");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_STATUS:
		__pStatusContextMenu->SetAnchorPosition(Point(__pStatusContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pStatusContextMenu->SetFocusable(true);
		__pStatusContextMenu->SetShowState(true);
		__pStatusContextMenu->Show();
		break;

	case ID_CONTEXT_STATUS_NONE:
		__selectedStatus = EVENT_STATUS_NONE;
		__pStatusContextButton->SetText(L"None");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CONFIRMED:
		__selectedStatus = EVENT_STATUS_CONFIRMED;
		__pStatusContextButton->SetText(L"Confirmed");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CANCELLED:
		__selectedStatus = EVENT_STATUS_CANCELLED;
		__pStatusContextButton->SetText(L"Cancelled");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_TENTATIVE:
		__selectedStatus = EVENT_STATUS_TENTATIVE;
		__pStatusContextButton->SetText(L"Tentative");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CHKBUTTON_ISALLDAY_CHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(false);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(false);
		}
	}
	break;

	case ID_CHKBUTTON_ISALLDAY_UNCHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(true);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(true);
		}
	}
	break;

	case ID_FOOTER_SAVE:
		if (__pSubjectEditField->GetText().IsEmpty())
		{
			MessageBox messageBox;
			messageBox.Construct(L"Error", "Please enter the subject", MSGBOX_STYLE_OK, 0);
			int doModal;
			messageBox.ShowAndWait(doModal);
		}
		else
		{
			if (__pCalEvent != null)
			{
				r = UpdateEvent();
				TryReturnVoid(!IsFailed(r), "[%s] Failed to edit event.", GetErrorMessage(r));
			}
			else
			{
				MessageBox messageBox;
				messageBox.Construct(L"Error", "Failed to edit the event.", MSGBOX_STYLE_OK, 0);
				int doModal;
				messageBox.ShowAndWait(doModal);
			}

			pSceneManager->GoBackward(BackwardSceneTransition(SCENE_EVENT_LIST));
		}
		break;

	}

}
Exemplo n.º 13
0
void
FCarAddEdit::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (actionId == ID_CANCEL){
		bool issaved = false;
		if (!this->detailmode) {
		if (CheckIfDataChanged()) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Confirm cancel", "Car data changed. Save data?", MSGBOX_STYLE_YESNO, 10000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				if (Save() == false) {
					return;
				} else {
					issaved = true;
				}
			}
		}
		}
		if (this->formtype == 2) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			if (issaved) {
				carconclass_->SetLastSelectedID(this->itemid);
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			} else {
				ArrayList * list = new ArrayList;
				list->Construct();
				list->Add(*(new Integer(2)));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_SETTINGSFORM, list);
			}
		} else {
		if ((!this->detailform) || (this->detailmode)) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SAVE) {
		if (Save() == false) {
			return;
		}
		if (this->formtype == 2) {
		carconclass_->SetLastSelectedID(this->itemid);
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
		} else {
		if (!this->detailform) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPOK) {
		fueltypesselectedarray_.RemoveAll();
		int checkeditemindex;
		int fueltypeid;
		checkeditemindex = pListSelectFuelTypes_->GetFirstCheckedItemIndex();
		while (checkeditemindex > -1) {
			fueltypeid = pListSelectFuelTypes_->GetItemIdAt(checkeditemindex);
			fueltypesselectedarray_.Add(fueltypeid);
			checkeditemindex = pListSelectFuelTypes_->GetNextCheckedItemIndexAfter(checkeditemindex);
		}
		controlhandler_->SetValue(this,L"CB_4_fueltypestring", GetFuelTypesString());
		pPopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPCANCEL) {
		pAddnewfueltypepopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPSAVE) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		String tmps = pAddnewfueltypepopupEditField_->GetText();
		tmps.Trim();
		if (tmps == "") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Empty value!", "Input fuel type caption!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		} else {
			FuelTypeData fueltypedata_;
			fueltypedata_.Caption = tmps;
			fueltypedata_.ID = 0;
			carconclass_->SaveFuelTypeData(fueltypedata_);
			pListSelectFuelTypes_->AddItem(&fueltypedata_.Caption, null, null, null, fueltypedata_.ID);
			int selecteditemindex = pListSelectFuelTypes_->GetItemIndexFromItemId(fueltypedata_.ID);
			if (selecteditemindex > -1) {
				pListSelectFuelTypes_->SetItemChecked(selecteditemindex, true);
			}
			pListSelectFuelTypes_->ScrollToBottom();
			pAddnewfueltypepopup_->SetShowState(false);
			RequestRedraw(true);
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPADD) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		pAddnewfueltypepopupEditField_->SetText(L"");
		pAddnewfueltypepopup_->SetShowState(true);
		pAddnewfueltypepopup_->Show();
	} else if (actionId == ID_BUTTON_EDITFIELD_DONE) {
		int actiondone = controlhandler_->ActionDone(this, source);
		if ((actiondone == ControlHandler::ACTIONDONERESULT_HIDEKEYPAD) || (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX)) {
			ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
			vpScrollPanel->CloseOverlayWindow();
		}
		if (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX) {
			pPopup_->SetShowState(true);
			pPopup_->Show();
		}
	} else if (actionId == ID_BUTTON_EDITFIELD_CLOSE) {
		ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
		vpScrollPanel->CloseOverlayWindow();
	} else if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		this->SetFocus();
		if (actionId == ID_DETAIL) {
			ReloadSavedData();
		}
		this->detailmode = (actionId == ID_DETAIL);
		DetailEditMode();
		RequestRedraw(true);
	}
}
Exemplo n.º 14
0
void
MapForm::OnActionPerformed(const Osp::Ui::Control &source, int actionId)
{
	if (null == _pMap) return;

	switch(actionId)
	{
	case ACTION_ID_INFOWINDOW_BUTTON:
	case ACTION_ID_OVERLAY_BUTTON:
	case ACTION_ID_ROTATE_BUTTON:
		{
		Rectangle clientRect = GetClientAreaBounds();
		CloseContextMenu();
		int sectors = clientRect.width / int(ACTION_ID_BUTTON_MAX);
		Point pos;
		pos.y =clientRect.height + ((this->GetHeight() - clientRect.height)/2);
		pos.x = (sectors / 2) + (sectors * actionId);
		CreateAndShowContextMenu(actionId,pos);
	}
		break;
	case ACTION_ID_ROTATE_CW: {
			RotateMap(true);
		}
		break;
	case ACTION_ID_ROTATE_CCW: {
			RotateMap(false);
		}
		break;
	case ACTION_ID_OVERLAY: {
		if (_showAll) {
				ShowAll(false);
				ShowOverlays(true);
		} else {
				MoveMarker(false);
				ShowInfoWindow(false);
				ShowInfoWindowWithImage(false);
				ShowMyLocation(false);

			if (_showOverlay == false) {
					ShowOverlays(true);
			} else {
					ShowOverlays(false);
				}
			}

			Redraw();
		}
		break;
	case ACTION_ID_INFOWINDOW: {
		if (_showAll) {
				ShowAll(false);
				ShowInfoWindow(true);
		} else {
				MoveMarker(false);
				ShowOverlays(false);
				ShowInfoWindowWithImage(false);
				ShowMyLocation(false);

			if (_showInfo == false) {
					ShowInfoWindow(true);
			} else {
					ShowInfoWindow(false);
				}
			}

			Redraw();
		}
		break;
	case ACTION_ID_INFOWINDOW2: {
//		if (_showAll) {
//				ShowAll(false);
//				ShowInfoWindowWithImage(true);
//		} else {
//				MoveMarker(false);
//				ShowOverlays(false);
//				ShowInfoWindow(false);
//				ShowMyLocation(false);
//
//			if (_showInfoWithImage == false) {
//					ShowInfoWindowWithImage(true);
//			} else {
//					ShowInfoWindowWithImage(false);
//				}
//			}
//
//			Redraw();
//		}
//		break;		if(__newStartingPoint.IsEmpty() || __newDestinationPoint.IsEmpty()) break;

		ArrayList waypoints;
		String value(L"");
		Osp::Base::String __newStartingPoint =	(L"51.5033, -0.1197");
		Osp::Base::String __newDestinationPoint	= (L"51.500721983903,-0.124197006225586");
		Coordinates* pStartCoord = NavigatorUtil::StringToCoordinatesN(__newStartingPoint);
		Coordinates* pDestCoord  = NavigatorUtil::StringToCoordinatesN(__newDestinationPoint);
		NavigatorRouteServices* __pRouteSvc = new NavigatorRouteServices();
		if(pStartCoord != null)
			waypoints.Add(*pStartCoord);
		else
		{
			waypoints.Add(*new String(__newStartingPoint));
			value += L"0";
			value += Locale::CountryCodeToString(COUNTRY_US);
			value += L";";
		}

		if(pDestCoord != null)
			waypoints.Add(*pDestCoord);
		else
		{
			waypoints.Add(*new String(__newDestinationPoint));
			value += L"1";
			value += Locale::CountryCodeToString(COUNTRY_US);
			value += L";";
		}

		__pRouteSvc->GetRoute(waypoints, value);
		waypoints.RemoveAll(true);
	}
		break;
	case ACTION_ID_MY_LOCATION: {
		ShowAll(false);
		ShowMyLocation(true);

			Redraw();
		}
		break;

	case ACTION_ID_MARKERMOVE: {
		if (_showAll) {
				ShowAll(false);
				MoveMarker(true);
		} else {
				ShowOverlays(false);
				ShowInfoWindow(false);
				ShowInfoWindowWithImage(false);
				ShowMyLocation(false);

			if (_movedMarker) {
					MoveMarker(false);
			} else {
					MoveMarker(true);
				}
			}

			Redraw();
		}
		break;

	case ACTION_ID_ALL: {
		if (_showAll == false) {
				ShowAll(true);				
		} else {
				ShowAll(false);
			}

			Redraw();
		}
		break;
		
	case ACTION_ID_BUTTON_OK_POPUP: {
		if (_popupShow == true) {
				_pPopup->SetShowState(false);
				_pPopup->Show();

				_popupShow = false;

				Redraw();
			}
		}
		break;

	case ACTION_ID_GET_ADDRESS:
		RequestReverseGeocode(_positionOfContextMenu);
		break;

	case ACTION_ID_BACK: {
		BukkaMain *pMain = new BukkaMain();
		pMain->Initialize();
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		pFrame->AddControl(*pMain);
		pFrame->SetCurrentForm(*pMain);
		pMain->Draw();
		pMain->Show();
	}
		break;
	}
}
ArrayList * VKUMessagesListItemProvider::GetMessageElementsN(const JsonObject *pMessageJson, int itemWidth) {
	AppLog("enter VKUMessagesListItemProvider::GetMessageElementsN");
	result r;

	// general
	ArrayList* pResultArray;

	// body stuff
	String messageText;
	MessageTextElement *pMessageTextElement;

	// attachs stuff
	IJsonValue *attachs;
	JsonArray * pAttachArray;
	int out;
	int emoji = 0;

	pResultArray = new ArrayList(SingleObjectDeleter);
	r = pResultArray->Construct(1);
	TryCatch(r == E_SUCCESS, , "pResultArray->Construct");
	JsonParseUtils::GetInteger(*pMessageJson, L"out", out);

	JsonObject * geoObject;
	r = JsonParseUtils::GetObject(pMessageJson, L"geo", geoObject);

	if (r == E_SUCCESS) {
		AppLog("Message has geo entry, receiving");
		MessageLocationElement * pLocationElement = new MessageLocationElement();
		pLocationElement->Construct(Rectangle(0, 0, 400, 400), geoObject);

		pResultArray->Add(pLocationElement);
	}

	r = JsonParseUtils::GetString(*pMessageJson, L"body", messageText);
	TryCatch(r == E_SUCCESS, , "JsonParseUtils::GetString body");

	JsonParseUtils::GetInteger(*pMessageJson, L"emoji", emoji);

	if (messageText.GetLength() != 0) {
		AppLog("Message has text entry, receiving");
		pMessageTextElement = new MessageTextElement();
		pMessageTextElement->Construct(Rectangle(0, 0, itemWidth-200, 10000));
		pMessageTextElement->SetText(messageText, emoji);

		pResultArray->Add(pMessageTextElement);
	}


	static const String attachConst(L"attachments");
	r = pMessageJson->GetValue(&attachConst, attachs);

	if (r == E_SUCCESS)
		pAttachArray = static_cast<JsonArray *>(attachs);

	for (int i=0; r == E_SUCCESS && i<pAttachArray->GetCount(); i++) {
		AppLog("Message has %d attachments, receiving %d", pAttachArray->GetCount(), i);

		IJsonValue *pAttachValue;
		JsonObject *pAttachObject;
		String attachType;

		MessageElement *pMessageElement;

		pAttachArray->GetAt(i, pAttachValue);

		pAttachObject = static_cast<JsonObject *>(pAttachValue);

		JsonParseUtils::GetString(*pAttachObject, L"type", attachType);

		if (attachType == L"photo") {
			AppLog("Message has photo, receiving");
			String imageUrl;

			IJsonValue *pPhotoValue;
			JsonObject *pPhotoObject;

			Rectangle thumbSize;

			int width = 0, height = 0;

			static const String photoConst(L"photo");

			pAttachObject->GetValue(&photoConst, pPhotoValue);
			pPhotoObject = static_cast<JsonObject *>(pPhotoValue);

			JsonParseUtils::GetString(*pPhotoObject, L"photo_604", imageUrl);
			JsonParseUtils::GetInteger(*pPhotoObject, L"width", width);
			JsonParseUtils::GetInteger(*pPhotoObject, L"height", height);

			if (width != 0 && height != 0) {
				thumbSize = ImageUtils::ScaleTo(320, Rectangle(0, 0, width, height));
			} else {
				thumbSize = Rectangle(0, 0, 320, 240);
			}

			MessagePhotoElement * pPhotoElement = new MessagePhotoElement();
			pPhotoElement->Construct(thumbSize, imageUrl);

			pMessageElement = static_cast<MessageElement *>(pPhotoElement);;

		} else if (attachType == L"video") {
			AppLog("Message has video, receiving");

//			IJsonValue *pVideoValue;
//			JsonObject *pVideoObject;
//
//			static const String videoConst(L"video");
//
//			pAttachObject->GetValue(&videoConst, pVideoValue);
//			pVideoObject = static_cast<JsonObject *>(pVideoValue);

			JsonObject *pVideoObject;
			JsonParseUtils::GetObject(pAttachObject, L"video", pVideoObject);

			MessageVideoElement *pVideoElement = new MessageVideoElement();
			pVideoElement->Construct(Rectangle(0, 0, 320, 240), pVideoObject);

			pMessageElement = static_cast<MessageElement *>(pVideoElement);

		} else if (attachType == L"audio") {
			AppLog("Message has audio, receiving");

			JsonObject *pAudioObject;
			JsonParseUtils::GetObject(pAttachObject, L"audio", pAudioObject);

			MessageAudioElement *pMessageAudioEleemnt = new MessageAudioElement();
			pMessageAudioEleemnt->Construct(Rectangle(0, 0, 520, 240), pAudioObject, out);

			pMessageElement = dynamic_cast<MessageElement *>(pMessageAudioEleemnt);

		} else if (attachType == L"doc") {
			AppLog("Message has doc, receiving");

			JsonObject *pDocObject;
			JsonParseUtils::GetObject(pAttachObject, L"doc", pDocObject);

			MessageDocElement * pDocElement = new MessageDocElement();
			pDocElement->Construct(Rectangle(0, 0, 520, 90), pDocObject, out);

			pMessageElement = static_cast<MessageElement * >(pDocElement);
		} else if (attachType == L"wall") {
			AppLog("Message has wall, receiving");

			JsonObject *pWallObject;
			JsonParseUtils::GetObject(pAttachObject, L"wall", pWallObject);

			MessageWallElement * pWallElement = new MessageWallElement();
			pWallElement->Construct(Rectangle(0, 0, 320, 240), pWallObject, out);

			pMessageElement = dynamic_cast<MessageElement *>(pWallElement);
		}

		pResultArray->Add(pMessageElement);
	}

	JsonArray *forwardedMessages;
	r = JsonParseUtils::GetArray(pMessageJson, L"fwd_messages", forwardedMessages);
	AppLog("Message has forwardedMessages?");
	for (int i=0; r == E_SUCCESS && i<forwardedMessages->GetCount(); i++) {
		AppLog("Message has forwardedMessages, receiving %d", i);

		JsonObject *fwdMessage;

		JsonParseUtils::GetObject(forwardedMessages, i, fwdMessage);

		MessageForwardedElement *pForwardedElement = new MessageForwardedElement();
		pForwardedElement->Construct(Rectangle(0, 0, 500, 40000), fwdMessage, out);

		MessageElement *pMessageElement;
		pMessageElement = static_cast<MessageForwardedElement *>(pForwardedElement);

		pResultArray->Add(pMessageElement);
	}

	AppLog("Message has done");

	return pResultArray;

CATCH:
	AppLogException("VKUMessagesListItemProvider::GetMessageElementsN is failed. %s", GetErrorMessage(r));
	return pResultArray;
}
Exemplo n.º 16
0
	//*************************************************************************
	// Method:		AddPane
	// Description: Adds a pane to the manager
	//
	// Parameters:
	//	pane - the pane to add
	//
	// Return Value: None
	//*************************************************************************
	void DockablePaneManager::AddPane(DockablePane *pane)
	{
		if (!pane || !pane->Group || !pane->Name)
			return;

		pane->OnNameChanged += PaneNameChangedHandler;
		pane->OnTitleChanged += PaneTitleChangedHandler;
		pane->OnImageIndexChanged += PaneImageIndexChangedHandler;

		Content *paneContent = NULL;

		if (!groupToContentListTable->Contains(pane->Group))
		{
			// need to make a new vertical content
			paneContent = dockManager->Contents->Add(pane, pane->Title, this->ImageList, pane->ImageIndex);

			switch(pane->PreferredOrientation)
			{
			case DockablePaneOrientation::VerticalLeft:
				if (!lastVerticalLeftContentAdded)
					dockManager->AddContentWithState(paneContent, State::DockLeft);
				break;
			case DockablePaneOrientation::VerticalRight:
				if (!lastVerticalRightContentAdded)
					dockManager->AddContentWithState(paneContent, State::DockRight);
				break;
			case DockablePaneOrientation::HorizontalTop:
				if (!lastHorizontalTopContentAdded)
					dockManager->AddContentWithState(paneContent, State::DockTop);
				break;
			case DockablePaneOrientation::HorizontalBottom:
				if (!lastHorizontalBottomContentAdded)
					dockManager->AddContentWithState(paneContent, State::DockBottom);
				break;
			}

			WindowContent *groupContent = paneContent->ParentWindowContent;
			
			Zone *zone = NULL;
			Content *lastAdded = NULL;
			switch(pane->PreferredOrientation)
			{
			case DockablePaneOrientation::VerticalLeft:
				lastAdded = lastVerticalLeftContentAdded;
				break;
			case DockablePaneOrientation::VerticalRight:
				lastAdded = lastVerticalRightContentAdded;
				break;
			case DockablePaneOrientation::HorizontalTop:
				lastAdded = lastHorizontalTopContentAdded;
				break;
			case DockablePaneOrientation::HorizontalBottom:
				lastAdded = lastHorizontalBottomContentAdded;
				break;
			}

			if (lastAdded && lastAdded->ParentWindowContent)
			{
				zone = lastAdded->ParentWindowContent->ParentZone;
				if (zone)
				{
					DockablePanePosition groupPosition = DockablePanePosition::Normal;
					if (groupPositionsTable->ContainsKey(pane->Group))
						groupPosition = *dynamic_cast<__box DockablePanePosition *>(groupPositionsTable->get_Item(pane->Group));

					int insertPos = GetInsertPositionForWindowContentList(zone->Windows, groupPosition);
					dockManager->AddContentToZone(paneContent, zone, insertPos);
				}
			}

			ArrayList *newList = new ArrayList();
			newList->Add(paneContent);
			groupToContentListTable->Add(pane->Group, newList);
			dockManager->ShowContent(paneContent);
		}
		else
		{
			ArrayList *list = dynamic_cast<ArrayList *>(groupToContentListTable->get_Item(pane->Group));
			if (!list || list->Count == 0)
				return;
			Content *oldContent = dynamic_cast<Content *>(list->get_Item(0));

			int insertPos = GetInsertPositionForContentList(list, pane);
			paneContent = dockManager->Contents->Add(pane, pane->Title, this->ImageList, pane->ImageIndex);
			dockManager->InsertContentIntoWindowContent(insertPos, paneContent, oldContent->ParentWindowContent);
			dockManager->ShowContent(paneContent);

			list->Add(paneContent);
		}

		if (paneContent)
		{
			switch(pane->PreferredOrientation)
			{
			case DockablePaneOrientation::VerticalLeft:
				lastVerticalLeftContentAdded = paneContent;
				break;
			case DockablePaneOrientation::VerticalRight:
				lastVerticalRightContentAdded = paneContent;
				break;
			case DockablePaneOrientation::HorizontalTop:
				lastHorizontalTopContentAdded = paneContent;
				break;
			case DockablePaneOrientation::HorizontalBottom:
				lastHorizontalBottomContentAdded = paneContent;
				break;
			}
		}
	}
Exemplo n.º 17
0
char*
TextSelection::GetXaml ()
{
	const char *header = "<Section xml:space=\"preserve\" HasTrailingParagraphBreakOnPaste=\"False\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">";
	const char *trailer = "</Section>";

	GString *str;
	ArrayList ancestors;
	DependencyObject *el;

	if (xaml)
		goto done;

	if (!anchor.GetParent() || !moving.GetParent()) {
		xaml = g_strdup ("");
		goto done;
	}

	if (anchor.GetParent() == moving.GetParent() && anchor.GetLocation () == moving.GetLocation()) {
		xaml = g_strdup ("");
		goto done;
	}

	str = g_string_new (header);

	// first we serialize the xaml start elements for all
	// TextElements that contain the selection start (but not the
	// most deeply nested element itself)

	el = anchor.GetParent();
	if (el && !el->Is (Type::RICHTEXTBOX)) {
		// skip anchor.GetParent() here.
		el = el->GetParent() ? el->GetParent()->GetParent() : NULL;
		while (el) {
			if (el->Is (Type::RICHTEXTBOX))
				break;
			ancestors.Add (el);
			el = el->GetParent() ? el->GetParent()->GetParent() : NULL;
			if (!el)
				break;
		}
	}

	for (int i = ancestors.GetCount() - 1; i >= 0; i --) {
		TextElement *te = (TextElement*)ancestors[i];
		IDocumentNode *node = IDocumentNode::CastToIDocumentNode (te);
		node->SerializeXamlStartElement (str);
	}




	// now we output the start element (and deal with the case where start_element == end_element)
	el = anchor.GetParent ();
	if (el->Is (Type::RUN)) {
		if (el == moving.GetParent()) {
			// if both textpointers are in the same
			// element, we need to use start+length form
			((Run*)el)->SerializeXaml (str, anchor.ResolveLocation (), moving.ResolveLocation () - anchor.ResolveLocation());
		}
		else {
			// since the moving textpointer is outside
			// this run, we just use the start form.
			((Run*)el)->SerializeXaml (str, anchor.ResolveLocation ());
		}
	}
	else {
		((TextElement*)el)->SerializeXaml (str);
	}

	if (anchor.GetParent() != moving.GetParent()) {
		// now walk the document from start element to end element, outputting everything manually along the way.
		DocumentWalker walker (anchor.GetParentNode(), DocumentWalker::Forward);
		IDocumentNode *node;
		DocumentWalker::StepType stepType;

		stepType = walker.Step (); // step out of the start element

		while (stepType != DocumentWalker::Done) {
			stepType = walker.Step (&node);

			if (node == moving.GetParentNode())
				break;
			if (stepType == DocumentWalker::Enter)
				node->SerializeXamlStartElement(str);
			else
				node->SerializeXamlEndElement(str);
		}

		// now we output the end element
		el = moving.GetParent ();
		if (el->Is (Type::RUN)) {
			((Run*)el)->SerializeXaml (str, 0, moving.ResolveLocation ());
		}
		else {
			((TextElement*)el)->SerializeXaml (str);
		}
	}

	// now serialize the xaml end elements for all TextElements
	// that contain the selection end (but not the most deeply
	// nested element itself)

	if (anchor.GetParent() == moving.GetParent ()) {
		// this case is trivial, we just output the same list
		// of end elements that we outputted the start
		// elements before
		for (int i = ancestors.GetCount() - 1; i >= 0; i --) {
			TextElement *te = (TextElement*)ancestors[i];
			IDocumentNode *node = IDocumentNode::CastToIDocumentNode (te);
			node->SerializeXamlEndElement (str);
		}
	}
	else {
		ancestors.SetCount (0);

		DependencyObject *el = moving.GetParent();
		if (el && !el->Is (Type::RICHTEXTBOX)) {
			// skip moving.GetParent() here.
			el = el->GetParent() ? el->GetParent()->GetParent() : NULL;
			while (el) {
				if (el->Is (Type::RICHTEXTBOX))
					break;
				ancestors.Add (el);
				el = el->GetParent() ? el->GetParent()->GetParent() : NULL;
				if (!el)
					break;
			}
		}

		for (int i = ancestors.GetCount() - 1; i >= 0; i --) {
			TextElement *te = (TextElement*)ancestors[i];
			IDocumentNode *node = IDocumentNode::CastToIDocumentNode (te);
			node->SerializeXamlEndElement (str);
		}
	}

	g_string_append (str, trailer);

	xaml = g_string_free (str, FALSE);

 done:
	return g_strdup (xaml);
}
Exemplo n.º 18
0
void
ProjectGiraffeTab4::connectionDidFinish(HttpConnection *connection, HashMap *response)
{
	/*
	if (response) {
		String userKey("user");
		String messageKey("message");
		String errorKey("error");
		if (response->ContainsKey(userKey)) {
			HashMap *userDict = (HashMap *)response->GetValue(userKey);
			User::currentUser()->updateFromDictionary(userDict);

//			showProfile();

			String *message = (String *)response->GetValue(messageKey);
			showStatus("User Update Status", *message, false);
		} else if (response->ContainsKey(errorKey)) {
			String *errorMessage = (String *)response->GetValue(errorKey);

			// Flash error message
			showStatus("User Update Status", *errorMessage, true);

			Draw();
		}

		delete connection;
//		delete response;
	}
	*/
	AppLog("HttpConnection finished");
	if (response) {
		// TODO: check for the return value
		ArrayList *graffitiList = static_cast<ArrayList *>(response->GetValue(kHTTPParamNameGraffiti));
		if (graffitiList) {
			AppLog("Retrieved list");
			ArrayList *newItems = new ArrayList(SingleObjectDeleter);
			newItems->Construct();

			for (int i = 0; i < graffitiList->GetCount(); i++) {
				HashMap *graffitiDictionary = static_cast<HashMap *>(graffitiList->GetAt(i));
				AppLog("updating dictionary");
				if (graffitiDictionary) {
					Graffiti *newGraffiti = new Graffiti();
					newGraffiti->updateFromDictionary(graffitiDictionary);
					newGraffiti->setUser(User::currentUser());
					AppLog("Updated from dictionary");
					newItems->Add(newGraffiti);
				}
			}
			if(graffitiList->GetCount() == 0){
				AppLog("No graffiti to display");
				displayNoGraffiti();
			}
			AppLog("Setting new items");
			setItems(newItems);
		}else{
			AppLog("Failed to retrieve graffiti list");
			displayNoGraffiti();
		}
	} else {

		connectionDidFail(connection);
	}
}
Exemplo n.º 19
0
void GHPlayerController::OnTransactionReadyToRead(Tizen::Base::String apiCode, Tizen::Base::String statusCode, Tizen::Web::Json::IJsonValue* data)
{
	AppLogDebug("[DEBUG] apiCode : %S", apiCode.GetPointer() );
	AppLogDebug("[DEBUG] statusCode : %S", statusCode.GetPointer());

	if(pProgressPopup->IsVisible()) {
		pProgressPopup->SetShowState(false);
	}
	if(apiCode.Equals(PLAYER_LOGIN)) {
		// 정상적으로 결과를 반환했을 때
		if(statusCode != "0") {

			// Save AppRegistry Data(Email, Password)----------
			appReg.put(appReg.email, playerEmail);
			appReg.put(appReg.pwd, playerPwd);
			//------------------------------------------------

			GHSharedAuthData & sharedInstance = GHSharedAuthData::getSharedInstance();
			sharedInstance.setPlayerId(statusCode);

			if(this->currentListener != null) this->currentListener->loginPlayerFinished(statusCode);
		}
		else { // 에러가 발생했을 때
		}


	}
	else if(apiCode.Equals(PLAYER_PLAYERDATA)) {	// PLAYER_PLAYERDATA
			GHPlayer *player;

			// 정상적으로 결과를 반환했을 때
			if(statusCode == "1") {

				JsonObject *pJsonOject 	= static_cast<JsonObject*>(data);

				AppLogDebug("---------------------------2-----------------------");

				String* pkeyId		= new String(L"player_id");
				String* pkeyEmail 	= new String(L"email");
				String* pkeyName 	= new String(L"name");
				String* pkeyImgUrl 	= new String(L"img_url");
				String* pkeyIsFriend= new String(L"is_friend");

				String  sId 		= getStringByKey(pJsonOject, pkeyId);
				String  sEmail 		= getStringByKey(pJsonOject, pkeyEmail);
				String  sName		= getStringByKey(pJsonOject, pkeyName);
				String  sImgUrl 	= getStringByKey(pJsonOject, pkeyImgUrl);
				bool  	bIsFriend 	= getBoolByKey(pJsonOject, pkeyIsFriend);

				AppLogDebug("--------------------------------------------------");

				player = new GHPlayer(sId, sEmail, sName, sImgUrl);
				player->setIsFriend(bIsFriend);

				// KEY NAME DELETE
				delete pkeyId;		delete pkeyEmail;
				delete pkeyName;	delete pkeyImgUrl;
				delete pkeyIsFriend;

			}
			else { // 에러가 발생했을 때
				player = null;
			}

			if(this->currentListener != null) this->currentListener->loadPlayerDataFinished(player);
	}
	else if(apiCode.Equals(PLAYER_GAMELIST))
	{
		ArrayList *gameList;

		// 정상적으로 결과를 반환했을 때
		if(statusCode == "1") {
			JsonArray* 	pJsonArray 	= static_cast<JsonArray*>(data);
			int 		arrNum 		= pJsonArray->GetCount();
			gameList = new ArrayList();

			// KEY NAME
			String* pKeyGameId 		= new String(L"game_id");
			String* pKeyGameTitle	= new String(L"title");
			String* pkeyGameImgUrl	= new String(L"img_url");
			String* pKeyGameDesc	= new String(L"description");

			AppLogDebug("[DEBUG] arrNum : %d", arrNum );

			for(int i=0; i<arrNum; i++) {
				JsonObject *pJsonOject 	= getJsonObjectByIndex(pJsonArray, i);

				// 데이터 파싱
				String  sGameId			= getStringByKey(pJsonOject, pKeyGameId);
				String  sGameTitle		= getStringByKey(pJsonOject, pKeyGameTitle);
				String  sGameImgUrl 	= getStringByKey(pJsonOject, pkeyGameImgUrl);
				String  sGameDesc	 	= getStringByKey(pJsonOject, pKeyGameDesc);

				// 리스트에 추가
				gameList->Add( new GHGame(sGameId, "", sGameTitle, sGameDesc, sGameImgUrl, 0, 0, 0, false, false) );
			}

			// KEY NAME DELETE
			delete pKeyGameId;		delete pKeyGameTitle;	 delete pkeyGameImgUrl;
		}
		else { // 에러가 발생했을 때
			gameList = null;
		}

		if(this->currentListener != null) this->currentListener->loadPlayerGamesFinished(gameList);


	}
	else if(apiCode.Equals(PLAYER_SEARCHFRIEND))
	{
		ArrayList *friendList;

		if(statusCode == "1") {
			JsonObject *pJsonOject 	= static_cast<JsonObject*>(data);
			friendList = new ArrayList();

			// KEY NAME
			String* pKeyPlayerId	= new String(L"player_id");
			String* pKeyPlayerEmail	= new String(L"email");
			String* pkeyPlayerName	= new String(L"name");
			String* pkeyPlayerImgUrl= new String(L"img_url");

			// 데이터 파싱
			String  sPlayerId		= getStringByKey(pJsonOject, pKeyPlayerId);
			String  sPlayerEmail	= getStringByKey(pJsonOject, pKeyPlayerEmail);
			String  sPlayerName		= getStringByKey(pJsonOject, pkeyPlayerName);
			String  sPlayerImgUrl 	= getStringByKey(pJsonOject, pkeyPlayerImgUrl);

			// 리스트에 추가
			friendList->Add( new GHPlayer(sPlayerId, sPlayerEmail, sPlayerName, sPlayerImgUrl) );

			// KEY NAME DELETE
			delete pKeyPlayerId;		delete pKeyPlayerEmail;
			delete pkeyPlayerName;		delete pkeyPlayerImgUrl;
		}
		else { // 에러가 발생했을 때
			friendList = null;
		}

		if(this->currentListener != null) this->currentListener->searchFriendFinished(friendList);
	}
	else if(apiCode.Equals(PLAYER_ADDFRIEND))
	{
		if(this->currentListener != null) this->currentListener->addFriendFinished(statusCode);
	}
	else if(apiCode.Equals(PLAYER_LOADFRIENDS))	// 친구 목록 불러오기
	{
		ArrayList *friendList;

		if(statusCode == "1") {
				JsonArray* 	pJsonArray 	= static_cast<JsonArray*>(data);
				int 		arrNum 		= pJsonArray->GetCount();
			friendList = new ArrayList();

			// KEY NAME
				String* pKeyPlayer		= new String(L"player_id");
				String* pKeyPlayerName	= new String(L"name");
				String* pkeyPlayerImgUrl= new String(L"img_url");

				AppLogDebug("[DEBUG] arrNum : %d", arrNum );

				for(int i=0; i<arrNum; i++) {
					JsonObject *pJsonOject 	= getJsonObjectByIndex(pJsonArray, i);

					// 데이터 파싱
					String  sPlayerId		= getStringByKey(pJsonOject, pKeyPlayer);
					String  sPlayerName		= getStringByKey(pJsonOject, pKeyPlayerName);
					String  sPlayerImgUrl 	= getStringByKey(pJsonOject, pkeyPlayerImgUrl);

					// 리스트에 추가
					friendList->Add( new GHPlayer(sPlayerId, sPlayerName, sPlayerImgUrl) );
				}

				// KEY NAME DELETE
				delete pKeyPlayer;		delete pKeyPlayerName;	 delete pkeyPlayerImgUrl;
		}
		else { // 에러가 발생했을 때
			friendList = null;
		}

		if(this->currentListener != null) this->currentListener->loadPlayerFriendsFinished(friendList);

	}
	else //PLAYER_LOGIN ,PLAYER_GAMEJOIN
	{
//		if(this->currentListener != null) this->currentListener->doPlayerFinished(statusCode);
	}
}
void ForUsDocForm::OnActionPerformed(const Tizen::Ui::Control& source,
		int actionId) {

	int year = __pSelectCalendar->GetTimeField(TIME_FIELD_YEAR);
	int month = __pSelectCalendar->GetTimeField(TIME_FIELD_MONTH);

	result r = E_SUCCESS;

	String port = "39000";
	int __iport = 39000;
	bool __isProtocol = false;
	bool __isServer = true;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ArrayList* pList = new (std::nothrow) ArrayList;
	AppAssert(pList);

	__year = year;
	__month = month;

	switch (actionId) {
	case ID_BUTTON_PREV_MONTH_ID:
		TryReturnVoid((year > 1) || (month > 1), "At first page");
		__pSelectCalendar->AddTimeField(TIME_FIELD_MONTH, -1);
		AppLog("PREV_MONTH Button is clicked\n");
		break;
	case ID_BUTTON_NEXT_MONTH_ID:
		TryReturnVoid((year < 9999) || (month < 12), "At last page");
		__pSelectCalendar->AddTimeField(TIME_FIELD_MONTH, 1);
		AppLog("NEXT_MONTH Button is clicked\n");
		break;
	case ID_BUTTON_PREV_YEAR_ID:
		TryReturnVoid(year > 1, "At starting year");
		__pSelectCalendar->AddTimeField(TIME_FIELD_YEAR, -1);
		AppLog("PREV_YEAR Button is clicked\n");
		break;
	case ID_BUTTON_NEXT_YEAR_ID:
		TryReturnVoid(year < 9999, "At starting year");
		__pSelectCalendar->AddTimeField(TIME_FIELD_YEAR, 1);
		AppLog("NEXT_YEAR Button is clicked\n");
		break;
	case dayBtn0:
	case dayBtn1:
	case dayBtn2:
	case dayBtn3:
	case dayBtn4:
	case dayBtn5:
	case dayBtn6:
	case dayBtn7:
	case dayBtn8:
	case dayBtn9:
	case dayBtn10:
	case dayBtn11:
	case dayBtn12:
	case dayBtn13:
	case dayBtn14:
	case dayBtn15:
	case dayBtn16:
	case dayBtn17:
	case dayBtn18:
	case dayBtn19:
	case dayBtn20:
	case dayBtn21:
	case dayBtn22:
	case dayBtn23:
	case dayBtn24:
	case dayBtn25:
	case dayBtn26:
	case dayBtn27:
	case dayBtn28:
	case dayBtn29:
	case dayBtn30:
	case dayBtn31:
	case dayBtn32:
	case dayBtn33:
	case dayBtn34:
	case dayBtn35:
	case dayBtn36:
	case dayBtn37:
	case dayBtn38:
	case dayBtn39:
	case dayBtn40:
	case dayBtn41: {
		int temp = actionId;
		AppLog("DayBtn is clicked");
		AppLog("Btn Num is &d", temp);

		r = pList->Construct();
		{
			TryCatch(r == E_SUCCESS, , "Failed to construct the Array list.");
			CATCH: {
			}
		}

		r = pList->Add(*(new (std::nothrow) Boolean(__isServer)));
		{
			TryCatch(r == E_SUCCESS, ,
				"Failed to add the client/server to the Array list.");

		}

		r = pList->Add(*(new (std::nothrow) Integer(__iport)));
		TryCatch(r == E_SUCCESS, ,
				"Failed to add port number to the Array list.");

		r = pList->Add(*(new (std::nothrow) Boolean(__isProtocol)));
		TryCatch(r == E_SUCCESS, ,
				"Failed to add the protocol to the Array list.");

		r = pList->Add(*(new (std::nothrow) Integer(__year)));
		TryCatch(r == E_SUCCESS, , "Failed to add year to the Array list.");

		r = pList->Add(*(new (std::nothrow) Integer(__month)));
		TryCatch(r == E_SUCCESS, , "Failed to add month to the Array list.");

		String strTmp = __pDayBtn[actionId]->GetText();

		int day;
		r = Tizen::Base::Integer::Parse(strTmp, day);
		r = pList->Add(*new (std::nothrow) Integer(day));
		TryCatch(r == E_SUCCESS, , "Failed to add day to the Array list.");

		if (__pEnrollment != null) {
			delete __pEnrollment;
			__pEnrollment = null;
		}

		pSceneManager->GoForward(ForwardSceneTransition(SCENE_ENROLLMENT),
				pList);

	}
		break;

	default:
		break;
	}

	UpdateCalendarDisplay();

}
Exemplo n.º 21
0
void
ProfileListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
	if (status == LIST_ITEM_STATUS_SELECTED)
	{
	    AppLog("OnListViewItemLongPressed.2222");

	    SceneManager* pSceneManager = SceneManager::GetInstance();
		AppAssert(pSceneManager);

		ArrayList* pList = new (std::nothrow) ArrayList();
		pList->Construct();
	    result r= E_SUCCESS;
	    __currentIndex = index;

	    DbEnumerator* pEnum;
	    DbStatement* pStmt;

	    pStmt = __pProfileDatabase->CreateStatementN(L"SELECT title, "
	    		"year, month, day, hour, minute, "
	    		"year2, month2, day2, hour2, minute,2 "
	    				"latitude, longitude, volume, wifi, memo FROM profile WHERE id = ?");
	    Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(index));
	    pList->Add(*new (std::nothrow) Integer(index/**itemId*/));
	    r = pStmt->BindInt(0, itemId->ToInt());
	    pEnum = __pProfileDatabase->ExecuteStatementN(*pStmt);
	    if (pEnum) {
	        String title;
	        pEnum->MoveNext();
	        r = pEnum->GetStringAt(0, title);
		    pList->Add(*new (std::nothrow) String(title));
		    int intItem;
		    double item;
	        r = pEnum->GetIntAt(1, intItem);	//year
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(2, intItem);	//month
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(3, intItem);	//day
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(4, intItem);	//hour
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(5, intItem);	//minute
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(6, intItem);	//year2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(7, intItem);	//month2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(8, intItem);	//day2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(9, intItem);	//hour2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(10, intItem);	//minute2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetDoubleAt(11, item);	//latitude
		    pList->Add(*new (std::nothrow) Double(item));
	        r = pEnum->GetDoubleAt(12, item);	//longitude
		    pList->Add(*new (std::nothrow) Double(item));
	        r = pEnum->GetIntAt(13, intItem);	//volume
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(14, intItem);	//wifi
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetStringAt(15, title);	//memo
		    pList->Add(*new (std::nothrow) String(title));
	        delete pEnum;
	    }
	    delete pStmt;
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_DETAIL), pList);
	    __isUpdateMode = true;
	}
}
Exemplo n.º 22
0
void
FTrip::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		if (this->selecteditemid > 0) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->selecteditemid)));
			if (actionId == ID_EDIT) {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, list);
			} else {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPDETAIL, list);
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to edit.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_DELETE) {
		if (this->selecteditemid > 0) {
			MessageBox msgbox;
			int modalResult = 0;
			if (carconclass_->DeleteTripData(this->selecteditemid, true) == false) {
				msgbox.Construct("Can't delete trip!", "Trip is selected in reference table!", MSGBOX_STYLE_OK, 10000);
				msgbox.ShowAndWait(modalResult);
			} else {
				msgbox.Construct("Delete trip?", "Do you really want to delete trp?", MSGBOX_STYLE_YESNO, 10000);
				msgbox.ShowAndWait(modalResult);
				if (modalResult == MSGBOX_RESULT_YES) {
					Osp::Ui::Controls::Popup* pPopup_;
					pPopup_ = new Popup();
					Dimension dim(300, 50);
					pPopup_->Construct(true, dim);
					pPopup_->SetTitleText(L"Deleting please wait...");
					pPopup_->SetShowState(true);
					pPopup_->Show();
					carconclass_->DeleteTripData(this->selecteditemid);
					int selecteditemindex = pExList->GetItemIndexFromItemId(this->selecteditemid);
					if (selecteditemindex > -1) {
						pExList->RemoveItemAt(selecteditemindex);
					}
					this->selecteditemid = 0;
					pPopup_->SetShowState(false);
					delete pPopup_;
					RequestRedraw(true);
				}
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to delete.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_ADD) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, null);
	} else if (actionId == ID_BACK) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == ID_CLEARSEARCH) {
		SearchAction(L"");
	}
}
Exemplo n.º 23
0
/*****************************************************************************
* UnfoldedView - displays the unfolded cube in random orientation and layout
*
* The input cube faces are randomized in terms of their orientation and layout
* but the correct edge to edge mapping of the cube faces remains correct.  The
* resulting image is then drawn centered relative to the input XY-coordinates.
*
* RETURNS: NA
*/
void CJMCube::ConstructUnfoldedView(int x, int y)
	{
	Random *	rnd      = new Random();     // Random number generator
	ArrayList * workList = new ArrayList();  // Working array
	ArrayList * faceList = new ArrayList();  // Status of picked faces
	ArrayList * showList = new ArrayList();
	Int32		edgeMap  = 0;
	Int32		faceMap  = 0;
	Int32		i;
	Int32		face;
	Int32		pick;

	Bitmap *	newList[] = new Bitmap *[NUM_FACES];

	// Copy the reference set of cube faces into a working set

	for (i = 0; i < NUM_FACES; i++)
		{
		workList->Add(m_seedList[i]->Clone
			(
			RectangleF
				(
				0, 0, 
				static_cast<float> (m_seedList[i]->Width), 
				static_cast<float> (m_seedList[i]->Height)
				),
			Imaging::PixelFormat::DontCare)
			);

		faceList->Add(__box(Int32(i)));
		}

	// Randomly select faces and edges to be appended to selection item

	for (i = NUM_FACES; i > 0; i--)
		{
		// If only one face has been selected, the there are constraints on the
		// one which of the remaining faces can be selected.  For all other cases
		// any remaining face is a valid selection.

		while (true)
			{
			pick = ((int) (96 * rnd->NextDouble())) % faceList->Count;
			face = *(__try_cast<Int32 *>(faceList->get_Item(pick)));
			if ((faceMap ^ m_cubeRules.faceBits[face]) != 0)
				{
				faceList->RemoveAt(pick);        // Remove selected face from list
				faceMap |= m_cubeRules.faceBits[face];  // Update included faces
				break;
				}
			}

		SAssembly * ta = new SAssembly;
		ta->face = face;

		// Randomly select a valid edge to mate to assembly

		do
			{
			ta->edge = ((int) (96 * rnd->NextDouble())) % NUM_EDGES;
			int chkBit = m_cubeRules.edgeBit[face, ta->edge];
			if ((chkBit & edgeMap) != 0)
				break;
			} while (showList->Count > 0);

		edgeMap |= m_cubeRules.edgeBits[face];  // Update included edges

		ta->x    = x;
		ta->y    = y;
		ta->bmp  = __try_cast<Bitmap *> (workList->get_Item(face));
		showList->Add(ta);
		}
		
	ShowUnfoldedView(showList);

	workList->Clear();
	faceList->Clear();
	}