예제 #1
0
        private async Task SetupJumpList()
        {
            try
            {
                var calculatorOptions = NavCategoryGroup.CreateCalculatorCategory();

                var jumpList = await JumpList.LoadCurrentAsync();

                jumpList.SystemGroupKind = JumpListSystemGroupKind.None;
                jumpList.Items.Clear();

                foreach (NavCategory option in calculatorOptions.Categories)
                {
                    if (!option.IsEnabled)
                    {
                        continue;
                    }
                    ViewMode mode = option.Mode;
                    var      item = JumpListItem.CreateWithArguments(((int)mode).ToString(), "ms-resource:///Resources/" + NavCategory.GetNameResourceKey(mode));
                    item.Description = "ms-resource:///Resources/" + NavCategory.GetNameResourceKey(mode);
                    item.Logo        = new Uri("ms-appx:///Assets/" + mode.ToString() + ".png");

                    jumpList.Items.Add(item);
                }

                await jumpList.SaveAsync();
            }
            catch
            {
            }
        }
예제 #2
0
        NavigationViewItemHeader CreateNavViewHeaderFromGroup(NavCategoryGroup group)
        {
            var header = new NavigationViewItemHeader();

            header.DataContext = group;

            header.Content = group.Name;
            AutomationProperties.SetName(header, group.AutomationName);
            AutomationProperties.SetHeadingLevel(header, Windows.UI.Xaml.Automation.Peers.AutomationHeadingLevel.Level1);

            return(header);
        }