Esempio n. 1
0
        public void SendReceive()
        {
            try
            {
                if (!OutlookSession.IsOutlookRun)
                {
                    OutlookGUIInit.StartOutlook(ProcessWindowStyle.Minimized);
                    if (!IsMainWndReady())
                    {
                        return;
                    }
                    OutlookGUIInit.ActivateGUI(_mainWnd);
                }
                _explorer = OutlookGUIInit.IsOutlookExplorerReady(cTimeOut);
                if (_explorer == null)
                {
                    StandartJobs.MessageBox(cErrorCOMInitialize, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ProcessDeliverNow( );
                ReleaseCOM();
            }
            catch (COMException exception)
            {
                _tracer.TraceException(exception);
            }
            catch (FileNotFoundException exception)
            {
                _tracer.TraceException(exception);
            }
            catch (InvalidComObjectException exception)
            {
                _tracer.TraceException(exception);
            }
            catch (InvalidCastException exception)
            {
                _tracer.TraceException(exception);
            }
        }
Esempio n. 2
0
        static public bool StartAndInitializeOutlook(  )
        {
            if (OutlookSession.IsOutlookRun)
            {
                return(true);
            }

            _com_OutlookExporer explorer = null;

            try
            {
                OutlookGUIInit.StartOutlook(ProcessWindowStyle.Minimized);
                IntPtr mainWnd = OutlookGUIInit.PrepareMainWndReady(2000);
                if ((int)mainWnd == 0)
                {
                    return(false);
                }
                ActivateGUI(mainWnd);
                return(IsOutlookExplorerReady(2000) != null);
            }
            catch (COMException exception)
            {
                Tracer._TraceException(exception);
                return(false);
            }
            finally
            {
                if (explorer != null)
                {
                    try
                    {
                        explorer.Release();
                    }
                    catch (COMException exception)
                    {
                        Tracer._TraceException(exception);
                    }
                }
            }
        }