void KSensorManager::Refresh() { OutputDebugStringA("KSensorManager::Refresh();\n{\n"); INuiSensor * pNuiSensor; HRESULT hr; Sensors->Clear(); int iSensorCount = 0; hr = NuiGetSensorCount(&iSensorCount); String^ str = iSensorCount.ToString(); std::wstring ws1(str->Data()); LPCSTR ls = LPCSTR(ws1.c_str()); OutputDebugStringA(" Sensor Count: "); OutputDebugStringA(ls); for (int i = 0; i < iSensorCount; ++i) { hr = NuiCreateSensorByIndex(i, &pNuiSensor); if (FAILED(hr)) { OutputDebugStringA(" NuiCreateSensorByIndex() FAILED; "); continue; } hr = pNuiSensor->NuiStatus(); if (S_OK == hr) { OutputDebugStringA(" NuiStatus() S_OK; "); BSTR bs = pNuiSensor->NuiUniqueId(); std::wstring ws(bs, SysStringLen(bs)); Sensors->Insert(ref new Platform::String(ws.c_str()), ref new KSensor(pNuiSensor)); hr = pNuiSensor->NuiInitialize(NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR); if (SUCCEEDED(hr)) { OutputDebugStringA(" NuiInitialize() SUCCEEDED; "); } if (FAILED(hr)) { OutputDebugStringA(" NuiInitialize() FAILED; "); } continue; } } OutputDebugStringA("\n}\n"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)