void CRtcSampleDlg::OnBnClickedButtonJoinChannel()

in AliRTC2.5/Windows/MFC Demo/RtcSample/RtcSampleDlg.cpp [308:386]


void CRtcSampleDlg::OnBnClickedButtonJoinChannel()
{
	UpdateData(TRUE);

	bool bRet = false;

	if (m_strChannelId == "请输入频道ID[3-12位数字]" || 0 == m_strChannelId.GetLength())
	{
		m_strChannelText = "请先输入频道ID...";
		bRet = true;

		UpdateData(FALSE);
		SetTimer(TIMER_TIPS_CHANNELID, 5000, NULL);
	}

	if (m_strUserName == "请输入用户ID" || 0 == m_strUserName.GetLength())
	{
		m_strUserText = "请先输入用户ID...";
		bRet = true;

		UpdateData(FALSE);
		SetTimer(TIMER_TIPS_USERID, 5000, NULL);
	}

	if (true == bRet) return;
		
	CRTCSampleMainInterface dlg;
	dlg.m_sLoginInfo.s_strServerAddr = m_strServerAddr;
	dlg.m_sLoginInfo.s_strRoomID = m_strChannelId;
	dlg.m_sLoginInfo.s_strUserID = m_strUserName;
	dlg.m_sLoginInfo.s_strPasswd = "hello1234";

	if(TRUE == m_bH5CompatibleMode)
		dlg.m_sLoginInfo.s_bH5CompatibleMode = true;
	else
		dlg.m_sLoginInfo.s_bH5CompatibleMode = false;

	if(TRUE == m_bAutoPublish)
		dlg.m_sLoginInfo.s_bAutoPublish = true;
	else
		dlg.m_sLoginInfo.s_bAutoPublish = false;

	if(TRUE == m_bAutoSubscribe)
		dlg.m_sLoginInfo.s_bAutoSubscribe = true;
	else
		dlg.m_sLoginInfo.s_bAutoSubscribe = false;

	if(TRUE == m_bPushAudio)
		dlg.m_sLoginInfo.s_bPushAudio = true;
	else
		dlg.m_sLoginInfo.s_bPushAudio = false;

	if (TRUE == m_bPushVideo)
		dlg.m_sLoginInfo.s_bPushVideo = true;
	else
		dlg.m_sLoginInfo.s_bPushVideo = false;

	if (TRUE == m_bPushSimulcast)
		dlg.m_sLoginInfo.s_bPushSimulcast = true;
	else
		dlg.m_sLoginInfo.s_bPushSimulcast = false;

	dlg.m_sLoginInfo.s_strRoomTitle.Format("AliRTCSample[当前频道:%s  本地用户名:%s]", m_strChannelId, m_strUserName);

	ShowWindow(SW_HIDE);

	int iStatus = dlg.DoModal();

	ShowWindow(SW_SHOW);

	if (iStatus != IDOK)
	{
		if (IDOK == MessageBox("是否关闭?", "AliTRCSample", MB_OKCANCEL))
		{
			::SendMessage(AfxGetMainWnd()->m_hWnd, WM_CLOSE, 0, 0);
		}
			
	}
}