Event args for various Tabbed Thumbnail related events
상속: System.EventArgs
예제 #1
0
        private TabbedThumbnailEventArgs GetTabbedThumbnailEventArgs()
        {
            TabbedThumbnailEventArgs eventArgs = null;

            if (this.WindowHandle != IntPtr.Zero)
            {
                eventArgs = new TabbedThumbnailEventArgs(this.WindowHandle);
            }
            else if (this.WindowsControl != null)
            {
                eventArgs = new TabbedThumbnailEventArgs(this.WindowsControl);
            }

            return(eventArgs);
        }
예제 #2
0
        void preview_TabbedThumbnailActivated(object sender, TabbedThumbnailEventArgs e)
        {
            // User selected a tab via the thumbnail preview
            // Select the corresponding control in our app
            foreach (TabPage page in tabControl1.TabPages)
            {
                if (page.Handle == e.WindowHandle)
                {
                    // Select the tab in the application UI as well as taskbar tabbed thumbnail list
                    tabControl1.SelectedTab = page;
                    TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(page);
                }
            }

            // Also activate our parent form (incase we are minimized, this will restore it)
            if (this.WindowState == FormWindowState.Minimized)
                this.WindowState = FormWindowState.Normal;
        }
예제 #3
0
        void preview_TabbedThumbnailMaximized(object sender, TabbedThumbnailEventArgs e)
        {
            // User clicked on the maximize button on the thumbnail's context menu
            // Maximize the app
            this.WindowState = FormWindowState.Maximized;

            // If there is a selected tab, take it's screenshot
            // invalidate the tab's thumbnail
            // update the "preview" object with the new thumbnail
            if (tabControl1.Size != Size.Empty && tabControl1.TabPages.Count > 0 && tabControl1.SelectedTab != null)
                UpdatePreviewBitmap(tabControl1.SelectedTab);
        }
예제 #4
0
 void preview_TabbedThumbnailMinimized(object sender, TabbedThumbnailEventArgs e)
 {
     // User clicked on the minimize button on the thumbnail's context menu
     // Minimize the app
     this.WindowState = FormWindowState.Minimized;
 }
예제 #5
0
        private TabbedThumbnailEventArgs GetTabbedThumbnailEventArgs()
        {
            TabbedThumbnailEventArgs eventArgs = null;

            if (this.WindowHandle != IntPtr.Zero)
                eventArgs = new TabbedThumbnailEventArgs(this.WindowHandle, this);
            else if (this.WindowsControl != null)
                eventArgs = new TabbedThumbnailEventArgs(this.WindowsControl, this);

            return eventArgs;
        }
예제 #6
0
        void preview_TabbedThumbnailClosed(object sender, TabbedThumbnailEventArgs e)
        {
            foreach (TitleBarTab tab in Tabs)
            {
                RDCWindow rdcWindow = (RDCWindow)tab.Content;

                if (rdcWindow.Handle == e.WindowHandle)
                {
                    rdcWindow.Close();
                    TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(e.TabbedThumbnail);
                    break;
                }
            }
        }
예제 #7
0
        void preview_TabbedThumbnailActivated(object sender, TabbedThumbnailEventArgs e)
        {
            foreach (TitleBarTab tab in Tabs)
            {
                if (tab.Content.Handle == e.WindowHandle)
                {
                    SelectedTabIndex = Tabs.IndexOf(tab);

                    TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tab.Content);
                    break;
                }
            }

            if (WindowState == FormWindowState.Minimized)
                WindowState = FormWindowState.Normal;
        }
 private void TabbedThumbnailActivated(object sender, TabbedThumbnailEventArgs e)
 {
     Activate();
 }
 //The following method is part of the lab. When a thumbnail is requested, provide it on demand
 //by loading an image from a resource.
 private void TabbedThumbnail_TabbedThumbnailBitmapRequested(object sender, TabbedThumbnailEventArgs e)
 {
     //if (_sneakySource == null)
     //{
     //    _sneakySource = new BitmapImage();
     //    _sneakySource.BeginInit();
     //    _sneakySource.DecodePixelHeight = 200;
     //    _sneakySource.UriSource = new Uri("pack://application:,,,/assets/SpeedyGonzales.jpg");
     //    _sneakySource.EndInit();
     ////}
     Bitmap preview = new Bitmap(nowPlayingFile.GetImageFile(MJImageFileFlags.IMAGEFILE_THUMBNAIL_MEDIUM));
     e.TabbedThumbnail.SetImage(preview);
     e.TabbedThumbnail.DisplayFrameAroundBitmap = false;
 }
예제 #10
0
 private void _Preview_TabbedThumbnailClosed(object sender, TabbedThumbnailEventArgs e)
 {
     (Control.FromHandle(e.WindowHandle) as Form).Close();
 }
