Beispiel #1
0
        static TaskBarJumpList()
        {
            if (WindowsId.ToInt32() == 0)
            {
                list = JumpList.CreateJumpList();
            }
            else
            {
                list = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, WindowsId);
            }

            list.ClearAllUserTasks();
            list.Refresh();
            categories = new Dictionary <string, JumpListCustomCategory>();
        }
Beispiel #2
0
            public void RebindProfiles(IEnumerable <ClientProfile> profiles)
            {
                JumpListCustomCategory category = new JumpListCustomCategory("Profiles");

                int currentIndex = 0;

                foreach (var profile in profiles)
                {
                    JumpListLink link = new JumpListLink(Application.ExecutablePath, "--load-profile-" + currentIndex);
                    link.Title         = profile.ProfileName;
                    link.Arguments     = "--load-profile-" + currentIndex.ToString();
                    link.IconReference = JumpListIconManager.CreateIconForClient(profile.Client);
                    currentIndex++;
                    category.AddJumpListItems(link);
                }

                JumpList list = JumpList.CreateJumpList();

                list.ClearAllUserTasks();
                list.AddCustomCategories(category);

                JumpListLink newProfileLink = new JumpListLink(Application.ExecutablePath, "New Profile...");

                newProfileLink.Arguments     = "--new-profile";
                newProfileLink.IconReference = new IconReference(Application.ExecutablePath, 0);
                list.AddUserTasks(newProfileLink);

                list.Refresh();
            }
Beispiel #3
0
        private void RefreshJumpList()
        {
            InitJumpList();

            try
            {
                Iterator iterator = HistoryCollection.defaultCollection().iterator();
                _jumpListManager.ClearAllUserTasks();
                while (iterator.hasNext())
                {
                    Host host = (Host)iterator.next();
                    var  file = BookmarkCollection.defaultCollection().getFile(host);
                    if (file.exists())
                    {
                        bookmarkCategory.AddJumpListItems(new JumpListLink(file.getAbsolute(), BookmarkNameProvider.toString(host))
                        {
                            IconReference = new IconReference(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cyberduck-application.ico"), 0),
                        });
                    }
                }
                _jumpListManager.Refresh();
            }
            catch (Exception exception)
            {
                Logger.warn("Exception while refreshing jump list", exception);
            }
        }
Beispiel #4
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            TaskbarManager.Instance.SetProgressValue(0, hscrTaskbarProgress.Maximum);
            TaskbarManager.Instance.SetOverlayIcon(this.Icon, "Taskbar Demo Application");

            JumpList list = JumpList.CreateJumpList();//JumpList.CreateJumpListForIndividualWindow("TaskbarDemo.Form1", this.Handle);
            JumpListCustomCategory jcategory = new JumpListCustomCategory("My New Category");

            list.ClearAllUserTasks();
            string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            //jcategory.AddJumpListItems(new JumpListItem(Path.Combine(desktop, "a.abc")));
            list.AddCustomCategories(jcategory);

            string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);

            //Add links to Tasks
            list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
            {
                IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0)
            });
            list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "calc.exe"), "Open Calculator")
            {
                IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)
            });
            list.AddUserTasks(new JumpListSeparator());
            list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
            {
                IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)
            });
            //Adding links to RecentItems
            //list.AddToRecent(Path.Combine(systemFolder, "mspaint.exe"));
            list.Refresh();
        }
