private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            taskPaneControl1 = new OutlookConnectorPane();
            IConnectorMainView connectorExplorer = ((System.Windows.Forms.Integration.ElementHost)taskPaneControl1.Controls[0]).Child as IConnectorMainView;

            ApplicationContext.SetApplicationManager(new OutlookConnectorManager(this.Application, connectorExplorer));

            ApplicationContext.Current.ConnectorExplorer.InitializedDate = new DateTime(DateTime.Now.Ticks);
            taskPaneValue = this.CustomTaskPanes.Add(taskPaneControl1, "Sobiens Office Connector");
            taskPaneValue.VisibleChanged      += new EventHandler(taskPaneValue_VisibleChanged);
            taskPaneValue.DockPositionChanged += new EventHandler(taskPaneValue_DockPositionChanged);
            taskPaneControl1.SizeChanged      += new EventHandler(taskPaneControl1_SizeChanged);
            taskPaneControl1.Resize           += new EventHandler(taskPaneControl1_Resize);

            ApplicationBaseState applicationState = StateManager.GetInstance().ConnectorState.GetApplicationState(ApplicationContext.Current.GetApplicationType());

            taskPaneValue.DockPosition = StateManager.GetInstance().GetMsoPaneDockPosition(applicationState.DockPosition);
            taskPaneControl1.Width     = applicationState.ConnectorWidth;
            taskPaneControl1.Height    = applicationState.ConnectorHeight;
            taskPaneValue.Visible      = applicationState.ConnectorOpen;

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(inspectors_NewInspector);

            //this.Application.Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            //SetSPOCButton();

            foreach (Outlook.Inspector inspector in inspectors)
            {
                inspectors_NewInspector(inspector);
            }

            ConfigurationManager.GetInstance().DownloadAdministrationXml(RefreshControls);
        }
Example #2
0
 private void ThisAddIn_Shutdown(object sender, EventArgs e)
 {
     _inspectors.NewInspector -=
         Inspectors_NewInspector;
     _inspectors             = null;
     _inspectorWrappersValue = null;
 }
	    private void OutlookGnuPG_Startup(object sender, EventArgs e)
	    {
			_singletonInstance = this;

			_settings = new Properties.Settings();

			_wrappedObjects = new Dictionary<Guid, object>();

			// Initialize command bar.
			// Must be saved/closed in Explorer MyClose event.
			// See http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/df53276b-6b44-448f-be86-7dd46c3786c7/
			AddGnuPGCommandBar(this.Application.ActiveExplorer());

			// Register an event for ItemSend
			Application.ItemSend += Application_ItemSend;

			// Initialize the outlook explorers
			_explorers = Application.Explorers;
			_explorers.NewExplorer += OutlookGnuPG_NewExplorer;
			for (var i = _explorers.Count; i >= 1; i--)
			{
				WrapExplorer(_explorers[i]);
			}

			// Initialize the outlook inspectors
			_inspectors = Application.Inspectors;
			_inspectors.NewInspector += OutlookGnuPG_NewInspector;
		}
Example #4
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     OutlookApplication = Application as Outlook.Application;
     OutlookInspectors = OutlookApplication.Inspectors;
     OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
     OutlookApplication.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);
 }
Example #5
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // This method is called by Outlook for the add-in to initialise, so we need to hook into events here
            _application              = Globals.ThisAddIn.Application;
            _wrappedExplorers         = new Dictionary <Guid, ExplorerWrapper>();
            _wrappedInspectors        = new Dictionary <Guid, InspectorWrapper>();
            _inspectors               = _application.Inspectors;
            _inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(WrapInspector);

            // Wrap any existing Explorers
            foreach (Outlook.Explorer explorer in _application.Explorers)
            {
                WrapExplorer(explorer);
            }

            // Wrap any existing Inspectors
            foreach (Outlook.Inspector inspector in _inspectors)
            {
                WrapInspector(inspector);
            }

            _trackedMailItems = new List <Outlook.MailItem>();
            //HookActiveExplorer();

            _mailItems             = new Dictionary <Guid, MailItemEventWrapper>();
            _application.ItemLoad += new Outlook.ApplicationEvents_11_ItemLoadEventHandler(_application_ItemLoad);
            EventTrackerForm       = new FormEventTracker();
            EventTrackerForm.Show();
        }
