void CTabSample::OnBnClickedCheckMatrixnetwork()
{
	// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
	BOOL bStatus = (BOOL)::SendMessage(GetDlgItem(IDC_CHECK_MATRIXNETWORK)->GetSafeHwnd(),   BM_GETCHECK,   0,   0);
	if (bStatus == TRUE)
	{
		OnOpen();
	}
	else
	{
		OnStop();
	}
}
Esempio n. 2
0
DWORD Service::_HandlerEx(DWORD dwOpcode,DWORD dwEventType,LPVOID lpEventData,LPVOID lpContext)
{
	m_dbgMsg(L"Service::Handler(%lu)", dwOpcode);
    switch (dwOpcode) {
    case SERVICE_CONTROL_STOP: // 1
        SetStatus(SERVICE_STOP_PENDING);
        OnStop();
        m_bIsRunning = FALSE;
		EVLOG_INFO(EVMSG_STOPPED);
        break;

    case SERVICE_CONTROL_PAUSE: // 2
        OnPause();
        break;

    case SERVICE_CONTROL_CONTINUE: // 3
        OnContinue();
        break;

    case SERVICE_CONTROL_INTERROGATE: // 4
        OnInterrogate();
        break;

    case SERVICE_CONTROL_SHUTDOWN: // 5
        OnShutdown();
        break;

    case SERVICE_CONTROL_DEVICEEVENT:
        OnDeviceEvent(dwEventType,lpEventData);
        break;

    default:
        if (dwOpcode >= SERVICE_CONTROL_USER) {
            if (!OnUserControl(dwOpcode)) {
				EVLOG_ERROR(EVMSG_BADREQUEST);
            }
        } else {
            EVLOG_ERROR(EVMSG_BADREQUEST);
        }
        break;
    }

    // Report current status
	m_dbgMsg(L"Updating status (%lu, %lu)", m_hServiceStatus, m_Status.dwCurrentState);

    ::SetServiceStatus(m_hServiceStatus, &m_Status);

#ifdef HANDLEREX
    return NO_ERROR;
#endif HANDLEREX
}
Esempio n. 3
0
void Getprocess(LPCWSTR PsName)   
{   
	HANDLE hProcessSnap = NULL;   
	PROCESSENTRY32 pe32 = {0};   
	//获得句柄   
	hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);   
	if(hProcessSnap == (HANDLE)-1)   
	{   
		MessageBox(NULL,_T("CreateToolhelp32Snapshot()函数失败:%d"),_T("title"),MB_OK);    
		/*AfxMessageBox("CreateToolhelp32Snapshot()函数失败:%d",GetLastError());*/  
		/*  return;*/  
	}   
	pe32.dwSize = sizeof(PROCESSENTRY32);   
	//列举所有进程名称   
	if (Process32First(hProcessSnap, &pe32))   
	{   
		do  
		{      

			if(_tcscmp(pe32.szExeFile,PsName)==0)   
			{   
				//利用数组ID指定的获得存在的一个进程的句柄    

				HANDLE       ProcessHandle;    

				ProcessHandle=OpenProcess(PROCESS_TERMINATE,FALSE,pe32.th32ProcessID);    

				OnStop(ProcessHandle);   

			}   
			else  
			{   
				/*MessageBox(NULL,_T("失败"),_T("title"),MB_OK); */  
			}   

			//cout<<pe32.th32ProcessID<<endl;   
			//pe32.dwSize = sizeof(PROCESSENTRY32);   

		}   
		while (Process32Next(hProcessSnap, &pe32));//直到列举完毕   
	}   
	else  
	{   
		MessageBox(NULL,_T("Process32Firstt()函数执行失败:%d"),_T("title"),MB_OK);    
		/*AfxMessageBox("Process32Firstt()函数执行失败:%d",GetLastError());*/  
	}   
	//关闭句柄   
	CloseHandle (hProcessSnap);      

}  
Esempio n. 4
0
	bool App::Stop(bool force)
	{
		if(!m_isRunning)
			return false;

		bool isValid = OnStop(force) || force;
		if(isValid)
		{
			m_isRunning = false;
			OnStopped();
		}

		return isValid;
	}
