bool CameraCapture::OnAppInitializing(AppRegistry& appRegistry) { result r = E_SUCCESS; IAppFrame* pAppFrame = GetAppFrame(); if (NULL == pAppFrame) { AppLog("GetAppFrame has failed.."); goto CATCH; } __pFrame = pAppFrame->GetFrame(); if (!__pFrame) { AppLog("GetFrame has failed.."); goto CATCH; } // initialize forms __pMainForm = new MainForm(); if( !__pMainForm ) { AppLog( ">>>>>> MainForm creation has failed."); return false; } //------------------------------ // Construct form //------------------------------ if( __pMainForm->Construct() != E_SUCCESS ) { AppLog( ">>>>>> Construct has failed."); goto CATCH; } //------------------------------ // Attach Form to Frame //------------------------------ r = __pFrame->AddControl( *__pMainForm ); if( IsFailed(r)) { AppLog( ">>>>>> Adding MainForm has failed."); goto CATCH; } __pFrame->SetCurrentForm( *__pMainForm ); // You should comment following statement if you do not listen to the screen on/off events. PowerManager::SetScreenEventListener(*this); return true; CATCH: if ( __pMainForm ) delete __pMainForm; return false; }
result badaJS::__CreateWebForm(void) { result r = E_SUCCESS; Rectangle bound; IAppFrame* pAppFrame = GetAppFrame(); if (NULL == pAppFrame) { AppLog("GetAppFrame() has failed.\n"); goto CATCH; } /*form*/ __pMainForm = new Form(); r = __pMainForm->Construct(FORM_STYLE_SOFTKEY_1|FORM_STYLE_INDICATOR); TryCatch(r == E_SUCCESS, , "form is not constructed\n "); __pMainForm->SetBackgroundColor(Color(85,104,114)); __pMainForm->SetSoftkeyText (SOFTKEY_1 , L"Exit"); __pMainForm->SetSoftkeyActionId (SOFTKEY_1, AC_SOFTKEY_EXIT); __pMainForm->AddSoftkeyActionListener (SOFTKEY_1, *this); pAppFrame->GetFrame()->AddControl(*__pMainForm); /*Web*/ __pWeb = new Web(); r = __pWeb->Construct(Rectangle(0, 0, 480, 760)); TryCatch(r == E_SUCCESS, ,"Web is not constructed\n "); r = __pMainForm->AddControl(*__pWeb); TryCatch(r == E_SUCCESS, ,"Web is not attached\n "); __pWeb->SetFocus(); __pWeb->LoadUrl(L"/Res/index.html"); //__pWeb->EvaluateJavascriptN(L"alert('aaa');"); return r; CATCH: AppLog("Error = %s\n", GetErrorMessage(r)); return r; }