unsigned int __stdcall CDeviceView::ListDevicesThread(void *Param) { CDeviceView *This = (CDeviceView *)Param; /* Clear any existing data */ This->EmptyDeviceView(); /* Reset the tree root */ This->m_hTreeRoot = NULL; switch (This->m_ListDevices) { case DevicesByType: (VOID)This->ListDevicesByType(); break; case DevicesByConnection: (VOID)This->ListDevicesByConnection(); break; case ResourcesByType: break; case ResourcesByConnection: break; } return 0; }
unsigned int __stdcall CDeviceView::RefreshThread(void *Param) { RefreshThreadData *ThreadData = (RefreshThreadData *)Param; CDeviceView *This = ThreadData->This; // Get a copy of the currently selected node CNode *LastSelectedNode = This->GetSelectedNode(); if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode)) { LastSelectedNode = new CRootNode(*This->m_RootNode); } else if (LastSelectedNode->GetNodeType() == ClassNode) { LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode)); } else if (LastSelectedNode->GetNodeType() == DeviceNode) { LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode)); } // Empty the treeview This->EmptyDeviceView(); // Re-add the root node to the tree if (This->AddRootDevice() == false) return 0; // Refresh the devices only if requested if (ThreadData->ScanForChanges) { This->RefreshDeviceList(); } // display the type of view the user wants switch (This->m_ViewType) { case DevicesByType: (void)This->ListDevicesByType(); break; case DevicesByConnection: (VOID)This->ListDevicesByConnection(); break; case ResourcesByType: break; case ResourcesByConnection: break; } This->SelectNode(LastSelectedNode); delete ThreadData; return 0; }