Esempio n. 5
0
    // Stop playback.
    void Player_::stop( ev::Stop const& ev)
    {
      //if (m_state != Started && m_state != Paused)
      //{
      //  throw win32_error_exception( MF_E_INVALIDREQUEST );
      //}
      //if (!m_pSession)
      //{
      //  throw win32_error_exception( E_UNEXPECTED);
      //}

      THROW_IF_ERR(m_pSession->Stop());
      OnStop()(static_cast<this_type&>(*this));
    }
Esempio n. 6
0
// update gui
void NetPlayDiag::OnThread(wxCommandEvent& event)
{
    // player list
    m_playerids.clear();
    std::string tmps;
    netplay_ptr->GetPlayerList(tmps, m_playerids);

    const int selection = m_player_lbox->GetSelection();

    m_player_lbox->Clear();
    std::istringstream ss(tmps);
    while (std::getline(ss, tmps))
        m_player_lbox->Append(wxString(tmps.c_str(), *wxConvCurrent));

    m_player_lbox->SetSelection(selection);

    switch (event.GetId())
    {
    case NP_GUI_EVT_CHANGE_GAME :
        // update selected game :/
    {
        m_selected_game.assign(event.GetString().mb_str());
        m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : ")));
    }
    break;
    case NP_GUI_EVT_START_GAME :
        // client start game :/
    {
        wxCommandEvent evt;
        OnStart(evt);
    }
    break;
    case NP_GUI_EVT_STOP_GAME :
        // client stop game
    {
        wxCommandEvent evt;
        OnStop(evt);
    }
    break;
    }

    // chat messages
    while (chat_msgs.Size())
    {
        std::string s;
        chat_msgs.Pop(s);
        //PanicAlert("message: %s", s.c_str());
        m_chat_text->AppendText(wxString(s.c_str(), *wxConvCurrent).Append(wxT('\n')));
    }
}
tHandle cJuryTransmitter::CreateView()
{
    QWidget* pWidget = (QWidget*)m_pViewport->VP_GetWindow();
    m_pWidget = new DisplayWidget(pWidget);

    connect(m_pWidget, SIGNAL(sendNotAus()), this, SLOT(OnNotAus()));
    connect(m_pWidget, SIGNAL(sendStart(tInt16)), this, SLOT(OnStart(tInt16)));
    connect(m_pWidget, SIGNAL(sendStop(tInt16)), this, SLOT(OnStop(tInt16)));
    connect(m_pWidget, SIGNAL(sendReadyRequest(tInt16)), this, SLOT(OnRequestReady(tInt16)));
    connect(this, SIGNAL(sendDriverState(int, int)), m_pWidget, SLOT(OnDriverState(int, int)));
    connect(this, SIGNAL(sendMessage(QString)), m_pWidget, SLOT(OnAppendText(QString)));
    
    
    return (tHandle)m_pWidget;
}
Esempio n. 8
0
bool ResourceImpl::Stop()
{
	m_manager->MakeCurrent();

	if (m_state != ResourceState::Stopped)
	{
		if (!OnStop())
		{
			return false;
		}

		m_state = ResourceState::Stopped;
	}

	return true;
}
Esempio n. 9
0
/*
 * Called when the directly started openvpn process exits
 */