Beispiel #5
0
        /// <summary>
        /// Einträge in der JumpList (Aufgaben) des Tasks erzeugen
        /// 1. Notizen - StikyNot.exe
        /// 2. Snipping - Snipping.exe
        /// 3. Notepad - Notepad.exe
        /// </summary>
        void createTaksJumpList()
        {
            CustomJumpList = JumpList.CreateJumpList();

            CustomJumpList.ClearAllUserTasks();

            JumpListLink EntryNote = new JumpListLink(@"%windir%\system32\StikyNot.exe", "Notizen");

            EntryNote.IconReference = new IconReference(@"%windir%\system32\StikyNot.exe", 0);
            CustomJumpList.AddUserTasks(EntryNote);

            JumpListLink EntrySnipp = new JumpListLink(@"%windir%\system32\SnippingTool.exe", "Snipping");

            EntrySnipp.IconReference = new IconReference(@"%windir%\system32\SnippingTool.exe", 0);
            CustomJumpList.AddUserTasks(EntrySnipp);

            JumpListLink EntryNotepad = new JumpListLink(@"%windir%\system32\Notepad.exe", "Notepad");

            EntryNotepad.IconReference = new IconReference(@"%windir%\system32\Notepad.exe", 0);
            CustomJumpList.AddUserTasks(EntryNotepad);

            JumpListLink EntryCmd = new JumpListLink(@"%windir%\system32\cmd.exe", "Eingabeaufforderung");

            EntryCmd.IconReference = new IconReference(@"%windir%\system32\cmd.exe", 0);
            CustomJumpList.AddUserTasks(EntryCmd);

            if (!string.IsNullOrWhiteSpace(strTCmdPath))
            {
                JumpListLink EntryTCM = new JumpListLink(strTCmdPath, "Total Commander - " + strTCmdVersion);
                EntryTCM.IconReference = new IconReference(strTCmdPath, 0);
                CustomJumpList.AddUserTasks(EntryTCM);
            }

            CustomJumpList.Refresh();
        }
Beispiel #6
0
 public static void ClearJumplist()
 {
     if (!Win7.IsWin7)
     {
         return;
     }
     jumplist = JumpList.CreateJumpList();
     jumplist.ClearAllUserTasks();
     jumplist.Refresh();
 }
 public JumpListManager()
 {
     try
     {
         _jumpList.ClearAllUserTasks();
         _jumpList.Refresh();
     }
     catch
     {
     }
 }
Beispiel #8
0
        static public void EraseJumplist(string appId)
        {
            try
            {
                JumpList dummyList = JumpList.CreateJumpListForAppId(appId);
                dummyList.ClearAllUserTasks();
                dummyList.Refresh();

                // Set appid back
                SetAppIdBackAfterJumplist();
            }
            catch (Exception e) { }
        }
Beispiel #9
0
        private void BuildJumpList()
        {
            _jumpList.ClearAllUserTasks();

            int    defaultAccountIndex = _config.Accounts.IndexOf(_config.Accounts.Default);
            String exePath             = Application.ExecutablePath;
            String path = Path.Combine(Path.GetDirectoryName(exePath), "Resources\\Icons");

            JumpListTask compose = new JumpListLink(UrlHelper.BuildComposeUrl(defaultAccountIndex), Locale.Current.Labels.Compose)
            {
                IconReference = new IconReference(Path.Combine(path, "Compose.ico"), 0)
            };

            // we need a different icon name here, there's a really whacky conflict between an embedded resource, and a content resource file name.

            JumpListTask inbox = new JumpListLink(UrlHelper.BuildInboxUrl(defaultAccountIndex), Locale.Current.Labels.Inbox)
            {
                IconReference = new IconReference(Path.Combine(path, "GoInbox.ico"), 0)
            };

            JumpListTask refresh = new JumpListLink(exePath, Locale.Current.Labels.CheckMail)
            {
                IconReference = new IconReference(Path.Combine(path, "Refresh.ico"), 0),
                Arguments     = "-check"
            };

            JumpListTask settings = new JumpListLink(exePath, Locale.Current.Labels.ConfigurationShort)
            {
                IconReference = new IconReference(Path.Combine(path, "Settings.ico"), 0),
                Arguments     = "-settings"
            };

            JumpListTask about = new JumpListLink(exePath, Locale.Current.Labels.About)
            {
                IconReference = new IconReference(Path.Combine(path, "about.ico"), 0),
                Arguments     = "-about"
            };

            JumpListTask help = new JumpListLink(exePath, Locale.Current.Labels.Help)
            {
                IconReference = new IconReference(Path.Combine(path, "help.ico"), 0),
                Arguments     = "-help"
            };

            _jumpList.AddUserTasks(compose);
            _jumpList.AddUserTasks(inbox);
            _jumpList.AddUserTasks(refresh);
            _jumpList.AddUserTasks(settings);
            _jumpList.AddUserTasks(help);
            _jumpList.AddUserTasks(about);
        }