Example #6
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            ((Outlook.ApplicationEvents_Event)this.Application).ItemSend += ThisAddIn_ItemSend;
        }
        public OutlookUIManager(RlOutlook.Application application, OutlookAddin addin, string progid) : base(progid)
        {
            this.addin       = addin;
            this.application = application;
            explorers        = application.Explorers;
            inspectors       = application.Inspectors;

            inspectorCache = new ArrayList();
            explorerCache  = new ArrayList();

            inspectorToolbars = new Toolbars(this);
            explorerToolbars  = new Toolbars(this);

            BindEvents();

            foreach (RlOutlook.Inspector inspector in inspectors)
            {
                OnInspectorOpen(new OutlookInspector(inspector));
            }

            foreach (RlOutlook.Explorer explorer in explorers)
            {
                OnExplorerOpen(new OutlookExplorer(explorer));
            }
        }
Example #8
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Get the Application object
            Outlook.Application application = this.Application;

            // Get the Inspectors objects
            Outlook.Inspectors inspectors = application.Inspectors;

            // Get the active Inspector
            Outlook.Inspector activeInspector = application.ActiveInspector();

            // Get the Explorers objects
            Outlook.Explorers explorers = application.Explorers;

            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_AddTextToNewMail);

            // Subscribe to the ItemSend event, that it's triggered when an email is sent
            application.ItemSend +=
                new Outlook.ApplicationEvents_11_ItemSendEventHandler(
                    ItemSend_BeforeSend);

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_RegisterEventWordDocument);
        }
        private void TravelyseAddIn_Startup(object sender, System.EventArgs e)
        {
            UserControl2 ucTest = new UserControl2();

            ctpTravelyse = this.CustomTaskPanes.Add(ucTest, "Test");

            //ucPlanTravel = new ucPlanTravel();
            //ctpTravelyse = this.CustomTaskPanes.Add(ucPlanTravel, "Travelyse");

            ctpTravelyse.Visible = true;

            ctpTravelyse.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
            //myCustomTaskPane.Height = 500;
            ctpTravelyse.Width = 400;

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            foreach (Outlook.Inspector inspector in inspectors)
            {
                Inspectors_NewInspector(inspector);
            }

            //inspectors = this.Application.Inspectors;
            //inspectors.NewInspector +=
            //new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
        }
 private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
 {
     // Dereference objects.
     m_Ribbon      = null;
     m_Inspectors  = null;
     m_Application = null;
 }
Example #11
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            InitLog();
            Logger.Info("Starting up...");

            UpdateFolderListAsync();

            interceptKeys = new InterceptKeys();
            interceptKeys.Attach();

            // Attach task panes to inspectors
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(NewInspector);
            foreach (Outlook.Inspector inspector in inspectors)
            {
                NewInspector(inspector);
            }

            // Attach task panes to explorers
            explorers              = this.Application.Explorers;
            explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(NewExplorer);
            foreach (Outlook.Explorer inspector in explorers)
            {
                NewExplorer(inspector);
            }
        }
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            // Initialize variables
            _application = Application;
            _explorers   = _application.Explorers;
            _inspectors  = _application.Inspectors;

            MessageProvider  = new MessageProvider();
            Windows          = new List <OutlookExplorer>();
            InspectorWindows = new List <OutlookInspector>();
            StorageProvider  = new StorageProvider();
            Authentication   = new OfficeAddInOAuth(MessageProvider);

            // Wire up event handlers to handle multiple Explorer windows
            _explorers.NewExplorer += OutlookEvent_Explorers_NewExplorer;

            // Wire up event handlers to handle multiple Inspector windows
            _inspectors.NewInspector += OutlookEvent__Inspectors_NewInspector;

            MessageProvider.ErrorOccurred += MessageProvider_OnErrorOccurred;

            // Add the ActiveExplorer to Windows
            var explorer = _application.ActiveExplorer();
            var window   = new OutlookExplorer(explorer);

            Windows.Add(window);

            // Hook up event handlers for window
            window.Close             += WrappedWindow_Close;
            window.InvalidateControl += WrappedWindow_InvalidateControl;
        }