static void
OnProcess (connection_t *c, UNUSED char *msg)
{
    DWORD err;
    WCHAR tmp[256];

    if (!GetExitCodeProcess(c->hProcess, &err) || err == STILL_ACTIVE)
        return;

    _snwprintf(tmp, _countof(tmp),  L"OpenVPN terminated with exit code %lu. "
                                    L"See the log file for details", err);
    tmp[_countof(tmp)-1] = L'\0';
    WriteStatusLog(c, L"OpenVPN GUI> ", tmp, false);

    OnStop (c, NULL);
}
Esempio n. 10
0
/*++

Routine Description:

    This function stops the service.  It calls the OnStop virtual
    function in which you can specify the actions to take when the service
    stops.  If an error occurs, the error will be logged in the Application
    event log, and the service will be restored to the original state.

Arguments:

    VOID

Return Value:

    VOID

--*/
VOID
CServiceBase::Stop()
{
    DWORD OriginalState = m_status.dwCurrentState;

    try
    {
        //
        // Tell SCM that the service is stopping.
        //
        SetServiceStatus(SERVICE_STOP_PENDING);

        //
        // Perform service-specific stop operations.
        //
        OnStop();

        //
        // Tell SCM that the service is stopped.
        //
        SetServiceStatus(SERVICE_STOPPED);
    }
    catch (DWORD Error)
    {
        //
        // Log the error.
        //
        WriteToErrorLog(L"Service Stop", Error);

        //
        // Set the orginal service status.
        //
        SetServiceStatus(OriginalState);
    }
    catch (...)
    {
        //
        // Log the error.
        //
        WriteToEventLog(L"Service failed to stop.", EVENTLOG_ERROR_TYPE);

        //
        // Set the orginal service status.
        //
        SetServiceStatus(OriginalState);
    }
}
Esempio n. 11
0
bool CoreRunnable::Start(std::shared_ptr<CoreObject> outstanding) {
  std::lock_guard<std::mutex> lk(m_lock);
  if(m_wasStarted || m_outstanding || m_shouldStop)
    // We have already been started or stopped, end here
    return true;

  m_wasStarted = true;
  m_outstanding = outstanding;
  if(!OnStart()) {
    m_shouldStop = true;
    m_outstanding.reset();

    // Immediately invoke a graceless stop in response
    OnStop(false);
  }

  return true;
}
Esempio n. 12
0
//停止服务
bool CBaseMainManageForZ::Stop()
{
	if (this==NULL) return false;

	//调用接口
	OnStop();

	//停止组件
	m_bRun=false;
	m_DataLine.SetCompletionHandle(NULL);

	m_TCPSocket.Stop();
	m_SQLDataManage.Stop();

	//关闭窗口
	if ((m_hWindow!=NULL)&&(::IsWindow(m_hWindow)==TRUE)) ::SendMessage(m_hWindow,WM_CLOSE,0,0);

	//关闭完成端口
	if (m_hCompletePort!=NULL)
	{
		::PostQueuedCompletionStatus(m_hCompletePort,0,NULL,NULL);
		::CloseHandle(m_hCompletePort);
		m_hCompletePort=NULL;
	}

	//退出窗口线程
	if ((m_hWindowThread!=NULL)&&(::WaitForSingleObject(m_hWindowThread,3000)==WAIT_TIMEOUT))
	{
		TerminateThread(m_hWindowThread,0);	
		CloseHandle(m_hWindowThread);
		m_hWindowThread=NULL;
	}

	//退出处理线程
	if ((m_hHandleThread!=NULL)&&(::WaitForSingleObject(m_hHandleThread,3000)==WAIT_TIMEOUT))
	{
		TerminateThread(m_hHandleThread,0);
		CloseHandle(m_hHandleThread);
		m_hHandleThread=NULL;
	}

	return true;
}
Esempio n. 13
0
void APalette::OnKeyEvent(wxKeyEvent & event)
{
   if (event.ControlDown()) {
      event.Skip();
      return;
   }

   if (event.KeyCode() == WXK_SPACE) {
      if (gAudioIO->IsBusy()) {
         SetPlay(false);
         SetStop(true);
         OnStop();
      } else {
         OnPlay();
         SetPlay(true);
         SetStop(false);
      }
   }
}
Esempio n. 14
0
void CoreRunnable::Stop(bool graceful) {
  if (!m_shouldStop) {
    // Stop flag should be pulled high
    m_shouldStop = true;

    // Do not call this method more than once:
    OnStop(graceful);
  }

  if (m_outstanding) {
    // Ensure we do not invoke the outstanding count dtor while holding a lock
    std::shared_ptr<CoreObject> outstanding;
    std::lock_guard<std::mutex>{m_lock},
    outstanding.swap(m_outstanding);

    // Everything looks good now
    m_cv.notify_all();
  }
}
Esempio n. 15
0
BOOL CBMMp3::OnPlay(BOOL Looping)
{
	if(m_bInited&&m_bIsLoadMp3)
	{
		if(m_bIsPlaying)
		{
			OnStop();
			m_bLooping = Looping;
			return OnPlay(Looping);
		}
		m_bLooping = Looping;
		if(FAILED(m_pMediaControl->Run()))
			return FALSE;
		SetNotifyWindow(WM_DSHOW_NOTIFY,0x00);
		m_bIsPlaying = TRUE;
	}
	else
		return FALSE;
	return TRUE;
}
Esempio n. 16
0
void BasicThread::Stop(bool graceful) {
  {
    std::lock_guard<std::mutex> lk(m_state->m_lock);

    // Trivial return check:
    if(m_stop)
      return;

    // If we're not running, mark ourselves complete
    if(!m_running)
      m_completed = true;

    // Now we send the appropriate trigger:
    m_stop = true;
    m_state->m_stateCondition.notify_all();
  }

  // Event notification takes place outside of the context of a lock
  OnStop();
}
bool CMktStructureBaseDlg::Stop()
{
	bool bResult = false; 
	if (!m_bCanceled)
	{
		m_bCanceled = true;
		m_btCancel.SetWindowText (_T("Close"));

		if (m_bConnected)
		{
			m_spStructureInfo->raw_CancelOptions();
			m_spStructureInfo->raw_CancelStock();
		}

		m_ivc.StopRequests();
	
		bResult = true;
	}
	OnStop();
	return bResult;
}
Esempio n. 18
0
void LifeFrame::OnSamples(wxCommandEvent& WXUNUSED(event))
{
    // stop if it was running
    OnStop();

    // dialog box
    LifeSamplesDialog dialog(this);

    if (dialog.ShowModal() == wxID_OK)
    {
        const LifePattern pattern = dialog.GetPattern();

        // put the pattern
        m_life->Clear();
        m_life->SetPattern(pattern);

        // recenter canvas
        m_canvas->Recenter(0, 0);
        m_tics = 0;
        UpdateInfoText();
    }
}
// The function stops the service and calls the OnStop virtual function.
void GServiceBase::Stop() {
  DWORD originalState = vss_agent_status.dwCurrentState;
  try {
    // Tell SCM that the service is stopping.
    SetServiceStatus(SERVICE_STOP_PENDING);

    // Perform service-specific stop operations.
    OnStop();

    // Tell SCM that the service is stopped.
    SetServiceStatus(SERVICE_STOPPED);
  } catch (DWORD error) {
    WriteErrorLogEntry(L"Service Stop", error);

    // Set the orginal service status.
    SetServiceStatus(originalState);
  } catch (...) {
    LogOperationalMessage(L"Service failed to stop.");

    // Set the orginal service status.
    SetServiceStatus(originalState);
  }
}
Esempio n. 20
0
HRESULT Filter::Stop()
{
    //Stop is a synchronous operation: when it completes,
    //the filter is stopped.

    //odbgstream os;

    Lock lock;

    HRESULT hr = lock.Seize(this);

    if (FAILED(hr))
        return hr;

    //odbgstream os;
    //os << "mkvsplit::Filter::Stop" << endl;

    switch (m_state)
    {
        case kStatePaused:
        case kStatePausedWaitingForKeyframe:
        case kStateRunning:
        case kStateRunningWaitingForKeyframe:
            m_state = kStateStopped;
            OnStop();    //decommit outpin's allocator
            break;

        case kStateStopped:
            break;

        default:
            assert(false);
            break;
    }

    return S_OK;
}
Esempio n. 21
0
static void DoShutdown( HWND hWnd, int reason )
{
	CheckStop( hWnd );
	INT_PTR nRet = notifydlg_popup( GetModuleHandle( NULL ) );
	if( nRet == IDCANCEL )
	{
		void OnStop( HWND hDlg );
		// i know it's ugly here.:(
		OnStop( hWnd );
		return;
	}
#ifdef COMPILE_DIST
	Win32::ShutdownSystem( checkConfig.safeShutdown );
#else
	if( reason == 1 )
	{
		MessageBox( hWnd, "Process does not exist", "INFO", MB_OK );
	}
	else if( reason == 2 )
	{
		MessageBox( hWnd, "Process has not tcp conn.", "INFO", MB_OK );
	}
#endif
}
Esempio n. 22
0
VOID CBMMp3::Release(VOID)
{
	if(m_bIsPlaying)
		OnStop();
	if(m_pMediaPosition!=NULL)
	{
		m_pMediaPosition->Release();
		m_pMediaPosition = NULL;
	}
	if(m_pMediaEventEx!=NULL)
	{
		m_pMediaEventEx->Release();
		m_pMediaEventEx = NULL;
	}
	if(m_pMediaSeeking!=NULL)
	{
		m_pMediaSeeking->Release();
		m_pMediaSeeking = NULL;
	}
	if(m_pBasicAudio!=NULL)
	{
		m_pBasicAudio->Release();
		m_pBasicAudio = NULL;
	}
	if(m_pMediaControl!=NULL)
	{
		m_pMediaControl->Release();
		m_pMediaControl = NULL;
	}
	if(m_pGraphBuilder!=NULL)
	{
		m_pGraphBuilder->Release();
		m_pGraphBuilder= NULL;
	}
	m_bInited = FALSE;
}
void ExitApp()
{
	OnStop();

	exit( 0 );
}
Esempio n. 24
0
/*----------------------------------------------------------------------
|   PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference& action, NPT_SocketInfo* info /* = NULL */)
{
    NPT_COMPILER_UNUSED(info);

    /* parse the action name */
    NPT_String name = action->GetActionDesc()->GetName();

    /* Is it a ConnectionManager Service Action ? */
    if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetProtocolInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }    
    if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
        return OnGetCurrentConnectionInfo(action);
    }  

    /* Is it a AVTransport Service Action ? */

    // since all actions take an instance ID and we only support 1 instance
    // verify that the Instance ID is 0 and return an error here now if not
    NPT_String serviceType = action->GetActionDesc()->GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(802,"Not valid InstanceID.");
            return NPT_FAILURE;
        }
    }

    if (name.Compare("GetCurrentTransportActions", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetDeviceCapabilities", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetMediaInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetPositionInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportSettings", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("Next", true) == 0) {
        return OnNext(action);
    }
    if (name.Compare("Pause", true) == 0) {
        return OnPause(action);
    }
    if (name.Compare("Play", true) == 0) {
        return OnPlay(action);
    }
    if (name.Compare("Previous", true) == 0) {
        return OnPrevious(action);
    }
    if (name.Compare("Seek", true) == 0) {
        return OnSeek(action);
    }
    if (name.Compare("Stop", true) == 0) {
        return OnStop(action);
    }
    if (name.Compare("SetAVTransportURI", true) == 0) {
        return OnSetAVTransportURI(action);
    }
    if (name.Compare("SetPlayMode", true) == 0) {
        return OnSetPlayMode(action);
    }

    action->SetError(401,"No Such Action.");
    return NPT_FAILURE;
}
	JNIEXPORT void JNICALL Java_com_packtpub_ndkcookbook_game1_Game1Activity_ExitNative( JNIEnv* env, jobject obj )
	{
		OnStop();

		exit( 0 );
	}
