private void MainFrm_Shown(object sender, EventArgs e) { string[] a = Environment.GetCommandLineArgs(); //Przyciski Aero Size s = new Size(16, 16); buttonFirst = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.back_arrowICO, s), "Odtwórz poprzedni"); buttonFirst.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzPoprzedniToolStripMenuItem_Click); buttonSecond = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.Forward_ArrowICO, s), "Odtwórz następny"); buttonSecond.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzNastęnyToolStripMenuItem_Click); windowsTaskbar.ThumbnailToolbars.AddButtons(this.Handle, buttonFirst, buttonSecond); //JumpLista JumpList Lista = JumpList.CreateJumpList(); IJumpListTask zadanie1 = new JumpListLink(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", "Uruchom notatnik") { IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", 0), Title = @"c:\widnows\notepad.exe" }; Lista.AddUserTasks(zadanie1); Lista.Refresh(); }
private void setup_toolbar() { if (addedToolbar) { return; } var pause = new ThumbnailToolbarButton(Properties.Resources.Pause, "Pause"); pause.Click += (sender, args) => this.pause(); var play = new ThumbnailToolbarButton(Properties.Resources.Play, "Play"); play.Click += (sender, args) => this.play(); if (TaskbarManager.IsPlatformSupported) { TaskbarManager.Instance.ThumbnailToolbars.AddButtons( new WindowInteropHelper(Application.Current.MainWindow).Handle, pause, play); } addedToolbar = true; }
// Change the certain Thumbnail button's visible and enable status // based on the current selected index in the imageListView private void ChangeVisibility(ThumbnailToolbarButton btn, bool show, ButtonTask task) { if (btn != null) { // Update the button's UI status btn.Visible = show; btn.IsInteractive = show; // Change the certain button enable status based on the // selected index of the imageListView switch (task) { case ButtonTask.First: case ButtonTask.Previous: // The First and Previous Thumbnail toolbar button // is enabled if the first image in the // imageListView is not selected btn.Enabled = !imageListView.Items[0].Selected; break; case ButtonTask.Last: case ButtonTask.Next: // The Last and Next Thumbnail toolbar button // is enabled if the last image in the // imageListView is not selected btn.Enabled = !imageListView.Items[imageListView. Items.Count - 1].Selected; break; } } }
static TaskbarManagerHelper() { for (int i = 0; i < COUNT; i++) { string txt = (i + 1).ToString(); _buttons[i] = new ThumbnailToolbarButton(CreateTextIcon(txt), txt); _buttons[i].DismissOnClick = false; _buttons[i].IsInteractive = true; _buttons[i].Visible = true; _buttons[i].Enabled = true; _buttons[i].Click += TaskbarButton_Click; } }
private string _cachedSongTitle; //Used to tell if song has changed public FrmMain() { // // Required for Windows Form Designer support // InitializeComponent(); this.Resize += new EventHandler(FrmMain_Resize); //code to remember window size and position // this is the default this.WindowState = FormWindowState.Normal; this.StartPosition = FormStartPosition.WindowsDefaultBounds; // check if the saved bounds are nonzero and visible on any screen if (Properties.Settings.Default.WindowPosition != Rectangle.Empty && IsVisibleOnAnyScreen(Properties.Settings.Default.WindowPosition)) { // first set the bounds this.StartPosition = FormStartPosition.Manual; this.DesktopBounds = Properties.Settings.Default.WindowPosition; // afterwards set the window state to the saved value (which could be Maximized) this.WindowState = Properties.Settings.Default.WindowState; } else { // this resets the upper left corner of the window to windows standards this.StartPosition = FormStartPosition.WindowsDefaultLocation; // we can still apply the saved size // msorens: added gatekeeper, otherwise first time appears as just a title bar! if (Properties.Settings.Default.WindowPosition != Rectangle.Empty) { this.Size = Properties.Settings.Default.WindowPosition.Size; } } // // Win 7 toolbar buttons // //Moved here from initializeComponent method because it is recreated after adding any controls to the form buttonPrev = new ThumbnailToolbarButton(Properties.Resources.PlayerPrev, "Previous Music"); buttonPause = new ThumbnailToolbarButton(Properties.Resources.PlayerPlay, "Pause/Play Music"); isbuttonPaused = false; isMusicPlaying = false; buttonNext = new ThumbnailToolbarButton(Properties.Resources.PlayerNext, "Next Music"); windowInitialized = true; }
public Pomodo7oWindow(ITaskbarManager taskbarManager, ViewModel viewModel) { _taskbarManager = taskbarManager; _viewModel = viewModel; DataContext = viewModel; InitializeComponent(); _btnReset = Button(Res.icon_reset, Res.ToolTip_Reset, () => Reset()); _btnPlay = Button(Res.icon_play, Res.ToolTip_Play, () => Play()); _btnPause = Button(Res.icon_pause, Res.ToolTip_Pause, () => Pause()); _btnGoToWork = Button(Res.icon_tomato, Res.ToolTip_GoToWork, () => GoToWork()); _btnGoToRest = Button(Res.icon_tomato_rest, Res.ToolTip_GoToRest, () => TakeABreak()); }
void Form1_Shown(object sender, System.EventArgs e) { //thumbnail toolbar button setup buttonAdd = new ThumbnailToolbarButton(Properties.Resources.feed, "Add New Subscription"); buttonAdd.Enabled = true; buttonAdd.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonAdd_Click); buttonRefresh = new ThumbnailToolbarButton(Properties.Resources.feedRefresh, "Refresh Feeds"); buttonRefresh.Enabled = true; buttonRefresh.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonRefresh_Click); TaskbarManager.Instance.ThumbnailToolbars.AddButtons(this.Handle, buttonAdd, buttonRefresh); TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(this.Handle, new Rectangle(pictureBox1.Location, pictureBox1.Size)); string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); //setup jumplist jumpList = JumpList.CreateJumpList(); category1.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "SteveSi's Office Hours")); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint2.exe"), "Add Google Reader Feeds") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\google.bmp"), 0) }); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint3.exe"), "Add Facebook News Feed") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\facebook.ico"), 0) }); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint4.exe"), "Refresh Feeds") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\feedRefresh.ico"), 0) }); jumpList.AddCustomCategories(category1, category2); jumpList.AddUserTasks(new JumpListSeparator()); JumpListCustomCategory empty = new JumpListCustomCategory(String.Empty); empty.AddJumpListItems(new JumpListLink("http://www.rssbandit.org", "Go to rssbandit.org") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\app.ico"), 0) }); jumpList.AddCustomCategories(empty); TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress); jumpList.Refresh(); windowsTaskbar.SetOverlayIcon(this.Handle, Properties.Resources.envelope, "New Items"); // windowsTaskbar.SetOverlayIcon(this.Handle, null, null); <-- to clear }
private void Thumbnail_Shown(object sender, EventArgs e) { this.thumbButtonNext = new ThumbnailToolbarButton(this.Icon, "Next"); this.thumbButtonNext.Enabled = true; this.thumbButtonNext.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(thumbButtonNext_Click); this.thumbButtonPrev = new ThumbnailToolbarButton(this.Icon, "Prev"); this.thumbButtonPrev.Enabled = true; this.thumbButtonPrev.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(thumbButtonPrev_Click); TabbedThumbnail thumb = new TabbedThumbnail(this.Handle, this.Handle); thumb.SetImage(Properties.Resources.Thumb); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(thumb); TaskbarManager.Instance.ThumbnailToolbars.AddButtons(this.Handle, this.thumbButtonPrev, this.thumbButtonNext); pictureBox1.Image = Properties.Resources.Thumb; pictureBox1_SizeChanged(this.pictureBox1, null); }
public static ThumbnailToolbarButton CreateThumbnailToolbarButton(this Gtk.Action action, Func <Gtk.Action, System.Drawing.Icon> icon_callback) { var button = new ThumbnailToolbarButton(id++) { DismissOnClick = false, Tooltip = action.Label.Replace("_", ""), Enabled = action.Sensitive, Hidden = !action.Visible, Icon = icon_callback != null?icon_callback(action) : null }; button.Clicked += (o, e) => action.Activate(); action.AddNotification("icon-name", (o, args) => button.Icon = icon_callback != null ? icon_callback(action) : null); action.AddNotification("stock-id", (o, args) => button.Icon = icon_callback != null ? icon_callback(action) : null); action.AddNotification("tooltip", (o, args) => button.Tooltip = action.Label.Replace("_", "")); action.AddNotification("sensitive", (o, args) => button.Enabled = action.Sensitive); action.AddNotification("visible", (o, args) => button.Hidden = !action.Visible); return(button); }
// Create the Thumbnail toolbar buttons instance private void CreateToolbarButtons() { // Initialize the First Thumbnail toolbar button buttonFirst = new ThumbnailToolbarButton(Properties.Resources. first, "First Image"); // Update the button's enabled status and register Click event // handler buttonFirst.Enabled = false; buttonFirst.Click += buttonFirst_Click; // Initialize the Previous Thumbnail toolbar button buttonPrevious = new ThumbnailToolbarButton(Properties. Resources.prevArrow, "Previous Image"); // Update the button's enabled status and register Click event // handler buttonPrevious.Enabled = false; buttonPrevious.Click += buttonPrevious_Click; // Initialize the Next Thumbnail toolbar button buttonNext = new ThumbnailToolbarButton(Properties.Resources. nextArrow, "Next Image"); // Register the Click event handler buttonNext.Click += buttonNext_Click; // Initialize the Last Thumbnail toolbar button buttonLast = new ThumbnailToolbarButton(Properties.Resources. last, "Last Image"); // Register the Click event handler buttonLast.Click += buttonLast_Click; // Creates the four Thumbnail toolbar buttons TaskbarManager.Instance.ThumbnailToolbars.AddButtons( this.Handle, buttonFirst, buttonPrevious, buttonNext, buttonLast); }
private void UpdateHandle(ThumbnailToolbarButton button) { button.AddedToTaskbar = _buttonsAdded; }
public MainForm() { InitializeComponent(); appNotifyIcon.Text = AboutForm.AssemblyTitle; levelComboBox.SelectedIndex = 0; Minimized += OnMinimized; // Init Log Manager Singleton LogManager.Instance.Initialize(new TreeViewLoggerView(loggerTreeView), logListView); _dockExtender = new DockExtender(this); // Dockable Log Detail View _logDetailsPanelFloaty = _dockExtender.Attach(logDetailPanel, logDetailToolStrip, logDetailSplitter); _logDetailsPanelFloaty.DontHideHandle = true; _logDetailsPanelFloaty.Docking += OnFloatyDocking; // Dockable Logger Tree _loggersPanelFloaty = _dockExtender.Attach(loggerPanel, loggersToolStrip, loggerSplitter); _loggersPanelFloaty.DontHideHandle = true; _loggersPanelFloaty.Docking += OnFloatyDocking; // Settings _firstStartup = !UserSettings.Load(); if (_firstStartup) { // Initialize default layout UserSettings.Instance.Layout.Set(DesktopBounds, WindowState, logDetailPanel, loggerPanel); // Force panel to visible UserSettings.Instance.Layout.ShowLogDetailView = true; UserSettings.Instance.Layout.ShowLoggerTree = true; UserSettings.Instance.DefaultFont = Environment.OSVersion.Version.Major >= 6 ? new Font("Segoe UI", 9F) : new Font("Tahoma", 8.25F); } Font = UserSettings.Instance.DefaultFont ?? Font; _windowRestorer = new WindowRestorer(this, UserSettings.Instance.Layout.WindowPosition, UserSettings.Instance.Layout.WindowState); // Windows 7 CodePack (Taskbar icons and progress) _isWin7orLater = TaskbarManager.IsPlatformSupported; if (_isWin7orLater) { try { // Taskbar Progress TaskbarManager.Instance.ApplicationId = Text; _taskbarProgressTimer = new Timer(OnTaskbarProgressTimer, null, _taskbarProgressTimerPeriod, _taskbarProgressTimerPeriod); // Pause Btn _pauseWinbarBtn = new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap)pauseBtn.Image).GetHicon()), pauseBtn.ToolTipText); _pauseWinbarBtn.Click += pauseBtn_Click; // Auto Scroll Btn _autoScrollWinbarBtn = new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap)autoLogToggleBtn.Image).GetHicon()), autoLogToggleBtn.ToolTipText); _autoScrollWinbarBtn.Click += autoLogToggleBtn_Click; // Clear All Btn _clearAllWinbarBtn = new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap)clearLoggersBtn.Image).GetHicon()), clearLoggersBtn.ToolTipText); _clearAllWinbarBtn.Click += clearAll_Click; // Add Btns TaskbarManager.Instance.ThumbnailToolbars.AddButtons(Handle, _pauseWinbarBtn, _autoScrollWinbarBtn, _clearAllWinbarBtn); } catch (Exception) { // Not running on Win 7? _isWin7orLater = false; } } ApplySettings(true); _eventQueue = new Queue <LogMessage>(); // Initialize Receivers foreach (IReceiver receiver in UserSettings.Instance.Receivers) { InitializeReceiver(receiver); } // Start the timer to process event logs in batch mode _logMsgTimer = new Timer(OnLogMessageTimer, null, 1000, 100); }
private void UpdateHandle(ThumbnailToolbarButton button) { button.WindowHandle = _thumbnailToolbarProxyWindow.WindowHandle; button.AddedToTaskbar = false; }
void UpdateHandle(ThumbnailToolbarButton button) { button.WindowHandle = WindowHandle; button.AddedToTaskbar = false; }
// Only update the Thumbnal toolbar button visible status private void ChangeVisibility(ThumbnailToolbarButton btn, bool show) { ChangeVisibility(btn, show, ButtonTask.All); }