Example #13
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Get the Inspector object
            inspectors = this.Application.Inspectors;

            // Get the active Inspector object
            activeInspector = this.Application.ActiveInspector();
            if (activeInspector != null)
            {
                // Get the title of the active item when the Outlook start.
                Debug.WriteLine("Active inspector: {0}", activeInspector.Caption);
            }

            // Get the Explorer objects
            explorers = this.Application.Explorers;

            // Get the active Explorer object
            activeExplorer = this.Application.ActiveExplorer();
            if (activeExplorer != null)
            {
                // Get the title of the active folder when the Outlook start.
                Debug.WriteLine("Active explorer: {0}", activeExplorer.Caption);
            }

            config.PropertyChanged += Config_PropertyChanged;
            if (config.AddInEnabled)
            {
                addComposingEventHandler();
            }
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            CreateMailItem();

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
        }
Example #15
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            ((Outlook.ApplicationEvents_Event) this.Application).ItemSend += ThisAddIn_ItemSend;
        }
Example #16
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Get the Application object
            Outlook.Application application = this.Application;
            // Get the Inspector object
            Outlook.Inspectors inspectors = application.Inspectors;
            // Get the active Inspector object
            Outlook.Inspector activeInspector = application.ActiveInspector();
            if (activeInspector != null)
            {
                // Get the title of the active item when the Outlook start.
                MessageBox.Show("Active inspector: " + activeInspector.Caption);
            }

            // ...
            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_AddTextToNewMail);


            // Get the Explorer objects
            Outlook.Explorers explorers = application.Explorers;
            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();
            if (activeExplorer != null)
            {
                // Get the title of the active folder when the Outlook start.
                MessageBox.Show("Active explorer: " + activeExplorer.Caption);
            }
        }
Example #17
0
        //void OutlookApplication_ItemSends(object Item, ref bool Cancel)
        //{
        //    //string strchkTo = OutlookMailItem.To;
        //    //string strchk = "hello Welcome to c#";
        //    //MessageBox.Show(strchk + "\r\n" + strchkTo);
        //}

        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            OutlookApplication              = Application as Outlook.Application;
            OutlookInspectors               = OutlookApplication.Inspectors;
            OutlookInspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
            OutlookApplication.ItemSend    += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);
            //OutlookApplication.ItemSend += new Outlook.ApplicationEvents_ItemSendEventHandler(OutlookApplication_ItemSend);

            //Outlook.Inspectors inspectors;
            //inspectors = this.Application.Inspectors;
            //inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            AddMenuBar();
            RemoveMenubar();


            // Disable Ribbon
            //Type type = typeof(MailRead);
            //MailRead ribbon = Globals.Ribbons.GetRibbon(type) as MailRead;
            //ribbon.ReadEmail.Enabled = false;

            // Visible false Ribbon
            //Type type = typeof(MailRead);
            //MailRead ribbon = Globals.Ribbons.GetRibbon(type) as MailRead;
            //ribbon.ReadEmail.Visible = false;
        }
Example #18
0
 private void ThisAddIn_Shutdown(object sender, EventArgs e)
 {
     // Note: Outlook no longer raises this event. If you have code that
     //    must run when Outlook shuts down, see http://go.microsoft.com/fwlink/?LinkId=506785
     inspectors.NewInspector -= Inspectors_NewInspector;
     inspectors        = null;
     InspectorWrappers = null;
 }
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     //attach an event handler to the inspector
     //the 'Application' class represents the current instance of Outlook
     //'inspector' represents the inspector window of the new mail message
     inspectors = this.Application.Inspectors;
     inspectors.NewInspector += Inspectors_NewInspector;
 }