Beispiel #10
0
        public static void Jumplist()
        {
            if (!Win7.IsWin7)
            {
                return;
            }

            try
            {
                jumplist = JumpList.CreateJumpList();
                jumplist.ClearAllUserTasks();
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Shutdown"])
                {
                    IconReference = new IconReference(Data.EXE, 1), Arguments = "-s"
                });
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Restart"])
                {
                    IconReference = new IconReference(Data.EXE, 2), Arguments = "-r"
                });
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Logoff"])
                {
                    IconReference = new IconReference(Data.EXE, 3), Arguments = "-l"
                });
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Lock"])
                {
                    IconReference = new IconReference(Data.EXE, 3), Arguments = "-lo"
                });
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Standby"])
                {
                    IconReference = new IconReference(Data.EXE, 4), Arguments = "-sb"
                });
                jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Hibernate"])
                {
                    IconReference = new IconReference(Data.EXE, 4), Arguments = "-h"
                });
                if (Data.S["WOSB"])
                {
                    jumplist.AddUserTasks(new JumpListSeparator());
                    jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["HibernateWOSBIni"])
                    {
                        IconReference = new IconReference(Data.EXE, 5), Arguments = "-hi"
                    });
                    //jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["HibernateWOSBTime"]) { IconReference = new IconReference(Data.EXE, 5), Arguments = "-ht" });
                }
                //jumplist.AddUserTasks(new JumpListSeparator());
                //jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Abort"]) { IconReference = new IconReference(EXE, 6), Arguments = "-a", WorkingDirectory = Path.GetDirectoryName(EXE) });

                jumplist.Refresh();
            }
            catch { }
        }
Beispiel #11
0
        internal static void InitJumpList()
        {
            jumpList = JumpList.CreateJumpList();
            jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;
            jumpList.ClearAllUserTasks();
            string       ourFileName = Assembly.GetEntryAssembly().Location;
            JumpListLink quitLink    = new JumpListLink(ourFileName, "Quit PeaRoxy")
            {
                Arguments = "--quit",
            };

            jumpList.AddUserTasks(new JumpListTask[] { quitLink });
            jumpList.Refresh();
        }
Beispiel #12
0
        private void JumpListeAkt()
        {
            JumpList list = JumpList.CreateJumpList();

            list.ClearAllUserTasks();
            for (int i = 0; i < _dict.Namen.Length; i++)
            {
                JumpListLink j = new JumpListLink(Application.ExecutablePath, _dict.Namen[i]);
                j.Arguments     = i.ToString();
                j.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"), 0);
                list.AddUserTasks(j);
            }
            list.AddUserTasks(new JumpListLink(Application.StartupPath, "open directory"));
            list.Refresh();
        }
Beispiel #13
0
        internal static void ClearWindowsJumpList(Form1 form)
        {
            #if Debug
            return;
            #endif

            switch (GetOSInfo())
            {
            case OS.Seven:
            {
                JumpList list = JumpList.CreateJumpListForIndividualWindow(ConstantUtil.jumpListApplicationId, form.Handle);         //TaskbarManager.Instance.ApplicationId
                list.ClearAllUserTasks();

                list.Refresh();
            }
            break;
            }
        }
Beispiel #14
0
        internal static void RegisterTaskBarActions(List <Link> definition)
        {
            JumpList = JumpList.CreateJumpList();
            JumpList.ClearAllUserTasks();
            JumpList.Refresh();

            var categories = from item in definition
                             where !string.IsNullOrEmpty(item.Category)
                             group item by item.Category into g
                             select new JumpListCustomCategory(g.Key);

            foreach (var item in categories)
            {
                var items = from link in definition
                            where !string.IsNullOrEmpty(link.Category) && link.Category == item.Name
                            select new JumpListLink(link.Path, link.Title)
                {
                    Arguments        = link.Arguments,
                    WorkingDirectory = link.WorkingDirectory,
                    IconReference    = !string.IsNullOrEmpty(link.IconLocation) ? new IconReference(link.IconLocation, link.IconIndex) : new IconReference(),
                    ShowCommand      = link.ShowCommand
                };
                item.AddJumpListItems(items.ToArray());
                JumpList.AddCustomCategories(item);
            }

            var tasks = from link in definition
                        where string.IsNullOrEmpty(link.Category)
                        select new JumpListLink(link.Path, link.Title)
            {
                Arguments        = link.Arguments,
                WorkingDirectory = link.WorkingDirectory,
                IconReference    = !string.IsNullOrEmpty(link.IconLocation) ? new IconReference(link.IconLocation, link.IconIndex) : new IconReference(),
                ShowCommand      = link.ShowCommand
            };

            if (tasks != null && tasks.Any())
            {
                JumpList.AddUserTasks(tasks.ToArray());
            }

            JumpList.Refresh();
        }
