void QmitkServiceListWidget::OnServiceEvent(const us::ServiceEvent event){ //MITK_INFO << "ServiceEvent" << event.GetType(); switch (event.GetType()) { case us::ServiceEvent::MODIFIED: emit(ServiceModified(event.GetServiceReference())); // Change service; add a new entry if service wasn't on list before if ( ! this->ChangeServiceOnList(event.GetServiceReference()) ) { this->AddServiceToList(event.GetServiceReference()); } break; case us::ServiceEvent::REGISTERED: emit(ServiceRegistered(event.GetServiceReference())); AddServiceToList(event.GetServiceReference()); break; case us::ServiceEvent::UNREGISTERING: emit(ServiceUnregistering(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; case us::ServiceEvent::MODIFIED_ENDMATCH: emit(ServiceModifiedEndMatch(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; } }
void QmitkServiceListWidget::OnServiceEvent(const mitk::ServiceEvent event){ //MITK_INFO << "ServiceEvent" << event.GetType(); switch (event.GetType()) { case mitk::ServiceEvent::MODIFIED: emit(ServiceModified(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); AddServiceToList(event.GetServiceReference()); break; case mitk::ServiceEvent::REGISTERED: emit(ServiceRegistered(event.GetServiceReference())); AddServiceToList(event.GetServiceReference()); break; case mitk::ServiceEvent::UNREGISTERING: emit(ServiceUnregistering(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; case mitk::ServiceEvent::MODIFIED_ENDMATCH: emit(ServiceModifiedEndMatch(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; } }
void QmitkServiceListWidget::InitPrivate(const std::string& namingProperty, const std::string& filter) { if (filter.empty()) m_Filter = "(" + us::ServiceConstants::OBJECTCLASS() + "=" + m_Interface + ")"; else m_Filter = filter; m_NamingProperty = namingProperty; m_Context->RemoveServiceListener(this, &QmitkServiceListWidget::OnServiceEvent); m_Context->AddServiceListener(this, &QmitkServiceListWidget::OnServiceEvent, m_Filter); // Empty ListWidget this->m_ListContent.clear(); m_Controls->m_ServiceList->clear(); // get Services std::vector<us::ServiceReferenceU> services = this->GetAllRegisteredServices(); // Transfer them to the List for(std::vector<us::ServiceReferenceU>::iterator it = services.begin(); it != services.end(); ++it) AddServiceToList(*it); }
static BOOL BuildListOfServicesToStop(LPWSTR *lpServiceList, LPWSTR lpServiceName) { LPENUM_SERVICE_STATUS lpServiceStatus; DWORD dwCount, i; BOOL bRet = FALSE; /* Get a list of service dependents */ lpServiceStatus = TV2_GetDependants(lpServiceName, &dwCount); if (lpServiceStatus) { for (i = 0; i < dwCount; i++) { /* Does this service need stopping? */ if (lpServiceStatus[i].ServiceStatus.dwCurrentState != SERVICE_STOPPED && lpServiceStatus[i].ServiceStatus.dwCurrentState != SERVICE_STOP_PENDING) { /* Does this service have any dependents? */ if (TV2_HasDependantServices(lpServiceStatus[i].lpServiceName)) { /* recall this function with the dependent */ BuildListOfServicesToStop(lpServiceList, lpServiceStatus[i].lpServiceName); } /* Add the service to the list */ *lpServiceList = AddServiceToList(lpServiceList, lpServiceStatus[i].lpServiceName); /* We've got one */ bRet = TRUE; } } HeapFree(GetProcessHeap(), 0, lpServiceStatus); } return bRet; }