Example #20
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     LoggerProvider.Instance.Logger.Debug("******\r\n\t\tProgram start");
     inspectors.NewInspector           += new Outlook.InspectorsEvents_NewInspectorEventHandler(inspectors_NewInspector);
     OutlookProvider.Instance.NameSpace = this.Application.Session;
     //GoogleProvider.GetProvider.Logon(SettingsProvider.Instance.UserName, SettingsProvider.Instance.UserPassword);
 }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            _Explorers  = this.Application.Explorers;
            _Inspectors = this.Application.Inspectors;
            _Namespace  = this.Application.GetNamespace("MAPI");

            _Explorers.Application.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(Application_NewMailEx);
        }
Example #22
0
 private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
 {
     inspectors.NewInspector -=
         new Outlook.InspectorsEvents_NewInspectorEventHandler(
             Inspectors_NewInspector);
     inspectors             = null;
     inspectorWrappersValue = null;
 }
Example #23
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // In order periodically poll all open editors, we need a timer.
            // In order to have a timer, it needs to spawn its own thread.
            // In order to be useful, the new thread needs to create new UI objects
            // In order to create new UI objects, you must be in the main UI thread
            // In order to do things in the main UI thread from the timer thread, we need a synchonization object.
            // In order to have a synchronization object, you have to create a Form.

            // Thus, we create this form we don't want and do our best to hide it, so we can do something completely unrelated.
            // That's how microsoft set up how it works, and somehow thought it was good.

            //dummyForm = new System.Windows.Forms.Form();
            //dummyForm.Opacity = 0;
            //dummyForm.Show();
            //dummyForm.Visible = false;

            //mainThread = SynchronizationContext.Current;

            // Store handles to window collections, because otherwise C# stupidty abounds
            _inspectors = Application.Inspectors;
            _explorers  = Application.Explorers;

            //while (Application.ActiveWindow() == null)
            //{
            //    await Task.Delay(1000);
            //}

            //editorWrapperCollection.Add(Application.ActiveWindow(), new editorWrapper(Application.ActiveWindow()));

            //// If somehow plugin is loading after windows are already open, find them all and bag 'n tag
            foreach (Outlook.Inspector inspector in _inspectors)
            {
                newInspector(inspector);
            }
            foreach (Outlook.Explorer explorer in _explorers)
            {
                newExplorer(explorer);
            }

            // Register new callbacks to catch new editors opening
            _inspectors.NewInspector += (s) => { newInspector(s); };
            _explorers.NewExplorer   += (s) => { newExplorer(s); };

            ((Outlook.ApplicationEvents_11_Event)Application).Quit += new Outlook.ApplicationEvents_11_QuitEventHandler(ThisAddIn_Shutdown);

            // Clean/setup secure temporary attachments folder.
            if (Directory.Exists(secureTempPath))
            {
                Directory.Delete(secureTempPath + "/*", true);
                secureFolder = new DirectoryInfo(secureTempPath);
            }
            else
            {
                secureFolder = Directory.CreateDirectory(secureTempPath);
            }
        }
Example #24
0
 private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
 {
     // do the homework and cleanup
     _wrappedInspectors.Clear();
     _inspectors.NewInspector -= new Outlook.InspectorsEvents_NewInspectorEventHandler(WrapInspector);
     _inspectors = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Example #25
0
        //gavdcodebegin 01
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Outlook.Application myApplication = this.Application;
            Outlook.Inspectors  myInspectors  = myApplication.Inspectors;

            myInspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_AddTextToNewMail);
        }
Example #26
0
        private void TravelyseAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // Note: Outlook no longer raises this event. If you have code that
            //    must run when Outlook shuts down, see https://go.microsoft.com/fwlink/?LinkId=506785

            inspectors.NewInspector -= new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            inspectors             = null;
            inspectorWrappersValue = null;
        }