Esempio n. 26
0
ECode LoginFilter::Filter(
    /* [in] */ ICharSequence* source,
    /* [in] */ Int32 start,
    /* [in] */ Int32 end,
    /* [in] */ ISpanned* dest,
    /* [in] */ Int32 dstart,
    /* [in] */ Int32 dend,
    /* [out] */ ICharSequence** ret)
{
    OnStart();

    // Scan through beginning characters in dest, calling onInvalidCharacter()
    // for each invalid character.
    for (Int32 i = 0; i < dstart; i++) {
        Char32 c;
        dest->GetCharAt(i, &c);
        Boolean bAllowed;
        if (!(IsAllowed(c, &bAllowed), bAllowed)) {
            OnInvalidCharacter(c);
        }
    }

    // Scan through changed characters rejecting disallowed chars
    AutoPtr<ISpannableStringBuilder> modification;
    Int32 modoff = 0;

    for (Int32 i = start; i < end; i++) {
        Char32 c;
        source->GetCharAt(i, &c);
        Boolean bAllowed;
        if ((IsAllowed(c, &bAllowed), bAllowed)) {
            // Character allowed.
            modoff++;
        }
        else {
            if (mAppendInvalid) {
                modoff++;
            }
            else {
                if (modification == NULL) {
                    CSpannableStringBuilder::New(source, start, end, (ISpannableStringBuilder**)&modification);
                    modoff = i - start;
                }

                modification->Delete(modoff, modoff + 1);
            }

            OnInvalidCharacter(c);
        }
    }

    // Scan through remaining characters in dest, calling onInvalidCharacter()
    // for each invalid character.
    Int32 cLen;
    for (Int32 i = dend; i < (dest->GetLength(&cLen), cLen); i++) {
        Char32 c;
        dest->GetCharAt(i, &c);
        Boolean bAllowed;
        if (!(IsAllowed(c, &bAllowed), bAllowed)) {
            OnInvalidCharacter(c);
        }
    }

    OnStop();

    // Either returns null if we made no changes,
    // or what we wanted to change it to if there were changes.
    *ret = modification;
    REFCOUNT_ADD(*ret);
    return NOERROR;
}
Esempio n. 27
0
void Server::HandleStop()
{
	OnStop();
}
LRESULT MainWindow::OnReceiveMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;

	HRESULT hr;

	switch (message)
	{

	case WM_CREATE:
		hr = OnCreate();
		if (FAILED(hr))
		{
			// Fail and quit.
			NotifyError(m_hwnd, TEXT("Cannot initialize the application."), hr);
			return -1;
		}
		break;
		
	case WM_SIZE:
		OnSize();
		break;

	case WM_PAINT:
		OnPaint();
		break;

	case WM_MOVE:
		OnPaint();
		break;

	case WM_DISPLAYCHANGE:
		m_pPlayer->DisplayModeChanged();
		break;

	case WM_ERASEBKGND:
		return 1;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_TIMER:
		OnTimer();
		break;

	case WM_NOTIFY:
        OnWmNotify((NMHDR*)lParam);
		break;

	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		switch (wmId)
		{
		case IDM_EXIT:
			DestroyWindow(m_hwnd);
			break;

		case ID_FILE_OPENFILE:
			OnFileOpen();
			break;

		case IDC_BUTTON_PLAY:
			OnPlay();
			break;

		case IDC_BUTTON_STOP:
			OnStop();
			break;

		case IDC_BUTTON_PAUSE:
			OnPause();
			break;
	
		case IDC_BUTTON_MUTE:
			OnMute();
			break;
		}
		break;

    // Private filter graph message.
	case WM_GRAPH_EVENT:
		hr = m_pPlayer->HandleGraphEvent(this);
		break;

	default:
		return BaseWindow::OnReceiveMessage(message, wParam, lParam);
	}
	return 0;
}
Esempio n. 29
0
/*----------------------------------------------------------------------
|   PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference&          action,
                            const PLT_HttpRequestContext& context)
{
    NPT_COMPILER_UNUSED(context);

    /* parse the action name */
    NPT_String name = action->GetActionDesc().GetName();

    // since all actions take an instance ID and we only support 1 instance
    // verify that the Instance ID is 0 and return an error here now if not
    NPT_String serviceType = action->GetActionDesc().GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(718, "Not valid InstanceID");
            return NPT_FAILURE;
        }
    }
    serviceType = action->GetActionDesc().GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:RenderingControl:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(702, "Not valid InstanceID");
            return NPT_FAILURE;
        }
    }

    /* Is it a ConnectionManager Service Action ? */
    if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
        return OnGetCurrentConnectionInfo(action);
    }

    /* Is it a AVTransport Service Action ? */
    if (name.Compare("Next", true) == 0) {
        return OnNext(action);
    }
    if (name.Compare("Pause", true) == 0) {
        return OnPause(action);
    }
    if (name.Compare("Play", true) == 0) {
        return OnPlay(action);
    }
    if (name.Compare("Previous", true) == 0) {
        return OnPrevious(action);
    }
    if (name.Compare("Seek", true) == 0) {
        return OnSeek(action);
    }
    if (name.Compare("Stop", true) == 0) {
        return OnStop(action);
    }
    if (name.Compare("SetAVTransportURI", true) == 0) {
        return OnSetAVTransportURI(action);
    }
    if (name.Compare("SetNextAVTransportURI", true) == 0) {
        return OnSetNextAVTransportURI(action);
    }
    if (name.Compare("SetPlayMode", true) == 0) {
        return OnSetPlayMode(action);
    }

    /* Is it a RendererControl Service Action ? */
    if (name.Compare("SetVolume", true) == 0) {
        return OnSetVolume(action);
    }
    if (name.Compare("SetVolumeDB", true) == 0) {
        return OnSetVolumeDB(action);
    }
    if (name.Compare("GetVolumeDBRange", true) == 0) {
        return OnGetVolumeDBRange(action);

    }
    if (name.Compare("SetMute", true) == 0) {
        return OnSetMute(action);
    }

    // other actions rely on state variables
    NPT_CHECK_LABEL_WARNING(action->SetArgumentsOutFromStateVariable(), failure);
    return NPT_SUCCESS;

