public static void Create(System.Threading.SynchronizationContext scontext, Office.IRibbonUI ribbonUI)
        {
            scontext.Post((o) =>
            {
                var hwnd = BackStageTool.GetActiveWindowHwnd();
                if (hwnd != IntPtr.Zero)
                {
                    lock (dic)
                    {
                        CustomPrintBackstageWindow w;
                        if (!dic.TryGetValue(hwnd, out w))
                        {
                            w = new CustomPrintBackstageWindow();
                            w.AssignHandle(BackStageTool.GetActiveWindowHwnd());
                            w.scontext  = scontext;
                            w.ribbonUI  = ribbonUI;
                            w.inspector = Globals.ThisAddIn.Application.ActiveInspector() as Microsoft.Office.Interop.Outlook.Inspector;
                            w.mail      = w.inspector.CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;
                            if (w.mail != null)
                            {
                                w.Page.Html = w.mail.HTMLBody;
                            }

                            dic.Add(hwnd, w);
                        }
                    }
                }
            }, null);
        }
Example #2
0
        public void backstage_Hide(object context)
        {
            CustomPrintBackstageWindow.OnHide(context);

            var ins = context as Microsoft.Office.Interop.Outlook.Inspector;

            dicHTML.Remove(ins);
        }
Example #3
0
        public void onPrintCustom(Office.IRibbonControl control)
        {
            var wb = CustomPrintBackstageWindow.GetBackStageWindow(control.Context as Microsoft.Office.Interop.Outlook.Inspector);

            if (wb != null && wb.Page.CanPrint)
            {
                wb.Page.PrintPage();
            }
        }
Example #4
0
        public void backstage_Show(object context)
        {
            var scontext = System.Windows.Forms.WindowsFormsSynchronizationContext.Current;

            if (scontext == null)
            {
                scontext = new System.Windows.Forms.WindowsFormsSynchronizationContext();
                System.Windows.Forms.WindowsFormsSynchronizationContext.SetSynchronizationContext(scontext);
            }

            CustomPrintBackstageWindow.Create(scontext, this.ribbon);
        }
Example #5
0
 public System.Drawing.Bitmap getPreviewImage(Office.IRibbonControl control)
 {
     return(CustomPrintBackstageWindow.RequestBitmap(control));
 }