Example #27
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            api = new GoogleCalendarAPI();

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector +=
                new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            folder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            /*while (!Debugger.IsAttached)
             * {
             *      System.Threading.Thread.Sleep(1000);
             * }
             *
             * Debugger.Break();*/

            // Get the Application object
            Outlook.Application application = this.Application;

            // Get the Inspectors objects
            Outlook.Inspectors inspectors = application.Inspectors;

            // Get the active Inspector
            Outlook.Inspector activeInspector = application.ActiveInspector();
            if (activeInspector != null)
            {
                // Get the active item's title when Outlook start
                MessageBox.Show("Active Inspector: " + activeInspector.Caption);
            }

            // Get the Explorers objects
            Outlook.Explorers explorers = application.Explorers;

            // Get the active Explorer object
            Outlook.Explorer activeExplorer = application.ActiveExplorer();
            if (activeExplorer != null)
            {
                // Get the active folder's title when Outlook start
                // MessageBox.Show("Active Explorer: " + activeExplorer.Caption);
            }

            AddHandlerToStores();

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_AddTextToNewMail);

            // Subscribe to the ItemSend event, that it's triggered when an email is sent
            application.ItemSend +=
                new Outlook.ApplicationEvents_11_ItemSendEventHandler(
                    ItemSend_BeforeSend);

            application.ItemLoad += this.ItemLoadHandler;

            application.NewMail   += this.NewMailHandler;
            application.NewMailEx += this.NewMailExHandler;

            // Add a new Inspector to the application
            inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    Inspectors_RegisterEventWordDocument);
        }
Example #29
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            this.MyMenuBar();
            this.MyToolBar();

            Inspectors = this.Application.Inspectors;
            Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(AddToEmail);
            Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(AddToTask);
            Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(AddToNotes);
        }
Example #30
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     OutlookInspectors               = this.Application.Inspectors;
     OutlookApplication              = this.Application.Application;
     OutlookInspectors.NewInspector +=
         new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
     OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
     OutlookApplication.ItemSend    += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);
     //searchSentMailUsingTable();
 }
Example #31
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            myUserControl1 = new UserControl1();
            myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
            myCustomTaskPane.Visible = true;

            inspectors = this.Application.Inspectors;
            inspectors.NewInspector +=
            new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
        }
Example #32
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            currentExplorer = this.Application.ActiveExplorer();
            currentExplorer.SelectionChange += new Outlook
                                               .ExplorerEvents_10_SelectionChangeEventHandler
                                                   (CurrentExplorer_Event);
        }
Example #33
0
        private void ReleaseInspectors()
        {
            if (inspectors != null)
            {
                ((Outlook.InspectorsEvents_Event)inspectors).NewInspector -= ThisAddIn_NewInspector;

                Marshal.ReleaseComObject(inspectors);
                inspectors = null;
            }
        }
Example #34
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Initialize variables.
            m_Application = this.Application;
            m_Explorers = m_Application.Explorers;
            m_Inspectors = m_Application.Inspectors;
            m_Windows = new List<OutlookExplorer>();
            m_InspectorWindows = new List<OutlookInspector>();

            // Wire up event handlers to handle multiple Explorer windows.
            m_Explorers.NewExplorer +=
                new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer);
            // Wire up event handler to handle multiple Inspector windows.
            m_Inspectors.NewInspector +=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(m_Inspectors_NewInspector);
            // Add the ActiveExplorer to m_Windows.
            Outlook.Explorer expl = m_Application.ActiveExplorer()
                as Outlook.Explorer;
            OutlookExplorer window = new OutlookExplorer(expl);
            m_Windows.Add(window);
            // Hook up event handlers for window.
            window.Close += new EventHandler(WrappedWindow_Close);
            window.InvalidateControl += new EventHandler<OutlookExplorer.InvalidateEventArgs>(WrappedWindow_InvalidateControl);

            // Get IPictureDisp for CurrentUser on startup.
            try
            {
                Outlook.AddressEntry addrEntry =
                    Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry;
                if (addrEntry.Type == "EX")
                {
                    Outlook.ExchangeUser exchUser =
                        addrEntry.GetExchangeUser() as Outlook.ExchangeUser;
                    m_pictdisp = exchUser.GetPicture() as stdole.IPictureDisp;
                }
            }
            catch (Exception ex)
            {
                // Write exception to debug window.
                Debug.WriteLine(ex.Message);
            }
        }
