void UserProfileForm::OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen) { AppLogDebug("OnTransactionReadyToRead,..availableBodyLen=%d",availableBodyLen); count++; HttpResponse* pHttpResponse = httpTransaction.GetResponse(); if(pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK) { __pBuffer = pHttpResponse->ReadBodyN(); } if(__pProfileName==NULL) { ParseJsonData(); Label *pLabel = new Label(); String labelText(L"Welcome "); labelText.Append(*__pProfileName); AppLog("labelText is =%ls",labelText.GetPointer()); pLabel->Construct(Rectangle(05, 50, 500, 100), labelText); AddControl(*pLabel); Draw(); Show(); __pSession->CloseTransaction(httpTransaction); delete __pSession; __pSession = null; } //Get Profile Picture String imageurl; imageurl.Append(L"https://graph.facebook.com/me"); imageurl.Append(L"/picture?"); imageurl.Append(L"access_token="); imageurl.Append(__accessToken); SendRequestGet(imageurl); __pProfileImage = new Image(); __pProfileImage->Construct(); Bitmap *pBitmap; pBitmap=__pProfileImage->DecodeN(*__pBuffer,IMG_FORMAT_JPG,BITMAP_PIXEL_FORMAT_ARGB8888,150,150); Label *pImageLabel = new Label(); pImageLabel->Construct(Rectangle(150,150, 150, 150),""); pImageLabel->SetBackgroundBitmap(*pBitmap); AddControl(*pImageLabel); Button* pGetFriends = new Button(); pGetFriends->Construct(Rectangle(30,330, 350, 70), L"Get Friends"); pGetFriends->SetActionId(ID_BUTTON_FRIENDS_CLICKED); pGetFriends->AddActionEventListener(*this); AddControl(*pGetFriends); Button* pLogout = new Button(); pLogout->Construct(Rectangle(30,430, 350, 70), L"Logout"); pLogout->SetActionId(ID_BUTTON_LOGOUT_CLICKED); pLogout->AddActionEventListener(*this); AddControl(*pLogout); Draw(); Show(); }
result SettingForm::OnInitializing(void) { result r = E_SUCCESS; // TODO: Add your initialization code here FooterItem footerItem[5]; AppResource* pAppResource = Application::GetInstance()->GetAppResource(); Image inActivation_Image[5]; String inActivation_Path[5]; Image Activation_Image[5]; String Activation_Path[5]; for(int i=0; i<5; i++) { inActivation_Image[i].Construct(); inActivation_Path[i] = App::GetInstance()->GetAppResourcePath(); Activation_Image[i].Construct(); Activation_Path[i] = App::GetInstance()->GetAppResourcePath(); } inActivation_Path[0] += L"screen-density-xhigh/TimeLine_InAct.png"; Activation_Path[0] += L"screen-density-xhigh/TimeLine_Act.png"; footerItem[0].Construct(ID_FOOTER_ITEM1); footerItem[0].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[0].DecodeN(inActivation_Path[0], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[0].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[0].DecodeN(Activation_Path[0], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[1] += L"screen-density-xhigh/Chatting_InAct.png"; Activation_Path[1] += L"screen-density-xhigh/Chatting_Act.png"; footerItem[1].Construct(ID_FOOTER_ITEM2); footerItem[1].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[1].DecodeN(inActivation_Path[1], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[1].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[1].DecodeN(Activation_Path[1], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[2] += L"screen-density-xhigh/PartnerList_InAct.png"; Activation_Path[2] += L"screen-density-xhigh/PartnerList_Act.png"; footerItem[2].Construct(ID_FOOTER_ITEM3); footerItem[2].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[2].DecodeN(inActivation_Path[2], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[2].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[2].DecodeN(Activation_Path[2], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[3] += L"screen-density-xhigh/PartnerResearch_InAct.png"; Activation_Path[3] += L"screen-density-xhigh/PartnerResearch_Act.png"; footerItem[3].Construct(ID_FOOTER_ITEM4); footerItem[3].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[3].DecodeN(inActivation_Path[3], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[3].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[3].DecodeN(Activation_Path[3], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[4] += L"screen-density-xhigh/Setting_InAct.png"; Activation_Path[4] += L"screen-density-xhigh/Setting_Act.png"; footerItem[4].Construct(ID_FOOTER_ITEM5); footerItem[4].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, inActivation_Image[4].DecodeN(inActivation_Path[4], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[4].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, Activation_Image[4].DecodeN(Activation_Path[4], BITMAP_PIXEL_FORMAT_ARGB8888)); Label* pLabel; pLabel = new Label(); pLabel->Construct(Rectangle(0,0,this->GetWidth(),this->GetHeight()),L""); AppLog("%d ,,,,%d", this->GetWidth(),this->GetHeight()); pLabel->SetBackgroundBitmap(*pAppResource->GetBitmapN(L"fakepicture.png")); pLabel->Draw(); AddControl(pLabel); Footer* pFooter = GetFooter(); if (pFooter) { pFooter->AddActionEventListener(*this); } pFooter->AddItem(footerItem[0]); pFooter->AddItem(footerItem[1]); pFooter->AddItem(footerItem[2]); pFooter->AddItem(footerItem[3]); pFooter->AddItem(footerItem[4]); // Setup back event listener SetFormBackEventListener(this); // Get a button via resource ID return r; }