Ejemplo n.º 1
0
        public AppGrabberUI(AppGrabber appGrabber)
        {
            this.appGrabber = appGrabber;
            InitializeComponent();


            // Grab the Programs
            List <ApplicationInfo> apps = appGrabber.ProgramList;

            // Now to add them to the list on the AppGrabber
            // Create ObservableCollections to bind to the ListViews

            ObservableCollection <ApplicationInfo> installedAppsCollection = new ObservableCollection <ApplicationInfo>();

            programsMenuAppsCollection       = new ObservableCollection <ApplicationInfo>(appGrabber.CategoryList.FlatList.ToList());
            InstalledAppsView.ItemsSource    = installedAppsCollection;
            ProgramsMenuAppsView.ItemsSource = programsMenuAppsCollection;
            // Need to use an event handler to remove Apps from categories when moved to the "Installed Applications" listing
            programsMenuAppsCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(programsMenuAppsCollection_CollectionChanged);

            // Iterate thru the apps, creating ApplicationInfoPanels and
            // add them to the installedAppsCollection
            foreach (ApplicationInfo app in apps)
            {
                if (!programsMenuAppsCollection.Contains(app))
                {
                    installedAppsCollection.Add(app);
                }
            }
            AppViewSorter.Sort(installedAppsCollection, "Name");
            AppViewSorter.Sort(programsMenuAppsCollection, "Name");
            GC.Collect();
        }
Ejemplo n.º 2
0
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            // Now to add them to the list on the AppGrabber
            // Create ObservableCollections to bind to the ListViews

            ObservableCollection <ApplicationInfo> installedAppsCollection = new ObservableCollection <ApplicationInfo>();

            programsMenuAppsCollection       = appGrabber.CategoryList.FlatList;
            InstalledAppsView.ItemsSource    = installedAppsCollection;
            ProgramsMenuAppsView.ItemsSource = programsMenuAppsCollection;
            // Need to use an event handler to remove Apps from categories when moved to the "Installed Applications" listing
            programsMenuAppsCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(programsMenuAppsCollection_CollectionChanged);

            // Grab the Programs
            List <ApplicationInfo> apps = appGrabber.ProgramList;

            // Iterate thru the apps, creating ApplicationInfoPanels and
            // add them to the installedAppsCollection
            foreach (ApplicationInfo app in apps)
            {
                if (!programsMenuAppsCollection.Contains(app))
                {
                    installedAppsCollection.Add(app);
                }
            }
            AppViewSorter.Sort(installedAppsCollection, "Name");
            AppViewSorter.Sort(programsMenuAppsCollection, "Name");

            // show content
            bdrLoad.Visibility = Visibility.Collapsed;
            bdrMain.Visibility = Visibility.Visible;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Object that represents a named list of ApplicationInfos.
 /// </summary>
 /// <param name="name">The name of the category - retrievable from the Name property.</param>
 /// <param name="showInMenu">Should the category appear in the Programs menu</param>
 public Category(String name, bool showInMenu = true)
 {
     this.Name       = name;
     this.ShowInMenu = showInMenu;
     this.appsList   = new List <ApplicationInfo>();
     AppViewSorter.Sort(this, "Name");
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Object that represents a named list of ApplicationInfos. Default name is "Unknown".
 /// </summary>
 public Category()
 {
     this.Name       = "Unknown";
     this.ShowInMenu = true;
     this.appsList   = new List <ApplicationInfo>();
     AppViewSorter.Sort(this, "Name");
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Object that represents a named list of ApplicationInfos.
 /// </summary>
 /// <param name="name">The name of the category - retrievable from the Name property.</param>
 public Category(String name)
 {
     this.Name         = name;
     this.ShowInMenu   = true;
     this.internalList = new List <ApplicationInfo>();
     AppViewSorter.Sort(this, "Name");
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Object that represents a named list of ApplicationInfos.
 /// </summary>
 /// <param name="name">The name of the category - retrievable from the Name property.</param>
 /// <param name="apps">An IList of AppliationInfo objects to initialize this list to. (Internally uses the AddRange function to set the list)</param>
 public Category(String name, IList <ApplicationInfo> apps)
 {
     this.Name       = name;
     this.ShowInMenu = true;
     this.appsList   = new List <ApplicationInfo>();
     this.AddRange(apps);
     AppViewSorter.Sort(this, "Name");
 }
Ejemplo n.º 7
0
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            // Now to add them to the list on the AppGrabber
            // Create ObservableCollections to bind to the ListViews

            ObservableCollection <ApplicationInfo> installedAppsCollection = new ObservableCollection <ApplicationInfo>();

            programsMenuAppsCollection       = appGrabber.CategoryList.FlatList;
            InstalledAppsView.ItemsSource    = installedAppsCollection;
            ProgramsMenuAppsView.ItemsSource = programsMenuAppsCollection;
            // Need to use an event handler to remove Apps from categories when moved to the "Installed Applications" listing
            programsMenuAppsCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(programsMenuAppsCollection_CollectionChanged);

            // Grab the Programs
            List <ApplicationInfo> apps = appGrabber.ProgramList;

            // automatically select apps if none have been yet
            bool autoAddApps = programsMenuAppsCollection.Count < 1;

            // Iterate thru the apps, creating ApplicationInfoPanels and
            // add them to the installedAppsCollection
            foreach (ApplicationInfo app in apps)
            {
                if (!programsMenuAppsCollection.Contains(app))
                {
                    if (autoAddApps && ((app.IsStoreApp && autoSelectByName(app.Name)) || (!app.IsStoreApp && autoSelectByName(Path.GetFileNameWithoutExtension(app.Path)))))
                    {
                        programsMenuAppsCollection.Add(app);
                    }
                    else
                    {
                        installedAppsCollection.Add(app);
                    }
                }
            }
            AppViewSorter.Sort(installedAppsCollection, "Name");
            AppViewSorter.Sort(programsMenuAppsCollection, "Name");

            // show content
            bdrLoad.Visibility = Visibility.Collapsed;
            bdrMain.Visibility = Visibility.Visible;
        }