Beispiel #15
0
 /// <summary>
 ///     The end.
 /// </summary>
 public static void End()
 {
     if (jumpList != null && TaskbarManager.IsPlatformSupported)
     {
         jumpList.ClearAllUserTasks();
         jumpList.Refresh();
     }
     ApplicationRestartRecoveryManager.UnregisterApplicationRestart();
     if (Current != null && Current.MainWindow != null)
     {
         MainWindow cWindow = Current.MainWindow as MainWindow;
         if (cWindow != null)
         {
             cWindow.StopServer(true);
         }
         Current.Shutdown();
     }
     Environment.Exit(0);
 }
Beispiel #16
0
        void Application_Idle(object sender, EventArgs e)
        {
            try
            {
                Process currentProcess = Process.GetCurrentProcess();
                if (currentProcess != null && currentProcess.MainWindowHandle != IntPtr.Zero && !bLoaded)
                {
                    bLoaded           = true;
                    Application.Idle -= Application_Idle;
                    if (_jumpList == null)
                    {
                        _jumpList = JumpList.CreateJumpList();
                        _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                        _jumpList.ClearAllUserTasks();
                        _jumpList.Refresh();
                    }
                    var list = new List <string>();
                    foreach (MyApps app in apps.ToList().OrderByDescending(x => x.Fileinfo.LastAccessTime))
                    {
                        if (app.Fileinfo.Exists)
                        {
                            string name = app.Fileinfo.Name.Replace(app.Fileinfo.Extension, "");
                            if (!list.Contains(name))
                            {
                                JumpListTask task = new JumpListLink(app.Path, name)
                                {
                                    IconReference = new IconReference(app.Path, 0),
                                };

                                _jumpList.AddUserTasks(task);
                                list.Add(name);
                            }
                        }
                    }

                    _jumpList.Refresh();
                }
            }
            catch
            { }
        }
Beispiel #17
0
        internal void AddJumpList()
        {
            _jumpList = JumpList.CreateJumpList();

            //do i need this?
            _jumpList.ClearAllUserTasks();
            _jumpList.Refresh();

            JumpListLink openTask = new JumpListLink(_baseUrl, "Open inbox")
            {
                IconReference = new IconReference(Application.ExecutablePath, 2),
            };

            JumpListLink composeTask = new JumpListLink(_baseUrl + "#compose", "Compose mail")
            {
                IconReference = new IconReference(Application.ExecutablePath, 1),
            };

            JumpListLink refreshTask = new JumpListLink(Application.ExecutablePath, "Check for new mail")
            {
                Arguments     = "refresh",
                IconReference = new IconReference(Application.ExecutablePath, 4),
            };

            JumpListLink settingsTask = new JumpListLink(Application.ExecutablePath, "Settings")
            {
                Arguments     = "settings",
                IconReference = new IconReference(Application.ExecutablePath, 5),
            };

            JumpListLink logoutTask = new JumpListLink(Application.ExecutablePath, "Logout")
            {
                Arguments     = "logout",
                IconReference = new IconReference(Application.ExecutablePath, 3),
            };

            _jumpList.AddUserTasks(new JumpListTask[] { openTask, composeTask, refreshTask, settingsTask, logoutTask }); //new JumpListSeparator(),

            _jumpList.Refresh();                                                                                         // do i need this?
        }
