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; }
public static CategoryList Deserialize(string ConfigFile) { XmlDocument doc = new XmlDocument(); doc.Load(ConfigFile); XmlElement root = doc.ChildNodes[0] as XmlElement; CategoryList catList = new CategoryList(); foreach (XmlElement catElement in root.ChildNodes) { Category cat = new Category(); cat.Name = catElement.Attributes["Name"].Value; catList.Add(cat); foreach (XmlElement appElement in catElement.ChildNodes) { ApplicationInfo app = new ApplicationInfo(); app.Name = appElement.ChildNodes[0].InnerText; app.Path = appElement.ChildNodes[1].InnerText; if (appElement.Attributes["AskAlwaysAdmin"] != null) { app.AskAlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AskAlwaysAdmin"].Value); } if (appElement.Attributes["AlwaysAdmin"] != null) { app.AlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AlwaysAdmin"].Value); } if (appElement.ChildNodes.Count > 2) { app.Target = appElement.ChildNodes[2].InnerText; } if (!app.IsStoreApp && !Interop.Shell.Exists(app.Path)) { System.Diagnostics.Debug.WriteLine(app.Path + " does not exist"); continue; } //app.Icon = app.GetAssociatedIcon(); cat.Add(app); } } return(catList); }
public static CategoryList Deserialize(string ConfigFile) { XmlDocument doc = new XmlDocument(); doc.Load(ConfigFile); XmlElement root = doc.ChildNodes[0] as XmlElement; CategoryList catList = new CategoryList(); foreach (XmlElement catElement in root.ChildNodes) { // get category Category cat = new Category(); cat.Name = catElement.Attributes["Name"].Value; if (catElement.Attributes["Type"] != null) { cat.Type = (AppCategoryType)Convert.ToInt32(catElement.Attributes["Type"].Value); } else { // migration if (cat.Name == "Uncategorized") { cat.Type = AppCategoryType.Uncategorized; } else if (cat.Name == "Quick Launch") { cat.Type = AppCategoryType.QuickLaunch; } } if (catElement.Attributes["ShowInMenu"] != null) { cat.ShowInMenu = Convert.ToBoolean(catElement.Attributes["ShowInMenu"].Value); } else { // force hide quick launch and uncategorized if (cat.Type == AppCategoryType.Uncategorized || cat.Type == AppCategoryType.QuickLaunch) { cat.ShowInMenu = false; } } catList.Add(cat); foreach (XmlElement appElement in catElement.ChildNodes) { // get application ApplicationInfo app = new ApplicationInfo { Name = appElement.ChildNodes[0].InnerText, Path = appElement.ChildNodes[1].InnerText }; if (appElement.Attributes["AskAlwaysAdmin"] != null) { app.AskAlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AskAlwaysAdmin"].Value); } if (appElement.Attributes["AlwaysAdmin"] != null) { app.AlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AlwaysAdmin"].Value); } if (appElement.ChildNodes.Count > 2) { app.Target = appElement.ChildNodes[2].InnerText; } if (!app.IsStoreApp && !Interop.Shell.Exists(app.Path)) { CairoLogger.Instance.Debug(app.Path + " does not exist"); continue; } cat.Add(app); } } return(catList); }
public static CategoryList Deserialize(string ConfigFile) { XmlDocument doc = new XmlDocument(); doc.Load(ConfigFile); XmlElement root = doc.ChildNodes[0] as XmlElement; CategoryList catList = new CategoryList(); foreach (XmlElement catElement in root.ChildNodes) { // get category Category cat = new Category(); cat.Name = catElement.Attributes["Name"].Value; if (catElement.Attributes["Type"] != null) { cat.Type = (AppCategoryType)Convert.ToInt32(catElement.Attributes["Type"].Value); } else { // migration if (cat.Name == "Uncategorized") { cat.Type = AppCategoryType.Uncategorized; } else if (cat.Name == "Quick Launch") { cat.Type = AppCategoryType.QuickLaunch; } } if (catElement.Attributes["ShowInMenu"] != null) { cat.ShowInMenu = Convert.ToBoolean(catElement.Attributes["ShowInMenu"].Value); } else { // force hide quick launch and uncategorized if (cat.Type == AppCategoryType.Uncategorized || cat.Type == AppCategoryType.QuickLaunch) { cat.ShowInMenu = false; } } catList.Add(cat); foreach (XmlElement appElement in catElement.ChildNodes) { // get application ApplicationInfo app = new ApplicationInfo { Name = appElement.ChildNodes[0].InnerText, Path = appElement.ChildNodes[1].InnerText }; if (appElement.Attributes["AskAlwaysAdmin"] != null) { app.AskAlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AskAlwaysAdmin"].Value); } if (appElement.Attributes["AlwaysAdmin"] != null) { app.AlwaysAdmin = Convert.ToBoolean(appElement.Attributes["AlwaysAdmin"].Value); } if (appElement.ChildNodes.Count > 2) { app.Target = appElement.ChildNodes[2].InnerText; } if (!app.IsStoreApp && !ShellHelper.Exists(app.Path)) { ShellLogger.Debug(app.Path + " does not exist"); continue; } if (appElement.Attributes["AllowRunAsAdmin"] != null) { app.AllowRunAsAdmin = Convert.ToBoolean(appElement.Attributes["AllowRunAsAdmin"].Value); } else { // migration if (app.IsStoreApp && EnvironmentHelper.IsWindows8OrBetter) { ManagedShell.UWPInterop.StoreApp storeApp = ManagedShell.UWPInterop.StoreAppHelper.AppList.GetAppByAumid(app.Target); if (storeApp != null) { app.AllowRunAsAdmin = storeApp.EntryPoint == "Windows.FullTrustApplication"; } else { app.AllowRunAsAdmin = false; } } else { app.AllowRunAsAdmin = true; } } cat.Add(app); } } return(catList); }