void medOpIterativeRegistration::OnEventThis(mafEventBase *maf_event)
{ 
  if(mafEvent *e = mafEvent::SafeDownCast(maf_event))
  {
    switch(e->GetId())
  {
    case ID_CHOOSE_TARGET:
    {
      mafString title = _("Choose target vme");
      mafEvent e(this,VME_CHOOSE,&title,(long)&medGUILandmark::VmeAccept);
      mafEventMacro(e); 
      m_TargetVME = mafVME::SafeDownCast(e.GetVme());
      if (m_TargetVME)
      {
        m_GuiLandmark[TARGET]->SetInputVME(m_TargetVME);
        m_GuiLandmark[TARGET]->SetGUIStatusToPick();
        m_Gui->Enable(ID_CHOOSE_TARGET, false);
        m_TargetVmeName = m_TargetVME->GetName();
        m_Gui->Update();
      } 
      
    }
    break;

    case ID_REGISTER:
    {
      OnRegister(e);
    }
    break;
 
    case wxOK:
    {
      this->OpStop(OP_RUN_OK);
      return;
    }
    break;

    case wxCANCEL:
    { 
      OpUndo();
      this->OpStop(OP_RUN_CANCEL);
      return;
    }
    break;

    default:
    {
      mafEventMacro(*e);
    } 
  } 
  }
}
void UActorComponent::ExecuteRegisterEvents()
{
	if(!bRegistered)
	{
		OnRegister();
		checkf(bRegistered, TEXT("Failed to route OnRegister (%s)"), *GetFullName());
	}

	if(FApp::CanEverRender() && !bRenderStateCreated && World->Scene)
	{
		CreateRenderState_Concurrent();
		checkf(bRenderStateCreated, TEXT("Failed to route CreateRenderState_Concurrent (%s)"), *GetFullName());
	}

	if(!bPhysicsStateCreated && World->GetPhysicsScene() && ShouldCreatePhysicsState())
	{
		CreatePhysicsState();
		checkf(bPhysicsStateCreated, TEXT("Failed to route CreatePhysicsState (%s)"), *GetFullName());
	}
}
Example #3
0
GDragDropSource::GDragDropSource()
{
	d = new GDndSourcePriv;
	OnRegister(true);
}
Example #4
0
LRESULT CLearnWorldServerDlg::DatabaseManage(WPARAM wParam, LPARAM lParam)
{
	CString Command;
	if (WSAGETSELECTERROR(lParam))
	{
		// Display the error and close the socket
		closesocket(wParam);
	}
	switch (WSAGETSELECTEVENT(lParam))
	{
	case FD_ACCEPT:
	{
		ClientSocket[NumberOfClient] = accept(wParam, NULL, NULL);
		NumberOfClient++;
		break;
	}
	case FD_READ:
	{
		int post = -1, dpos = -1;

		for (int i = 0; i<NumberOfClient; i++)
		{
			if (ClientSocket[i] == wParam)
			{
				if (i<NumberOfClient)
					post = i;
			}
		}
		CString strResult[2];
		CString temp;
		if (RecvString(wParam, temp) < 0)
			break;
		SplitFlag(temp, strResult);
		int flag = _ttoi(strResult[0]);
		
		switch (flag)
		{
			case -1 : // Logout
				OnSignOut(wParam, strResult[1]);
				break;
			case 0://Login
				OnSignIn(wParam ,strResult[1]);
				break;
			case 1://Register
				OnRegister(wParam, strResult[1]);
				SaveData();
				break;
			case 2://Forgot password
				OnForgotPass(wParam, strResult[1]);
				SaveData();
				break;
			case 3:// Edit Information
				OnEditInfo(wParam, strResult[1]);
				SaveData();
				break;
			case 4: // Add Teacher
				OnAddTeacher(wParam,strResult[1]);
				SaveData();
				break;
			case 13: // Search Teacher
				OnSearchTeacher(wParam, strResult[1]);
				break;
			case 14: // Search User
				OnSearchUser(wParam, strResult[1]);
				break;
			case 15: // Get user list to create table
				OnCreateTable(wParam, strResult[1]);
				break;
			case 16: // Search Username for Delete / Deactivated / Activate
				OnSearchAccount(wParam, strResult[1]);
				break;
			case 17: // Delete Account
				OnDeleteAccount(wParam, strResult[1]);
				SaveData();
				break;
			case 18: // Deactivate Account
				OnDeactivateAccount(wParam, strResult[1]);
				SaveData();
				break;
			case 19: // Activate Account
				OnActivateAccount(wParam, strResult[1]);
				SaveData();
				break;
			case 20: //Rate teacher
				OnEvaluateTeacher(wParam, strResult[1]);
				break;
		}
		break;
	}

	case FD_CLOSE:
	{
		//MessageBox(L"Client closed connection", NULL, MB_OK);
		UpdateData();
		int post = -1;
		for (int i = 0; i<NumberOfClient; i++)
		{
			if (ClientSocket[i] == wParam)
			{
				if (i<NumberOfClient)
					post = i;
			}
		}
		closesocket(wParam);
		for (int j = post; j < NumberOfClient; j++)
		{
			ClientSocket[post] = ClientSocket[post + 1];
		}
		
		NumberOfClient--;
		UpdateData(FALSE);
		if (NumberOfClient == 0);
		break;
	}

	}
	return 0;
}