Beispiel #1
0
        private void btnBuildJumpList_Click(object sender, EventArgs e)
        {
            string shell32DllPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "shell32.dll");

            _jumpListManager.AddCustomDestination(new ShellLink
            {
                Path         = Path.Combine(_thisAppDataPath, "sonnet.txt"),
                Title        = "Shall I compare thee...",
                Category     = "My Category",
                IconLocation = shell32DllPath,
                IconIndex    = 1
            });
            _jumpListManager.AddCustomDestination(new ShellLink
            {
                Path         = Path.Combine(_thisAppDataPath, "mary.txt"),
                Title        = "Mary had a little...",
                Category     = "My Category",
                IconLocation = shell32DllPath,
                IconIndex    = 1
            });
            _jumpListManager.AddCustomDestination(new ShellLink
            {
                Path         = Path.Combine(_thisAppDataPath, "hello.html"),
                Title        = "Hello World",
                Category     = "My Other Category",
                IconLocation = shell32DllPath,
                IconIndex    = 5
            });
            _jumpListManager.AddCustomDestination(new ShellItem
            {
                Path     = Path.Combine(_thisAppDataPath, "raven.txt"),
                Category = "My Other Category"
            });
            _jumpListManager.AddUserTask(new ShellLink
            {
                Path         = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "notepad.exe"),
                Title        = "Launch Notepad",
                IconLocation = shell32DllPath,
                IconIndex    = 14
            });
            _jumpListManager.AddUserTask(new Separator());
            _jumpListManager.AddUserTask(new ShellLink
            {
                Path         = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "calc.exe"),
                Title        = "Launch Calculator",
                IconLocation = shell32DllPath,
                IconIndex    = 15
            });
            if (_jumpListManager.Refresh())
            {
                statusLabel.Text = "Maximum slots in list: " +
                                   _jumpListManager.MaximumSlotsInList;
            }
        }
Beispiel #2
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage)
            {
                _jumpListManager = new JumpListManager(APP_ID);
                _jumpListManager.UserRemovedItems += delegate { };
                _jumpListManager.AddUserTask(new ShellLink
                {
                    Path  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Windows NT\Accessories\wordpad.exe"),
                    Title = "Launch Wordpad"
                });
                _jumpListManager.AddCustomDestination(new ShellItem
                {
                    Path     = @"D:\Users\Sasha\Documents\Courses\Windows 7\Code\SampleDocument.rtf",
                    Category = "Interesting"
                });
                _jumpListManager.Refresh();
            }

            if (_clipToggled)
            {
                SetClip();
            }

            if (_customWindowManager != null)
            {
                _customWindowManager.DispatchMessage(ref m);
                _customWindowManager.InvalidatePreviews();
            }

            base.WndProc(ref m);
        }
Beispiel #3
0
        protected override void WndProc(ref Message m)
        {
            //

            if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage)
            {
                _jumpListManager = new JumpListManager(APP_ID);
                _jumpListManager.UserRemovedItems += delegate { };
                _jumpListManager.AddUserTask(new ShellLink
                {
                    Path  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Windows NT\Accessories\wordpad.exe"),
                    Title = "Launch Wordpad"
                });


                _jumpListManager.AddCustomDestination(new ShellItem
                {
                    Path     = "C:\\Document1.rtf",
                    Category = "Interesting"
                });
                _jumpListManager.Refresh();
            }



            base.WndProc(ref m);
        }