void VKUDialogsPanel::OnRefresh() { pProvider->LoadData(); Frame* frame = VKUApp::GetInstance()->GetFrame(FRAME_NAME); Form* form = frame->GetCurrentForm(); if (form->GetName() == IDF_MAIN) { VKUMainForm *mainForm = dynamic_cast<VKUMainForm *>(form); if(mainForm != null) { mainForm->UpdateCounters(); } } }
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; }