Exemple #1
0
//return -1: user break;
//return 0: no error
//return 1: lpPath is invalid
//return 2: can not create lpPath
int CPathDialog::MakeSurePathExists(LPCTSTR lpPath)
{
	INXString strMsg;
	int iRet;
	try
	{
		//validate path
		iRet=Touch(lpPath, TRUE);
		if(iRet!=0)
		{
			throw iRet;
		}

		if(_taccess(lpPath, 0)==0)
		{
			return (int)0;
		}

		strMsg.Format(c_FolderDoesNotExist, lpPath);
		if(AfxMessageBox(strMsg, MB_YESNO|MB_ICONQUESTION) != IDYES)
		{
			return (int)-1;
		}

		//create path
		iRet=Touch(lpPath, FALSE);
		if(iRet!=0)
		{
			throw iRet; 
		}

		return 0;
	}
	catch(int nErrCode)
	{
		switch(nErrCode)
		{
		case 1:
			strMsg.Format(c_szErrInvalidPath, lpPath);
			break;
		case 2:
		default:
			strMsg.Format(c_szErrCreatePath, lpPath);
			break;
		}

		AfxMessageBox(strMsg, MB_OK|MB_ICONEXCLAMATION);

	}

	return iRet;
}
Exemple #2
0
// This function assigns a line ID to the ouput or finish port
void SODL::AssignLineID2OtherPort(ConData *blob, int portType, int portNum, long lineID) {
	long othericonid = -1;
	int otherportno = 0;
	static int stop_checking = 0; //This is messy but prevents too many user prompts.
	int response;

	ConData *blob2;
	
	if (portType == INPUTPORT) {
		othericonid = blob->inputport[portNum]->line.othericonid;
		otherportno = blob->inputport[portNum]->line.otherportno;
	}
	else if (portType == STARTPORT) {
		othericonid = blob->startport[portNum]->line.othericonid;
		otherportno = blob->startport[portNum]->line.otherportno;
	}

	//	kwhite - Handle null object if widget file corrupt or missing
	if ( (blob2 = GetFlatIconFromID(othericonid)) == NULL)
	{
		INXString message;
		message.Format("Missing component linked to %s ID %d.\nThe Application may not work as expected.\nPlease seek assistance from nCapsa.\nContinue?", blob->description, blob->identnum);
		if(stop_checking==0)
			response = AfxMessageBox(message ,MB_YESNO);

		if (response == IDNO) 
			stop_checking = 1;	
		
		return;
	}

	// set the line id in the appropriate output port
	if (portType == INPUTPORT) {
		blob2->outputport[otherportno]->setLineID(lineID);
	}
	else if (portType == STARTPORT) {
		blob2->finishport[otherportno]->setLineID(lineID);
	}

}