Example #35
0
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // Shutdown code here
            // Unhook event handlers
            m_Explorers.NewExplorer -=
                new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer);
            m_Inspectors.NewInspector -=
                new Outlook.InspectorsEvents_NewInspectorEventHandler(m_Inspectors_NewInspector);

            // Dereference objects
            m_pictdisp = null;
            m_Explorers = null;
            m_Inspectors = null;
            m_Windows.Clear();
            m_Windows = null;
            m_InspectorWindows.Clear();
            m_InspectorWindows = null;
            m_Ribbon = null;
            m_Application = null;
        }
Example #36
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(AddButtonToEmailWindow);
     inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(GetMessageDetails);
 }
Example #37
0
        private void Plugin_Startup(object sender, System.EventArgs e)
        {
            Logging.PowerFolderLogProfile.initLogProfile();

            OutlookApplication = this.Application as Outlook.Application;
            OutlookInspectors = OutlookApplication.Inspectors;

            OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
            OutlookApplication.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);

            Mail.OutboxDirectoryManager.Get(OutlookApplication).SendEmails();

            Update.Updater updater = new Update.Updater();
            updater.CheckForUpdate();
        }
Example #38
0
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // 참고: Outlook은 더 이상 이 이벤트를 발생시키지 않습니다. Outlook이 종료될 때 
            //    실행해야 하는 코드가 있으면 웹 사이트(http://go.microsoft.com/fwlink/?LinkId=506785)를 참조하세요.

            #region 추가한 창의 정보와 inspectors를 초기화
            inspectors.NewInspector -= new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            inspectors = null;
            inspectorWrappersValue = null;
            #endregion
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // VSTO Runtime Update to Address Slow Shutdown and “Unknown Publisher” for SHA256 Certificate
            // http://softwareblog.morlok.net/2014/12/03/unknown-publisher-when-installing-clickonce-vsto-outlook-plugin-signed-with-sha256-certificate/
            // http://blogs.msdn.com/b/vsto/archive/2014/04/10/vsto-runtime-update-to-address-slow-shutdown-and-unknown-publisher-for-sha256-certificates.aspx
            // http://stackoverflow.com/questions/11540520/how-to-get-installshield-le-to-uninstall-the-existing-installation-automatically
            // http://stackoverflow.com/questions/6447404/configuring-installshield-le-to-remove-previous-versions-built-using-visual-stud

            outlookApp = Application;

            _inspectors = Application.Inspectors;
            _inspectors.NewInspector += _inspectors_NewInspector;

            explorer = Application.ActiveExplorer();
            explorer.SelectionChange += explorer_SelectionChange;
        }
Example #40
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            _Explorers = this.Application.Explorers;
            _Inspectors = this.Application.Inspectors;
            _Namespace = this.Application.GetNamespace("MAPI");

            _Explorers.Application.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(Application_NewMailEx);
        }
        private void OutlookGnuPG_Startup(object sender, EventArgs e)
        {
            _settings = new Properties.Settings();

            _WrappedObjects = new Dictionary<Guid, object>();

            // Initialize command bar.
            // Must be saved/closed in Explorer MyClose event.
            // See http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/df53276b-6b44-448f-be86-7dd46c3786c7/
            AddGnuPGCommandBar(this.Application.ActiveExplorer());

            // Register an event for ItemSend
            Application.ItemSend += Application_ItemSend;

            // Initialize the outlook explorers
            _explorers = this.Application.Explorers;
            _explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(OutlookGnuPG_NewExplorer);
            for (int i = _explorers.Count; i >= 1; i--)
            {
                WrapExplorer(_explorers[i]);
            }

            // Initialize the outlook inspectors
            _inspectors = this.Application.Inspectors;
            _inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookGnuPG_NewInspector);
        }
        /// <summary>
        /// Shutdown the Add-In.
        /// Note: some closing statements must happen before this event, see OutlookGnuPG_ExplorerClose().
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OutlookGnuPG_Shutdown(object sender, EventArgs e)
        {
            // Unhook event handler
            _inspectors.NewInspector -= new Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookGnuPG_NewInspector);
            _explorers.NewExplorer -= new Outlook.ExplorersEvents_NewExplorerEventHandler(OutlookGnuPG_NewExplorer);

            _WrappedObjects.Clear();
            _WrappedObjects = null;
            _inspectors = null;
            _explorers = null;
        }
