Example #1
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
            { }
        }
Example #2
0
        /// <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
            }
        }
Example #3
0
        internal void AddJumpList()
        {
            _jumpList = JumpList.CreateJumpList();

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

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

            JumpListLink composeTask = new JumpListLink(_baseUrl + "#compose", "Compose mail")
            {
                Arguments = "compose",
                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?
        }