public void AddThumbnailButton(string name, Bitmap image, int buttonId)
        {
            if (_taskbarList != null && _buttons.Count < 7)
            {
                ThumbButton btn = new ThumbButton();
                btn.Flags = ThumbButtonOptions.Enabled | ThumbButtonOptions.DismissOnClick;
                btn.Icon  = image.GetHicon();
                btn.Id    = (uint)buttonId;
                btn.Mask  = ThumbButtonMask.Icon | ThumbButtonMask.Tooltip | ThumbButtonMask.THB_FLAGS;
                btn.Tip   = name;

                _buttons.Add(btn);
            }
        }
Esempio n. 2
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage)
            {
                this.SetThumbnailTooltip("Cool window!");

                _jumpListManager = this.CreateJumpListManager();
                _jumpListManager.UserRemovedItems += (o, e) =>
                {
                    statusLabel.Text         = "User removed " + e.RemovedItems.Length + " items (cancelling refresh)";
                    e.CancelCurrentOperation = true;
                };
                _jumpListManager.ClearAllDestinations();
                _jumpListManager.EnabledAutoDestinationType = ApplicationDestinationType.Recent;

                TaskbarOverlayIcon = SystemIcons.Hand;

                _thumbButtonManager = this.CreateThumbButtonManager();
                ThumbButton button2 = _thumbButtonManager.CreateThumbButton(102, SystemIcons.Exclamation, "Beware of me!");
                button2.Clicked += delegate
                {
                    statusLabel.Text = "Second button clicked";
                    button2.Enabled  = false;
                };
                ThumbButton button = _thumbButtonManager.CreateThumbButton(101, SystemIcons.Information, "Click me");
                button.Clicked += delegate
                {
                    statusLabel.Text = "First button clicked";
                    button2.Enabled  = true;
                };
                _thumbButtonManager.AddThumbButtons(button, button2);
            }

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

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

            base.WndProc(ref m);
        }
Esempio n. 3
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage)
            {
                _thumbButtonManager = this.CreateThumbButtonManager();

                ThumbButton stopButton = _thumbButtonManager.CreateThumbButton(101, Icon.FromHandle(((Bitmap)playerIcons.Images["stop.png"]).GetHicon()), "Stop");
                stopButton.Clicked += delegate {
                    client.stop();
                };
                ThumbButton playButton = _thumbButtonManager.CreateThumbButton(102, Icon.FromHandle(((Bitmap)playerIcons.Images["play.png"]).GetHicon()), "Play/Pause");
                playButton.Clicked += delegate {
                    client.playPause();
                };
                ThumbButton skipButton = _thumbButtonManager.CreateThumbButton(103, Icon.FromHandle(((Bitmap)playerIcons.Images["skip.png"]).GetHicon()), "Skip");
                skipButton.Clicked += delegate {
                    client.skip();
                    coolProgressBar1.Value = coolProgressBar1.Maximum;
                };
                ThumbButton volDownButton = _thumbButtonManager.CreateThumbButton(104, Icon.FromHandle(((Bitmap)playerIcons.Images["volume-down.png"]).GetHicon()), "Volume Down");
                volDownButton.Clicked += delegate {
                    client.volume(-1);
                };
                ThumbButton volUpButton = _thumbButtonManager.CreateThumbButton(105, Icon.FromHandle(((Bitmap)playerIcons.Images["volume-up.png"]).GetHicon()), "Volume Up");
                volUpButton.Clicked += delegate {
                    client.volume(1);
                };
                _thumbButtonManager.AddThumbButtons(stopButton, playButton, skipButton, volDownButton, volUpButton);
            }

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

            base.WndProc(ref m);
        }