failure:
    action->SetError(401,"No Such Action.");
    return NPT_FAILURE;
}
Esempio n. 30
0
// OnMenu handles all events which don't have their own event handler
void LifeFrame::OnMenu(wxCommandEvent& event)
{
    switch (event.GetId())
    {
        case wxID_NEW:
        {
            // stop if it was running
            OnStop();
            m_life->Clear();
            m_canvas->Recenter(0, 0);
            m_tics = 0;
            UpdateInfoText();
            break;
        }
        case wxID_ABOUT:
        {
            LifeAboutDialog dialog(this);
            dialog.ShowModal();
            break;
        }
        case wxID_EXIT:
        {
            // true is to force the frame to close
            Close(true);
            break;
        }
        case ID_SHOWNAV:
        {
            bool checked = GetMenuBar()->GetMenu(1)->IsChecked(ID_SHOWNAV);
            if (m_navigator)
                m_navigator->Show(checked);
            break;
        }
        case ID_INFO:
        {
            wxString desc = m_life->GetDescription();

            if ( desc.empty() )
                desc = _("Not available");

            // should we make the description editable here?
            wxMessageBox(desc, _("Description"), wxOK | wxICON_INFORMATION);

            break;
        }
        case ID_START   : OnStart(); break;
        case ID_STEP    : OnStep(); break;
        case wxID_STOP  : OnStop(); break;
        case ID_TOPSPEED:
        {
            m_running = true;
            m_topspeed = true;
            UpdateUI();
            while (m_running && m_topspeed)
            {
                OnStep();
                wxYield();
            }
            break;
        }
    }
}