예제 #11
0
 private void Thumbnail_Activated(object sender, TabbedThumbnailEventArgs e)
 {
     // i can't track down why exactly, but this is being fired twice.
     if (_thumbActivated) {
         _thumbActivated = false;
     }
     else {
         _thumbActivated = true;
         OpenEmail();
     }
 }
예제 #12
0
        private TabbedThumbnailEventArgs GetTabbedThumbnailEventArgs()
        {
            TabbedThumbnailEventArgs eventArgs = null;

            if (this.WindowHandle != IntPtr.Zero)
            {
                eventArgs = new TabbedThumbnailEventArgs(this.WindowHandle);
            }
            //            else if (this.WindowsControl != null)
            //            {
            //                eventArgs = new TabbedThumbnailEventArgs(this.WindowsControl);
            //            }

            return eventArgs;
        }
예제 #13
0
		/// <summary>
		/// Handler method that's called when the user clicks the close button in an Aero Peek preview thumbnail.  Finds the window associated with the thumbnail
		/// and calls <see cref="Form.Close" /> on it.
		/// </summary>
		/// <param name="sender">Object from which this event originated.</param>
		/// <param name="e">Arguments associated with this event.</param>
		private void preview_TabbedThumbnailClosed(object sender, TabbedThumbnailEventArgs e)
		{
			foreach (TitleBarTab tab in Tabs.Where(tab => tab.Content.Handle == e.WindowHandle))
			{
				tab.Content.Close();

				if (e.TabbedThumbnail != null)
					TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(e.TabbedThumbnail);

				break;
			}
		}
예제 #14
0
		/// <summary>
		/// Handler method that's called when the user clicks on an Aero Peek preview thumbnail.  Finds the tab associated with the thumbnail and
		/// focuses on it.
		/// </summary>
		/// <param name="sender">Object from which this event originated.</param>
		/// <param name="e">Arguments associated with this event.</param>
		private void preview_TabbedThumbnailActivated(object sender, TabbedThumbnailEventArgs e)
		{
			foreach (TitleBarTab tab in Tabs.Where(tab => tab.Content.Handle == e.WindowHandle))
			{
				SelectedTabIndex = Tabs.IndexOf(tab);
				TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tab.Content);

				break;
			}

			// Restore the window if it was minimized
			if (WindowState == FormWindowState.Minimized)
				User32.ShowWindow(Handle, 3);

			else
				Focus();
		}
예제 #15
0
        void preview_TabbedThumbnailClosed(object sender, TabbedThumbnailEventArgs e)
        {
            TabPage pageClosed = null;

            // Find the tabpage that was "closed" by the user (via the taskbar tabbed thumbnail)
            foreach (TabPage page in tabControl1.TabPages)
            {
                if (page.Handle == e.WindowHandle)
                {
                    pageClosed = page;
                    break;
                }
            }

            if (pageClosed != null)
            {
                // Remove the event handlers
                WebBrowser wb = pageClosed.Controls[0] as WebBrowser;

                if (wb != null)
                {
                    wb.DocumentTitleChanged -= new EventHandler(wb_DocumentTitleChanged);
                    //wb.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
                    wb.Navigated -= new WebBrowserNavigatedEventHandler(wb_Navigated);
                    wb.ProgressChanged -= new WebBrowserProgressChangedEventHandler(wb_ProgressChanged);
                    wb.Document.Window.Scroll -= new HtmlElementEventHandler(Window_Scroll);

                    wb.Dispose();
                }
                else
                {
                    // It's most likely a RichTextBox.

                    RichTextBox rtbText = pageClosed.Controls[0] as RichTextBox;

                    if (rtbText != null)
                    {
                        rtbText.KeyDown -= new KeyEventHandler(rtbText_KeyDown);
                        rtbText.MouseMove -= new MouseEventHandler(rtbText_MouseMove);
                        rtbText.KeyUp -= new KeyEventHandler(rtbText_KeyUp);
                    }

                    rtbText.Dispose();
                }

                // Finally, remove the tab from our UI
                if (pageClosed != null)
                    tabControl1.TabPages.Remove(pageClosed);

                // Dispose the tab
                pageClosed.Dispose();

                if (tabControl1.TabPages.Count > 0)
                    button2.Enabled = true;
                else
                    button2.Enabled = false;
            }

            // Remove the event handlers from the tab preview
            e.TabbedThumbnail.TabbedThumbnailActivated -= new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailActivated);
            e.TabbedThumbnail.TabbedThumbnailClosed -= new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailClosed);
            e.TabbedThumbnail.TabbedThumbnailMaximized -= new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailMaximized);
            e.TabbedThumbnail.TabbedThumbnailMinimized -= new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailMinimized);    
        }