Example #43
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            mInspectors = this.Application.Inspectors;
            mInspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OnNewInspector);

            // TODO: sync RootContactsFolder and PIM
            foreach (Outlook.ContactItem item in RootContactsFolder.Items)
            {
                this.InitContact(item);
            }

            mWorker = new BackgroundWorker();
            mWorker.DoWork += new DoWorkEventHandler(WorkerPoll);
            mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnWorkerComplete);

            mTimer = new Timer();
            mTimer.Interval = 10000; // 10 seconds
            mTimer.Tick += new EventHandler(OnTick);
            mTimer.Start();

            mSyncContacts = false;
        }
Example #44
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     ContactsHelper.Application = this.Application;
     inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(inspectors_NewInspector);
 }
Example #45
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            System.Windows.Forms.Application.EnableVisualStyles();

            try
            {
                // 初始化 UI 元素集合,并挂钩
                // NewInspector 事件,以便在创建每个检查器时能够将检查器
                // 添加到集合。
                _uiElements = new UserInterfaceElements();
                _inspectors = this.Application.Inspectors;
                _inspectors.NewInspector +=
                    new Outlook.InspectorsEvents_NewInspectorEventHandler(
                    inspectors_NewInspector);
            }
            catch (COMException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Example #46
0
        // attaches an event handler for newInspector event
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Logger.Log("ThisAddIn Starting up");
            inspectors = this.Application.Inspectors; // current instance of office
            inspectors.NewInspector +=
            new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            // set up task pane
            _taskPane = this.CustomTaskPanes.Add(new UserControl1(), "Matt Test");
            _taskPane.Visible = true;
            Logger.Log("Task pane set up");
        }
        private void OutlookGnuPG_Startup(object sender, EventArgs e)
        {
            // NLOG

            //var nconfig = new LoggingConfiguration();
            //var consoleTarget = new FileTarget();
            //consoleTarget.FileName = "c:\\temp\\opp.txt";
            //nconfig.AddTarget("console", consoleTarget);
            //consoleTarget.Layout = "${logger} ${message}";

            //var rule = new LoggingRule("*", LogLevel.Trace, consoleTarget);
            //nconfig.LoggingRules.Add(rule);

            //LogManager.Configuration = nconfig;

            // NLOG END

            _settings = new Properties.Settings();

            _WrappedObjects = new Dictionary<Guid, object>();

            // Initialize command bar.
            // Must be saved/closed in Explorer MyClose event.
            // See http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/df53276b-6b44-448f-be86-7dd46c3786c7/
            AddGnuPGCommandBar(this.Application.ActiveExplorer());

            // Register an event for ItemSend
            Application.ItemSend += Application_ItemSend;

            // Initialize the outlook explorers
            _explorers = this.Application.Explorers;
            _explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(OutlookGnuPG_NewExplorer);
            for (int i = _explorers.Count; i >= 1; i--)
            {
                WrapExplorer(_explorers[i]);
            }

            // Initialize the outlook inspectors
            _inspectors = this.Application.Inspectors;
            _inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookGnuPG_NewInspector);
        }
Example #48
0
        private void Init()
        {
            const string pos = "ThisAddIn.Init - ";
            log = new Logger();

            log.Start();

            log.Info(pos + "INIT");

            AddKPCategory();

            attachmentName = Constants.KP_ATTACHMENT_NAME;
            attachmentPath = Constants.getWorkFolder();

            //Inizializzazione degli inspector
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            //Inizializzazione della cache
            cache = Cachemanager.instanceCachemanager();

            Ribbons = new Hashtable();
            MailItems = new Hashtable();
            RibbonsType = new Hashtable();

            //Inizializzazione della lista della lista delle cartelle da monitorare
            listItems = new List<Outlook.Items>();

            log.Info(pos + "END");
        }
