Пример #1
0
        static void Layout_ElementRemoved(object sender, LayoutElementEventArgs e)
        {
            LayoutDocument layoutDoc   = e.Element as LayoutDocument;
            var            floating    = e.Element as LayoutDocumentFloatingWindow;
            var            layoutPanel = e.Element as LayoutDocumentPane;

            if (layoutDoc != null)
            {
                var frame = layoutDoc.Content as Frame;
                if (layoutDoc.ContentId == "CodeRemoval")
                {
                    if (TaskbarManager.Instance.TabbedThumbnail.IsThumbnailPreviewAdded(frame))
                    {
                        ThumbnailButtonsHelper.RemoveButtons(TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(frame));
                    }
                    //Tab closed from preview -> clean frame handlers
                    frame.ContentRendered -= frame_ContentRendered;
                    CloseTab(frame);
                    return;
                }
                if (frame != null)
                {
                    RemovePreview(frame);
                }
            }
            else if (floating != null)
            {
                return;
            }
            else if (layoutPanel != null)
            {
                return;
            }
        }
Пример #2
0
 private static void RemovePreview(UIElement content)
 {
     if (content != null)
     {
         if (TaskbarManager.Instance.TabbedThumbnail.IsThumbnailPreviewAdded(content))
         {
             //Clean it
             var preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(content);
             ((Frame)content).ContentRendered -= frame_ContentRendered;
             ThumbnailButtonsHelper.RemoveButtons(preview);
             TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(preview);
             preview.TabbedThumbnailActivated -= thumbnail_TabbedThumbnailActivated;
             preview.TabbedThumbnailClosed    -= thumbnail_TabbedThumbnailClosed;
             preview.TabbedThumbnailMaximized -= thumbnail_TabbedThumbnailMaximized;
             preview.TabbedThumbnailMinimized -= thumbnail_TabbedThumbnailMinimized;
             preview.Dispose();
             preview = null;
         }
     }
 }