private void goPage2() { bdrMain.Visibility = Visibility.Collapsed; bdrPage2.Visibility = Visibility.Visible; // Grab the Programs CategoryList catList = appGrabber.CategoryList; // Get the Uncategorized category Category uncat = catList.GetSpecialCategory(AppCategoryType.Uncategorized); // Get the Quick Launch category Category quicklaunch = catList.GetSpecialCategory(AppCategoryType.QuickLaunch); // Add apps to category if they haven't been added to one yet. foreach (ApplicationInfo app in programsMenuAppsCollection) { if (app.Category == null) { string cat; if (app.IsStoreApp) { cat = autoCategorizeByName(app.Name); } else { cat = autoCategorizeByName(Path.GetFileNameWithoutExtension(app.Path)); } if (cat != "") { // Get the category - create it if it doesn't exist. Category categoryToAdd = catList.GetCategory(cat); if (categoryToAdd == null) { categoryToAdd = new Category(cat, true); catList.Add(categoryToAdd); } categoryToAdd.Add(app); } else { // not a known app, add to Uncategorized if (uncat != null) { uncat.Add(app); } } } } categoryView.ItemsSource = catList; categoryView.Visibility = Visibility.Visible; }
private void goPage2() { bdrMain.Visibility = Visibility.Collapsed; bdrPage2.Visibility = Visibility.Visible; // Grab the Programs CategoryList catList = appGrabber.CategoryList; // Get the Uncategorized category - create it if it doesn't exist. Category uncat = catList.GetCategory("Uncategorized"); if (uncat == null) { uncat = new Category("Uncategorized"); uncat.ShowInMenu = false; catList.Add(uncat); } // Get the Quick Launch category - create it if it doesn't exist. Category quicklaunch = catList.GetCategory("Quick Launch"); if (quicklaunch == null) { quicklaunch = new Category("Quick Launch"); quicklaunch.ShowInMenu = false; catList.Add(quicklaunch); } // Add Apps to uncat if they haven't been added to a category yet. foreach (ApplicationInfo app in programsMenuAppsCollection) { if (app.Category == null) { uncat.Add(app); } } categoryView.ItemsSource = catList; categoryView.Visibility = Visibility.Visible; }
public AppGrabberUI_Page2(AppGrabber appGrabber, ObservableCollection <ApplicationInfo> selectedApps) { this.appGrabber = appGrabber; InitializeComponent(); // Grab the Programs CategoryList catList = appGrabber.CategoryList; // Get the Uncategorized category - create it if it doesn't exist. Category uncat = catList.GetCategory("Uncategorized"); if (uncat == null) { uncat = new Category("Uncategorized"); catList.Add(uncat); } // Get the Quick Launch category - create it if it doesn't exist. Category quicklaunch = catList.GetCategory("Quick Launch"); if (quicklaunch == null) { quicklaunch = new Category("Quick Launch"); quicklaunch.ShowInMenu = false; catList.Add(quicklaunch); } // Add Apps to uncat if they haven't been added to a category yet. foreach (ApplicationInfo app in selectedApps) { if (app.Category == null) { uncat.Add(app); } } categoryView.ItemsSource = catList; }
private void CategoryButtonClicked(object sender, RoutedEventArgs e) { Button button = sender as Button; Category actionableCategory = button.CommandParameter as Category; CategoryList catList = actionableCategory.ParentCategoryList; switch (button.Content as String) { case "<": catList.MoveCategory(actionableCategory, -1); break; case ">": catList.MoveCategory(actionableCategory, 1); break; case "X": //Don't allow removal of uncategorized or quick launch if (actionableCategory.Name == "Quick Launch") { return; } if (actionableCategory.Name == "Uncategorized") { return; } Category uncategorized = catList.GetCategory("Uncategorized"); for (int i = actionableCategory.Count - 1; i >= 0; i--) { ApplicationInfo app = actionableCategory[i]; actionableCategory.RemoveAt(i); uncategorized.Add(app); } catList.Remove(actionableCategory); break; } }