Skip items that are not enabled when creating jump list (#1333)
* Fix jumplist bug * Add extra check
This commit is contained in:
parent
3309380907
commit
258833f266
@ -75,7 +75,7 @@ void ApplicationViewModel::Categories::set(IObservableVector<NavCategoryGroup ^>
|
||||
|
||||
void ApplicationViewModel::Initialize(ViewMode mode)
|
||||
{
|
||||
if (!NavCategory::IsValidViewMode(mode))
|
||||
if (!NavCategory::IsValidViewMode(mode) || !NavCategory::IsViewModeEnabled(mode))
|
||||
{
|
||||
mode = ViewMode::Standard;
|
||||
}
|
||||
|
@ -350,6 +350,14 @@ bool NavCategory::IsValidViewMode(ViewMode mode)
|
||||
return iter != s_categoryManifest.end();
|
||||
}
|
||||
|
||||
bool NavCategory::IsViewModeEnabled(ViewMode mode)
|
||||
{
|
||||
auto iter =
|
||||
find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode](const NavCategoryInitializer& initializer) { return initializer.viewMode == mode && initializer.isEnabled; });
|
||||
|
||||
return iter != s_categoryManifest.end();
|
||||
}
|
||||
|
||||
bool NavCategory::IsCalculatorViewMode(ViewMode mode)
|
||||
{
|
||||
// Historically, Calculator modes are Standard, Scientific, and Programmer.
|
||||
|
@ -134,6 +134,7 @@ namespace CalculatorApp
|
||||
static ViewMode GetViewModeForFriendlyName(Platform::String ^ name);
|
||||
|
||||
static bool IsValidViewMode(ViewMode mode);
|
||||
static bool IsViewModeEnabled(ViewMode mode);
|
||||
static bool IsCalculatorViewMode(ViewMode mode);
|
||||
static bool IsGraphingCalculatorViewMode(ViewMode mode);
|
||||
static bool IsDateCalculatorViewMode(ViewMode mode);
|
||||
|
@ -148,6 +148,10 @@ task<void> App::SetupJumpList()
|
||||
|
||||
for (NavCategory ^ option : calculatorOptions->Categories)
|
||||
{
|
||||
if (!option->IsEnabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ViewMode mode = option->Mode;
|
||||
auto item = JumpListItem::CreateWithArguments(((int)mode).ToString(), L"ms-resource:///Resources/" + NavCategory::GetNameResourceKey(mode));
|
||||
item->Description = L"ms-resource:///Resources/" + NavCategory::GetNameResourceKey(mode);
|
||||
|
Loading…
Reference in New Issue
Block a user