void SessionForm::OnTeamNameChange(const nim::TeamInfo& team_info)
{
	if (session_id_ == team_info.GetTeamID())
	{
		std::wstring name = nbase::UTF8ToUTF16(team_info.GetName());

		SetTaskbarTitle(name);
		label_title_->SetText(name);
	}
}
void MsgRecordForm::RefreshRecord(std::string id, nim::NIMSessionType type)
{
	if(id == session_id_)
		return;
	session_id_ = id;
	session_type_ = type;

	//初始化
	first_show_msg_ = true;
	last_msg_time_ = 0;
	farst_msg_time_ = 0;
	last_server_id_ = 0;

	has_more_ = true;
	is_loading_ = false;

	std::wstring name;
	if (type == nim::kNIMSessionTypeP2P)
		name = UserService::GetInstance()->GetUserName(id);
	else
		name = TeamService::GetInstance()->GetTeamName(id);
	label_title_->SetText(name);
	SetTaskbarTitle(name);

	msg_list_->RemoveAll();
	id_bubble_pair_.clear();

	std::string play_sid = AudioCallback::GetPlaySid();
	std::wstring wsid = nbase::UTF8ToUTF16(play_sid);
	if(GetWindowId() == wsid)
	{
		AudioCallback::SetPlaySid("");
		AudioCallback::SetPlayCid("");

		nim_audio::Audio::StopPlayAudio();
	}

	if (type == nim::kNIMSessionTypeTeam)
	{
		nim::Team::QueryTeamMembersCallback cb = ToWeakCallback([this](const std::string& tid, int member_count, const std::list<nim::TeamMemberProperty>& props) 
		{
			team_member_info_list_.clear();
			for (const auto &info : props)
				team_member_info_list_[info.GetAccountID()] = info;
			ShowMore(false);
		});
		nim::Team::QueryTeamMembersAsync(session_id_, cb);
	}
	else
		ShowMore(false);
}
void CustomMsgForm::InitWindow()
{
	if (nim_ui::UserConfig::GetInstance()->GetDefaultIcon() > 0)
		SetIcon(nim_ui::UserConfig::GetInstance()->GetDefaultIcon());

	SetTaskbarTitle(L"自定义消息通知");
	m_pRoot->AttachBubbledEvent(ui::kEventClick, nbase::Bind(&CustomMsgForm::OnClicked, this, std::placeholders::_1));

	richedit_apns_ = (RichEdit*)FindControl(L"re_apns");
	richedit_msg_ = (RichEdit*)FindControl(L"re_msg");
	richedit_attach_ = (RichEdit*)FindControl(L"re_attach");
	rec_name_ = (Label*)FindControl(L"receiver");
	msg_mode_ = (CheckBox*)FindControl(L"msg_mode");
}
Exemple #4
0
void RtsForm::ShowHeader()
{
	std::wstring name = UserService::GetInstance()->GetUserName(uid_);
	Label* friend_name = (Label*)FindControl(L"friend_name");
	friend_name->SetText(name);

	std::wstring title_text = L"与" + name + L"的白板";
	SetTaskbarTitle(title_text);
	Label* title = (Label*)FindControl(L"title");
	title->SetText(title_text);

	std::wstring photo = PhotoService::GetInstance()->GetUserPhoto(uid_);
	Button* headicon = (Button*)FindControl(L"headicon");
	headicon->SetBkImage(photo);
}
void TeamEventForm::InitWindow()
{
	if (nim_ui::UserConfig::GetInstance()->GetIcon() > 0)
	{
		SetIcon(nim_ui::UserConfig::GetInstance()->GetIcon());
	}

	SetTaskbarTitle(L"消息中心");
	m_pRoot->AttachBubbledEvent(ui::kEventAll, nbase::Bind(&TeamEventForm::Notify, this, std::placeholders::_1));
	m_pRoot->AttachBubbledEvent(ui::kEventClick, nbase::Bind(&TeamEventForm::OnClicked, this, std::placeholders::_1));

	((OptionBox*)FindControl(L"btn_sysmsg_list"))->Selected(true, true);

	btn_recycle_ = (Button*) FindControl(L"btn_recycle");
	event_list_ = (ListBox*)FindControl(L"event_list");
	custom_list_ = (ListBox*)FindControl(L"custom_list");

	GetMoreCustomMsg();
}
void SessionForm::OnGetTeamInfoCb(const std::string& tid, const nim::TeamInfo& result)
{
	team_info_ = result;

	std::wstring wname = nbase::UTF8ToUTF16(team_info_.GetName());
	if (!wname.empty())
	{
		SetTaskbarTitle(wname);
		label_title_->SetText(wname);
	}

	bool valid = team_info_.IsValid();
	if (!valid)
	{
		LeaveTeamHandle();
		return;
	}
	else
	{
		EnterTeamHandle();
	}

	if (team_info_.GetType() == nim::kNIMTeamTypeAdvanced)
	{
		AdjustSizeForAdvancedTeam();
		Json::Value json;
		if (StringToJson(team_info_.GetAnnouncement(), json))
		{
			UpdateBroad(json);
		}
		else
		{
			re_broad_->SetUTF8Text(team_info_.GetAnnouncement());
		}
		CheckTeamType(nim::kNIMTeamTypeAdvanced);
		//member
		InvokeGetTeamMember();
	}

	btn_header_->SetEnabled(true);
}
void RtsReplay::InitWindow()
{
	std::wstring title_text = L"白板回放";
	SetTaskbarTitle(title_text);
	Label* title = (Label*)FindControl(L"title");
	title->SetText(title_text);

	m_pRoot->AttachBubbledEvent(ui::kEventAll, nbase::Bind(&RtsReplay::Notify, this, std::placeholders::_1));
	m_pRoot->AttachBubbledEvent(ui::kEventClick, nbase::Bind(&RtsReplay::OnClicked, this, std::placeholders::_1));

	board_ = (BoardControl*)FindControl(L"board");
	mine_slider_ = (Slider*)FindControl(L"mine_prg");
	other_slider_ = (Slider*)FindControl(L"other_prg");
	mine_size_label_ = (Label*)FindControl(L"mine_size");
	other_size_label_ = (Label*)FindControl(L"other_size");
	mine_pos_label_ = (Label*)FindControl(L"mine_pos");
	other_pos_label_ = (Label*)FindControl(L"other_pos");

	ReShowInfo(false);
	ReShowInfo(true);
}