- Force all refreshes to go through the CDeviceManager method instead of calling CDeviceView directly.
- Fixes missing checked radio item in the view menu on startup

svn path=/trunk/; revision=69659
This commit is contained in:
Ged Murphy 2015-10-23 13:16:25 +00:00
parent 285e7278f5
commit db0a8fd47d
4 changed files with 13 additions and 23 deletions

View file

@ -188,8 +188,7 @@ void
CDeviceView::Refresh(
_In_ ViewType Type,
_In_ bool ScanForChanges,
_In_ bool UpdateView,
_In_opt_ LPWSTR DeviceId
_In_ bool UpdateView
)
{
// Enum devices on a seperate thread to keep the gui responsive
@ -230,8 +229,7 @@ CDeviceView::OnAction(
{
Refresh(GetCurrentView(),
true,
true,
NULL);
true);
break;
}

View file

@ -60,8 +60,7 @@ public:
VOID Refresh(
_In_ ViewType Type,
_In_ bool ScanForChanges,
_In_ bool UpdateView,
_In_opt_ LPWSTR DeviceId
_In_ bool UpdateView
);
VOID DisplayPropertySheet();

View file

@ -245,12 +245,13 @@ CDeviceManager::UpdateStatusBar(_In_ bool InMenuLoop)
}
bool
CDeviceManager::RefreshView(_In_ ViewType Type)
CDeviceManager::RefreshView(_In_ ViewType Type,
_In_ bool ScanForChanges)
{
UINT CheckId = 0;
// Refreshed the cached view
m_DeviceView->Refresh(Type, FALSE, TRUE, NULL);
m_DeviceView->Refresh(Type, ScanForChanges, true);
// Get the menu item id
switch (Type)
@ -437,10 +438,7 @@ CDeviceManager::OnCreate(_In_ HWND hwnd)
if (m_DeviceView->Initialize())
{
// Do the initial scan
m_DeviceView->Refresh(m_DeviceView->GetCurrentView(),
true,
true,
NULL);
RefreshView(m_DeviceView->GetCurrentView(), true);
// Display the window according to the user request
ShowWindow(hwnd, m_CmdShow);
@ -608,13 +606,13 @@ CDeviceManager::OnCommand(_In_ WPARAM wParam,
case IDC_DEVBYTYPE:
{
RefreshView(DevicesByType);
RefreshView(DevicesByType, false);
break;
}
case IDC_DEVBYCONN:
{
RefreshView(DevicesByConnection);
RefreshView(DevicesByConnection, false);
break;
}
@ -633,10 +631,7 @@ CDeviceManager::OnCommand(_In_ WPARAM wParam,
CheckMenuItem(m_hMenu, IDC_SHOWHIDDEN, MF_BYCOMMAND | MF_CHECKED);
}
// Refresh the device view
m_DeviceView->Refresh(m_DeviceView->GetCurrentView(),
false,
true,
NULL);
RefreshView(m_DeviceView->GetCurrentView(), false);
break;
}
@ -798,10 +793,7 @@ CDeviceManager::MainWndProc(_In_ HWND hwnd,
if (wParam == REFRESH_TIMER)
{
// Schedule a refresh (this just creates a thread and returns)
This->m_DeviceView->Refresh(This->m_DeviceView->GetCurrentView(),
true,
true,
NULL);
This->RefreshView(This->m_DeviceView->GetCurrentView(), true);
// Cleanup the timer
KillTimer(hwnd, REFRESH_TIMER);

View file

@ -90,7 +90,8 @@ private:
);
bool RefreshView(
_In_ ViewType Type
_In_ ViewType Type,
_In_ bool ScanForChanges
);
};