Beispiel #18
0
        static public bool ApplyBlankJumplistToTaskbar(Primary parent)
        {
            bool result = false;

            try
            {
                // ////////
                JumpList dummyList = JumpList.CreateJumpListForAppId(parent.CurrentAppId);
                dummyList.ClearAllUserTasks();
                dummyList.Refresh();
                // Remove appid from own window!
                SetAppIdBackAfterJumplist();
                result = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("JumpList applying not successful." + "\r\n"
                                + e.ToString());
            }

            return(result);
        }
        /// <summary>
        /// Refreshes the taskbar tasks.
        /// </summary>
        private static void RefreshTaskbarTasks(JumpList jumpList)
        {
            try
            {
                jumpList.ClearAllUserTasks();

                jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;

                string applicationFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                string nativeResourceDll = Path.Combine(applicationFolder, NativeResourceDllName);

                jumpList.AddUserTasks(
                    new JumpListLink(Assembly.GetEntryAssembly().Location, "Create New Task")
                {
                    Arguments     = "/newtask",
                    IconReference = new IconReference(nativeResourceDll, NewTaskResourceId)
                });

                jumpList.AddUserTasks(new JumpListSeparator());

                foreach (BaseFolder f in App.Root.TaskData.AllFolders)
                {
                    jumpList.AddUserTasks(
                        new JumpListLink(Assembly.GetEntryAssembly().Location, "Goto " + f.Name)
                    {
                        Arguments     = "/goto " + "\"" + f.Name + "\"",
                        IconReference = new IconReference(nativeResourceDll, GotoResourceId)
                    });
                }

                jumpList.Refresh();
            }
            catch (COMException)
            {
                // catch rare COM exceptions
            }
        }
Beispiel #20
0
        static public bool ApplyJumplistToTaskbar(Primary parent)
        {
            bool result = false;

            try
            {
                JumpList newList = JumpList.CreateJumpListForAppId(parent.CurrentAppId);
                //newList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                //newList.KnownCategoryOrdinalPosition = 0;

                ListBox.ObjectCollection jumplistItems = parent.JumplistListBox.Items;
                for (int i = 0; i < jumplistItems.Count; i++)
                {
                    // Look for a category
                    T7EJumplistItem.ItemTypeVar jumplistItemType = ((T7EJumplistItem)jumplistItems[i]).ItemType;
                    if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category ||
                        jumplistItemType == T7EJumplistItem.ItemTypeVar.CategoryTasks)
                    {
                        JumpListCustomCategory category = new JumpListCustomCategory(((T7EJumplistItem)jumplistItems[i]).ItemName);

                        // Look for a task
                        for (int j = i + 1; j < jumplistItems.Count; j++)
                        {
                            i = j - 1; // When J loop is exited, i has to be less.
                            T7EJumplistItem jumplistItem = (T7EJumplistItem)jumplistItems[j];
                            switch (jumplistItem.ItemType)
                            {
                            case T7EJumplistItem.ItemTypeVar.Category:
                            case T7EJumplistItem.ItemTypeVar.CategoryTasks:
                                j = jumplistItems.Count;     // Exit the for loop
                                break;

                            case T7EJumplistItem.ItemTypeVar.Task:
                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(
                                        ParseApplyJumpListTask(parent, jumplistItem, j));
                                }
                                else
                                {
                                    newList.AddUserTasks(
                                        ParseApplyJumpListTask(parent, jumplistItem, j));
                                }
                                break;

                            case T7EJumplistItem.ItemTypeVar.FileFolder:
                                // If file is an EXE, just pass the path over.
                                // TODO: Merge "Command line" and "File/Folder shortcut" into one dialog, based on "Command Line"

                                JumpListLink link = new JumpListLink
                                {
                                    Title     = jumplistItem.ItemName,
                                    Path      = "C:\\Windows\\explorer.exe",
                                    Arguments = jumplistItem.FilePath
                                                // working directory here? We don't know what the program is.
                                                // AHK doesn't detect the default program's working dir, either.
                                };
                                if (jumplistItem.FileRunWithApp)
                                {
                                    link.Path = parent.CurrentAppPath;
                                    // we use working dir here because we KNOW the program to use
                                    link.WorkingDirectory = Path.GetDirectoryName(parent.CurrentAppPath);
                                }


                                if (Path.GetExtension(jumplistItem.FilePath).ToLower() == ".exe")
                                {
                                    link.Path      = jumplistItem.FilePath;
                                    link.Arguments = "";
                                    // we use working dir here because we KNOW the program to use
                                    link.WorkingDirectory = Path.GetDirectoryName(jumplistItem.FilePath);
                                }


                                // Format icon
                                if (jumplistItem.ItemIconToString().Equals("Don't use an icon") != true)
                                {
                                    // Icon processing
                                    string localIconPath = IconPathToLocal(jumplistItem.ItemIconPath, jumplistItem.ItemIconIndex, j, parent.CurrentAppId, false);
                                    if (File.Exists(localIconPath))
                                    {
                                        link.IconReference = new IconReference(localIconPath, 0);
                                    }
                                }

                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(link);
                                }
                                else
                                {
                                    newList.AddUserTasks(link);
                                }
                                break;

                            case T7EJumplistItem.ItemTypeVar.Separator:
                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.CategoryTasks)
                                {
                                    newList.AddUserTasks(new JumpListSeparator());
                                }
                                break;
                            }
                        }

                        if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                        {
                            newList.AddCustomCategories(category);
                        }
                    }
                }

                // ////////
                JumpList dummyList = JumpList.CreateJumpListForAppId(parent.CurrentAppId);

                /*dummyList.AddUserTasks(new JumpListLink
                 * {
                 *  Title = "Dummy",
                 *  Path = "%windir%\\explorer.exe"
                 * });*/
                dummyList.ClearAllUserTasks();
                dummyList.Refresh();
                newList.Refresh();
                // Remove appid from own window!
                SetAppIdBackAfterJumplist();
                result = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("JumpList applying not successful." + "\r\n"
                                + e.ToString());
            }

            return(result);
        }
