Example #1
0
void CLoginWnd::GetData()
{
	CEditUI* pAccount = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("account")));
	m_strAccount = pAccount->GetText();
	CEditUI* pWord = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("password")));
	m_strPassWord = pWord->GetText();
	COptionUI* pLeft = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("remember")));
	m_IsLeftSelected = pLeft->IsSelected();
	COptionUI* pRight = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("autolog")));
	m_IsRightSeleced = pRight->IsSelected();
}
Example #2
0
void CLoginWnd::Notify(TNotifyUI& msg)
{
	if (msg.sType ==DUI_MSGTYPE_CLICK)
	{
		CDuiString str = msg.pSender->GetName();
		if ( str == _T("configbtn"))
		{
			CConfigWnd* pConfig = new CConfigWnd;
			pConfig->Create(NULL,_T("服务器配置"),UI_WNDSTYLE_FRAME,WS_EX_WINDOWEDGE);
			pConfig->CenterWindow();
			pConfig->ShowModal();
			delete pConfig;
		}
		else if ( str == _T("login"))
		{
			Login();
		}

	}
	if (msg.sType == DUI_MSGTYPE_SELECTCHANGED)
	{
		if (msg.pSender->GetName()==_T("autolog"))
		{
			COptionUI* pLeft = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("remember")));
			COptionUI* pRight = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("autolog")));
			if (!pLeft->IsSelected())
			{
				pLeft->Selected(true);
			}
		}
	}
	return WindowImplBase::Notify(msg);
}
Example #3
0
void CDuiFrameWnd::DeleteFileItem()
{
	COptionUI* pOption = NULL;
	CVerticalLayoutUI* pLayout = (CVerticalLayoutUI*)m_PaintManager.FindControl(_T("playlist"));
	int nIndex = pLayout->GetCount();

	for (int i = 0; i < nIndex;i++)
	{
		pOption = (COptionUI*)pLayout->GetItemAt(i);
		if (pOption->IsSelected())
		{
			CDuiString strPath = pOption->GetUserData();
			m_cPlayList.deleteFile(strPath.GetData());
			pLayout->RemoveAt(i);
			break;
		}

	}


}
Example #4
0
void CProjectInfoPage::Notify( TNotifyUI& msg )
{
	if (0 == _tcsicmp(DUI_MSGTYPE_WINDOWINIT, msg.sType))
	{
		HandleWindowInitEvent(msg);
	}

	if (msg.sType != DUI_MSGTYPE_CLICK )
	{
		return;
	}

	DuiLib::CDuiString strName = msg.pSender->GetName();

	//"第一页"
	if (_tcsicmp(strName.GetData(), "btn_page_first") == 0)
	{
		if (!IsCacheEmpty()&& !IsFirstPage())
		{
			GotoPage(1);
		}	
	}
	//"上一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_prev") == 0)
	{
		if (!IsCacheEmpty() && !IsFirstPage())
		{
			if (m_nCurrentPageIndex>1)
			{
				GotoPage(m_nCurrentPageIndex-1);
			}
		}
	}
	//"下一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_next") == 0)
	{
		if (!IsCacheEmpty() && !IsEndPage())
		{
			if (m_nCurrentPageIndex<m_nEndPageIndex)
			{
				GotoPage(m_nCurrentPageIndex+1);
			}
		}
	}
	//"最后一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_end") == 0)
	{
		if (!IsCacheEmpty()&& !IsEndPage())
		{
			if (m_nEndPageIndex>0)
			{
				GotoPage(m_nEndPageIndex);
			}	
		}
	}
	//1--10页按钮
	else if (strName.Find("btn_page_")>=0)
	{
		//tstring strSearch = "btn_page_";
		//tstring strBtnIndex = strName.Right(strName.GetLength()-strSearch.length());
		//int nIndex = atoi(strBtnIndex.c_str());

		int nIndex = atoi(msg.pSender->GetText());
		GotoPage(nIndex);
		return;
	}

	if (_tcsicmp(strName.GetData(), "OptionToday") == 0)
	{
		time_t tToday = time(0);
		FetchProjects(GetYMDTimeString(tToday));
	}
	else if (_tcsicmp(strName.GetData(), "OptionWeek") == 0)
	{
		time_t tToday = time(0);
		time_t tOneWeekAgo = tToday - const_one_week_seconds;
		FetchProjects(GetYMDTimeString(tOneWeekAgo));
	}
	else if (_tcsicmp(strName.GetData(), "OptionMonth") == 0)
	{
		time_t tToday = time(0);
		time_t tOneMonthAgo = tToday - const_one_month_seconds;
		FetchProjects(GetYMDTimeString(tOneMonthAgo));
	}
	else if (_tcsicmp(strName.GetData(), "OptionAll") == 0)
	{
		FetchProjects(tstring(_T("")));
	}
	else if (msg.pSender->GetName() == "btn_get_project_info")
	{
		sProjectItem* pData = (sProjectItem*)msg.pSender->GetParent()->GetParent()->GetParent()->GetTag();
		if (NULL != pData)
		{
			CFrameBusinessData::Instance()->ShowWindow(true);
			CFrameBusinessData::Instance()->setProjectItem(pData);
		}
	}
	else if (msg.pSender->GetName() == "btn_bussiness_chat")
	{
		sProjectItem* pData = (sProjectItem*)msg.pSender->GetParent()->GetParent()->GetParent()->GetTag();
		if (NULL != pData)
		{
			//没有创建房间,就需要重新选人。
			if (pData->strRoomID.empty())
			{
				
				CAddNewGroupMember* pAddGroupMemWnd = new CAddNewGroupMember(m_PaintManager);
				if (NULL != pAddGroupMemWnd)
				{
					pAddGroupMemWnd->SetShowMode(true);
					pAddGroupMemWnd->CreateWnd();
					pAddGroupMemWnd->Initialize();//初始化一次。
				}
				
				//bool bWithProperty = m_pComboResProperty->GetCurSel() == 1;
				pAddGroupMemWnd->SetResProperty(false, pData->strProjID, pData->strProjName);
				pAddGroupMemWnd->ShowWindow(true);
			}
			else
			{
				//我有可能不是这个群里面的成员,就需要判断下。如果我不是这个群里面的人,就不能进去。
				tstring strMyPhone = CController::Instance()->GetXmppClient()->jid().username();
				tstring strMyAccount = strMyPhone+MMPC_ACCOUNT;
				if(CController::Instance()->GetRoomManager()->IsInThisRoom(pData->strRoomID, strMyAccount ))
				{
					CController::Instance()->GetRoomManager()->EnterRoom(pData->strRoomID, strMyPhone);
					if (pData->strDestOrgID.empty() && pData->strDestOrgName.empty())
					{
						if (pData->vecDestParticipants.size()>0)
						{
							mainDlg::getInstance()->OnShowGroupChatWnd_Personal(pData->vecDestParticipants[0], pData->strRoomID);
						}
					}
					else
					{
						mainDlg::getInstance()->OnShowGroupChatWnd(pData->strDestOrgID, pData->strDestOrgName, pData->strRoomID);
					}
				}
				else
				{
					CMsgBox* pMsgBox = new CMsgBox("错误","您不是该群组成员!");
					pMsgBox->ShowModal();
				}
			}
			
		}		
	}	
	//增加搜索功能 by HQ 20160519
	else if (msg.pSender->GetName() == "btn_Search")
	{	
		COptionUI* OptionToday = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionToday"));
		COptionUI* OptionWeek = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionWeek"));
		COptionUI* OptionMonth = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionMonth"));
		COptionUI* OptionAll = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionAll"));

		tstring sSelectedTime=(_T(""));
		if (OptionToday->IsSelected())
		{
			time_t tToday = time(0);
			sSelectedTime = GetYMDTimeString(tToday);
		}
		else if (OptionWeek->IsSelected())
		{
			time_t tToday = time(0);
			time_t tOneWeekAgo = tToday - const_one_week_seconds;
			sSelectedTime = GetYMDTimeString(tOneWeekAgo);
		}
		else if (OptionMonth->IsSelected())
		{
			time_t tToday = time(0);
			time_t tOneMonthAgo = tToday - const_one_month_seconds;
			sSelectedTime = GetYMDTimeString(tOneMonthAgo);
		}
		else if (OptionAll->IsSelected())
		{
			//do nothing...
		}

		CEditUI* edtSearchString = static_cast<CEditUI*>(m_PaintManager->FindControl("edt_SearchString"));
		tstring sSearchString = edtSearchString->GetText();

		//允许空字符串查询 by HQ 20160519
		//if(sSearchString == "")
		//{
		//	CMsgBox* pMsgBox = new CMsgBox("错误","请输入查找条件!");
		//	pMsgBox->ShowModal();
		//	edtSearchString->SetFocus();
		//}
		//else
		//{
			FetchProjects(sSelectedTime,sSearchString);
		//}
	}	
}
Example #5
0
NSDUILIB_API void  TBCIASendMessage(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
	HWND hwnd = (HWND)popint();
	TCHAR msgID[MAX_PATH];
	TCHAR wParam[MAX_PATH];
	TCHAR lParam[MAX_PATH];

	EXDLL_INIT();

 	ZeroMemory(msgID, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(wParam, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(lParam, MAX_PATH*sizeof(TCHAR));

	DEBUG_INFO("to send message stringsize %d MAX_PATH %d\n",g_stringsize,MAX_PATH);
	popstring( msgID,sizeof(msgID) );
	popstring( wParam,sizeof(wParam) );
	popstring( lParam ,sizeof(lParam));

	if( _tcsicmp( msgID, _T("WM_TBCIAMIN")) == 0 )
		::SendMessage( hwnd, WM_TBCIAMIN, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIACLOSE")) == 0 )
		::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIABACK")) == 0 )
		::SendMessage( hwnd, WM_TBCIABACK, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIANEXT")) == 0 )
		::SendMessage( hwnd, WM_TBCIANEXT, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIACANCEL")) == 0 )
	{
		LPCTSTR lpTitle = (LPCTSTR)wParam;
		LPCTSTR lpText = (LPCTSTR)lParam;
		DEBUG_BUFFER_FMT(lpTitle,_tcslen(lpTitle) + sizeof(TCHAR),"lpTitle :");
		DEBUG_BUFFER_FMT(lpText,_tcslen(lpText) + sizeof(TCHAR),"lpText :");
		if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
		{
			pushint( 0 );
			::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
		}
		else
			pushint( -1 );
	}
	else if (_tcsicmp( msgID, _T("WM_QAUERYCANCEL")) == 0)
	{
		LPCTSTR lpTitle = (LPCTSTR)wParam;
		LPCTSTR lpText = (LPCTSTR)lParam;
		if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
		{
			pushint( 0 );
		}
		else
			pushint( -1 );
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIASTARTINSTALL")) == 0 )
	{
		::SendMessage( hwnd, WM_TBCIASTARTINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIASTARTUNINSTALL")) == 0 )
		::SendMessage( hwnd, WM_TBCIASTARTUNINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIAFINISHEDINSTALL")) == 0 )
		::SendMessage( hwnd, WM_TBCIAFINISHEDINSTALL, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIAOPTIONSTATE")) == 0 ) // 返回option的状态
	{
		COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
		if( pOption == NULL )
			return;
		DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
		pushint(  pOption->IsSelected() );
	}
	else if (_tcsicmp( msgID, _T("WM_TBCIASETSTATE")) == 0)
	{
		COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
		if( pOption == NULL )
			return;
		if (_tcsicmp(lParam,_T("1"))== 0)
		{
			pOption->Selected(true);
		}
		else
		{
			pOption->Selected(false);
		}
		DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
		pOption->PaintStatusImage(g_pFrame->GetPaintManager().GetPaintDC());
		pushint(  pOption->IsSelected() );
	}
	else if (_tcsicmp(msgID,_T("WM_TBCIAEXIT"))==0)
	{
		::SendMessage(hwnd,WM_CLOSE,0,0);
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIAOPENURL")) == 0 )
	{
		CDuiString url = (CDuiString)wParam;
		if( url.Find( _T("https://") ) == -1  &&
			url.Find(_T("http://")) == -1)
		{
			pushstring( _T("url error") );
			return;
		}
		CDuiString lpCmdLine = _T("explorer \"");
		lpCmdLine += url;
		lpCmdLine += _T("\"");
		USES_CONVERSION;
		char strCmdLine[MAX_PATH];
#ifdef _UNICODE
		wcstombs(strCmdLine,lpCmdLine.GetData(),MAX_PATH);
#else
		strncpy(strCmdLine,lpCmdLine.GetData(),MAX_PATH);
#endif
		WinExec( strCmdLine, SW_SHOWNORMAL);
	}
}
void MainFrame::Notify(TNotifyUI& msg)
{
	if (_tcsicmp(msg.sType, kWindowInit) == 0)
	{
		OnPrepare(msg);
	}
	else if (_tcsicmp(msg.sType, kClick) == 0)
	{
		if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0 || _tcsicmp(msg.pSender->GetName(), kCancelButtonControlName) == 0)
		{
			OnExit(msg);
		}
		else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_MINIMIZE);
#else
			SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_MAXIMIZE);
			CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
			if( pControl ) pControl->SetVisible(false);
			pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
			if( pControl ) pControl->SetVisible(true);
#else
			SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0)
		{
#if defined(UNDER_CE)
			::ShowWindow(m_hWnd, SW_RESTORE);
			CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
			if( pControl ) pControl->SetVisible(true);
			pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
			if( pControl ) pControl->SetVisible(false);
#else
			SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0);
#endif
		}
		else if (_tcsicmp(msg.pSender->GetName(), _T("select_all_btn")) == 0)
		{
			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if (pDriver != NULL)
					pDriver->Selected(true);
			}
		}
		else if (_tcsicmp(msg.pSender->GetName(), _T("uninstall_btn")) == 0)
		{
			vector<tString> deleted_printer_driver;
			DWORD dwError = 0;
			TCHAR szBuf[MAX_PATH] = {0};

			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if ((pDriver != NULL) && pDriver->IsSelected())
				{
					// 涉及到的API: DeletePrinter DeletePrinterDriver
					HANDLE hPrinter = NULL;
					_stprintf_s(szBuf, MAX_PATH - 1, pDriver->GetText().GetData());
					PRINTER_DEFAULTS PrtDefault = {NULL, NULL, PRINTER_ALL_ACCESS};
					OpenPrinter(szBuf, &hPrinter, &PrtDefault);
					if (hPrinter != NULL)
					{
						DWORD dwNeeded = 0;
						GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
						LPBYTE lpBuffer = (LPBYTE)malloc(dwNeeded);
						if (lpBuffer != NULL)
						{
							GetPrinter(hPrinter, 2, lpBuffer, dwNeeded, &dwNeeded);

							DeletePrinter(hPrinter);

							dwError = GetLastError();

							vector<tString>::const_iterator citer = find(deleted_printer_driver.begin(), deleted_printer_driver.end(), ((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							if (citer == deleted_printer_driver.end())
							{
								deleted_printer_driver.push_back(((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							}

							ClosePrinter(hPrinter);
							free(lpBuffer);
						}
					}
				}
			}
			for (vector<tString>::const_iterator citer = deleted_printer_driver.begin(); citer != deleted_printer_driver.end(); ++citer)
			{
				_stprintf_s(szBuf, MAX_PATH - 1, citer->c_str());
				DeletePrinterDriver(NULL, NULL, szBuf);

				dwError = GetLastError();
			}
			RestartSpoolsv();
			EnumInstalledDriver();

			if (IDYES == DUIMessageBox(m_hWnd, _T("注意:您需要重新启动计算机使设置生效,现在需要重启计算机吗?点击“是”立即重启计算机,点击“否”稍后您自己手动重启计算机。"), _T("重新启动计算机"), MB_YESNO))
				SystemReboot();
		}
	}
	else if (_tcsicmp(msg.sType, kTimer) == 0)
	{
		return OnTimer(msg);
	}
}