mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
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
4 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue