예제 #1
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage)
            {
                _jumpListManager = WindowsFormsExtensions.CreateJumpListManager(this);
                _jumpListManager.UserRemovedItems += (o, e) =>
                    {
                        e.CancelCurrentOperation = false;
                    };
                _jumpListManager.AddUserTask(new ShellLink
                {
                    Path = System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.System),
                        "calc.exe"),
                    Title = "Calculator",
                    Category = "Application",
                    IconLocation = System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.System),
                        "calc.exe"),
                    IconIndex = 0
                });
                _jumpListManager.AddUserTask(new ShellLink
                {
                    Path = System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.System),
                        "cmd.exe"),
                    Title = "Command Promt",
                    Category = "Application",
                    IconLocation = System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.System),
                        "cmd.exe"),
                    IconIndex = 0
                });

                _jumpListManager.Refresh();

                if (_thumbButtonManager == null)
                {
                    _thumbButtonManager = WindowsFormsExtensions.CreateThumbButtonManager(this);
                }
                _thumbButton = _thumbButtonManager.CreateThumbButton(1, this.Icon, "Test");
                /*_thumbButton.Clicked += delegate
                {
                    MessageBox.Show("Test button clicked");
                };*/
                _thumbButton.Clicked += new EventHandler(_thumbButton_Clicked);
                _thumbButtonManager.AddThumbButtons(_thumbButton);

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

            }

            base.WndProc(ref m);
        }
예제 #2
0
        /// <summary>
        /// Windows 7 SuperBar initialization proc.
        /// </summary>
        void CipWin7SuperBarInitialization()
        {
            _jumpListManager = Cip.WpfDemo.Tools.CipWindows7WpfHelper.CreateJumpListManager(this);
            _jumpListManager.UserRemovedItems += (o, events) =>
            {
                events.CancelCurrentOperation = false;
            };
            _jumpListManager.AddUserTask(new ShellLink
            {
                Path = System.IO.Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.System),
                    "calc.exe"),
                Title = "Calculator",
                Category = "Application",
                IconLocation = System.IO.Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.System),
                    "calc.exe"),
                IconIndex = 0
            });
            _jumpListManager.AddUserTask(new ShellLink
            {
                Path = System.IO.Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.System),
                    "cmd.exe"),
                Title = "Command Promt",
                Category = "Application",
                IconLocation = System.IO.Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.System),
                    "cmd.exe"),
                IconIndex = 0
            });
            string cip20Location = System.IO.Path.Combine(
                System.Windows.Application.Current.StartupUri.AbsolutePath,
                "ColourImageProcessing.exe.");
            _jumpListManager.AddUserTask(new ShellLink
            {
                Path = cip20Location,
                Title = "Colour image processing .NET 2.0",
                Category = "Application",
                IconLocation = cip20Location,
                IconIndex = 0
            });

            _jumpListManager.Refresh();

            //Icon construction
            Uri iconUri = new Uri("./../../cip_icon.ico", UriKind.RelativeOrAbsolute);
            this.Icon = BitmapFrame.Create(iconUri);

            if (_thumbButtonManager == null)
            {
                _thumbButtonManager = Cip.WpfDemo.Tools.CipWindows7WpfHelper.CreateThumbButtonManager(this);
            }
            _thumbButton = _thumbButtonManager.CreateThumbButton(
                1,
                Cip.WpfDemo.Properties.Resources.cip_icon,
                "Cip button");
            _thumbButton.Clicked += new EventHandler(_thumbButton_Clicked);
            _thumbButtonManager.AddThumbButtons(_thumbButton);
            //_thumbButtonManager.DispatchMessage
        }