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); }
internal ThumbButton(ThumbButtonManager manager, uint id, Icon icon, string tooltip) { _manager = manager; Id = id; Icon = icon; Tooltip = tooltip; }
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); }
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); }
/// <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 }