Beispiel #21
0
 internal void RemoveJumpList()
 {
     _jumpList.ClearAllUserTasks();
     _jumpList.Refresh();
 }
Beispiel #22
0
        private void buttonRefreshTaskbarList_Click(object sender, EventArgs e)
        {
            // Start from an empty list for user tasks
            childWindowJumpList.ClearAllUserTasks();

            // Path to Windows system folder
            string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);

            // Path to the Program Files folder
            string programFilesFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

            // Path to Windows folder (if targeting .NET 4.0, can use Environment.SpecialFolder.Windows instead)
            string windowsFolder = Environment.GetEnvironmentVariable("windir");

            foreach (object item in listBox1.SelectedItems)
            {
                switch (item.ToString())
                {
                case "Notepad":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
                    {
                        IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0)
                    });
                    break;

                case "Calculator":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "calc.exe"), "Open Calculator")
                    {
                        IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)
                    });
                    break;

                case "Paint":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
                    {
                        IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)
                    });
                    break;

                case "WordPad":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(programFilesFolder, "Windows NT\\Accessories\\wordpad.exe"), "Open WordPad")
                    {
                        IconReference = new IconReference(Path.Combine(programFilesFolder, "Windows NT\\Accessories\\wordpad.exe"), 0)
                    });
                    break;

                case "Windows Explorer":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(windowsFolder, "explorer.exe"), "Open Windows Explorer")
                    {
                        IconReference = new IconReference(Path.Combine(windowsFolder, "explorer.exe"), 0)
                    });
                    break;

                case "Internet Explorer":
                    childWindowJumpList.AddUserTasks(new JumpListLink(Path.Combine(programFilesFolder, "Internet Explorer\\iexplore.exe"), "Open Internet Explorer")
                    {
                        IconReference = new IconReference(Path.Combine(programFilesFolder, "Internet Explorer\\iexplore.exe"), 0)
                    });
                    break;

                case "Control Panel":
                    childWindowJumpList.AddUserTasks(new JumpListLink(((ShellObject)KnownFolders.ControlPanel).ParsingName, "Open Control Panel")
                    {
                        IconReference = new IconReference(Path.Combine(windowsFolder, "explorer.exe"), 0)
                    });
                    break;

                case "Documents Library":
                    if (ShellLibrary.IsPlatformSupported)
                    {
                        childWindowJumpList.AddUserTasks(new JumpListLink(KnownFolders.DocumentsLibrary.Path, "Open Documents Library")
                        {
                            IconReference = new IconReference(Path.Combine(windowsFolder, "explorer.exe"), 0)
                        });
                    }
                    break;
                }
            }

            childWindowJumpList.Refresh();
        }