+ else
+ {
+ UiApp* pApp = null;
+ WindowInfo* pWindowInfo = null;
+ int totalCount = 0;
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager == null)
+ {
+ return;
+ }
+ ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
+ if (pAllWindowList == NULL)
+ {
+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->Terminate();
+ if (IsFailed(r))
+ {
+ AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ }
+ totalCount = pAllWindowList->GetCount();
+
+ for (int count = 0; count < totalCount; count++)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+ if (pWindowInfo == null)
+ {
+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->Terminate();
+ if (IsFailed(r))
+ {
+ AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ }
+ if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
+ {
+ r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
+ if (IsFailed(r))
+ {
+ AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+ return;
+ }
+ r = pAllWindowList->RemoveAt(count, true);
+ __pWindowInfo = null;
+ if (IsFailed(r))
+ {
+ AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+ return;
+ }
+ if(count > 0)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
+ }
+ else
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+ }
+ if (pWindowInfo == null)
+ {
+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->Terminate();
+ return;
+ }
+ }
+ else
+ {
+ r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+ if (IsFailed(r))
+ {
+ AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ break;
+ }
+
+ }
+
+ }
+