Example #49
0
 private void ThisAddIn_Startup(object sender, EventArgs e)
 {
     _inspectors = Application.Inspectors;
     _inspectors.NewInspector += Inspectors_NewInspector;
 }
Example #50
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     markdownRibbon = Globals.Ribbons.GetRibbon<MarkdownRibbon>();
     inspectors = this.Application.Inspectors;
     this.Application.ItemSend += Application_ItemSend;
 }
Example #51
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            inspectors = this.Application.Inspectors;
            inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            foreach (Outlook.Inspector inspector in inspectors)
            {
                Inspectors_NewInspector(inspector);
            }
        }
Example #52
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     //inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
     inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(AddToEmail);
 }
		private void OutlookGnuPG_Startup(object sender, EventArgs e)
		{
			_settings = new Properties.Settings();
			_wrappedObjects = new Dictionary<Guid, object>();

			// Log all debug/trace messages to a file for debugging purposes
			if(_settings.DebugTrace)
			{
				var logFile = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "OutlookPrivacyPlugin");

				if (!Directory.Exists(logFile))
					Directory.CreateDirectory(logFile);

				logFile = Path.Combine(logFile, "trace.txt");

				var nconfig = new LoggingConfiguration();
				var consoleTarget = new FileTarget() { FileName = logFile, Layout = "${logger} ${message}" };
				nconfig.AddTarget("console", consoleTarget);
				nconfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget));

				LogManager.Configuration = nconfig;
			}

			// Initialize command bar.
			// Must be saved/closed in Explorer MyClose event.
			// See http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/df53276b-6b44-448f-be86-7dd46c3786c7/
			//AddGnuPGCommandBar(this.Application.ActiveExplorer());

			// Register an event for ItemSend
			Application.ItemSend += Application_ItemSend;

			// Initialize the outlook inspectors
			_inspectors = Application.Inspectors;
			_inspectors.NewInspector += OutlookGnuPG_NewInspector;

			// Check for new version
			if (_settings.CheckVersion)
			{
				Task.Factory.StartNew(() =>
				{
					var client = new WebClient();
					var json =
						Encoding.UTF8.GetString(client.DownloadData(@"http://dejavusecurity.github.io/OutlookPrivacyPlugin/latest.json"));
					dynamic latest = JsonConvert.DeserializeObject(json);
					var latestVersion = latest.version.Value;

					var currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
					if (latestVersion == currentVersion)
						return;

					// Check if we have already notified about this version
					var lastVersionCheck = string.Empty;
					var key = Registry.CurrentUser.OpenSubKey(@"Software\OutlookPrivacyPlugin",
						RegistryKeyPermissionCheck.ReadWriteSubTree);
					if (key != null)
						lastVersionCheck = (string) key.GetValue("LastVersionCheck");
					else
						key = Registry.CurrentUser.CreateSubKey(@"Software\OutlookPrivacyPlugin",
							RegistryKeyPermissionCheck.ReadWriteSubTree);

					if (lastVersionCheck == latestVersion)
						return;

					key.SetValue("LastVersionCheck", latestVersion);

					MessageBox.Show(Localized.NewVersionAvailable, Localized.DialogTitle,
						MessageBoxButtons.OK, MessageBoxIcon.Information);
				});
			}
		}
Example #54
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     
     inspectors.NewInspector += Inspectors_NewInspector;
 }
		/// <summary>
		/// Shutdown the Add-In.
		/// Note: some closing statements must happen before this event, see OutlookGnuPG_ExplorerClose().
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OutlookGnuPG_Shutdown(object sender, EventArgs e)
		{
			// Unhook event handler
			_inspectors.NewInspector -= OutlookGnuPG_NewInspector;

			_wrappedObjects.Clear();
			_wrappedObjects = null;
			_inspectors = null;
		}