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;
		}
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
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);
            }
        }
        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));
            }
        }
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     selectExplorers              = this.Application.Explorers;
     selectExplorers.NewExplorer += new Outlook
                                    .ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);
     AddToolbar();
 }
Exemplo n.º 9
0
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            _explorers              = Application.Explorers;
            _explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(NewExplorerEventHandler);

            _activeExplorer = Application.ActiveExplorer();
            _activeExplorer.SelectionChange += new Outlook.ExplorerEvents_10_SelectionChangeEventHandler(ExplorerSelectionChange);
        }
Exemplo n.º 10
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            selectExplorers              = this.Application.Explorers;
            selectExplorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);

            contacts.APIKey = Properties.Settings.Default.APIKey;
            AddToolbar();
        }
        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);
        }
Exemplo n.º 12
0
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            _explorers = Application.Explorers;
            _explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(NewExplorerEventHandler);

            _activeExplorer = Application.ActiveExplorer();
            _activeExplorer.SelectionChange += new Outlook.ExplorerEvents_10_SelectionChangeEventHandler(ExplorerSelectionChange);
        }
Exemplo n.º 13
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);
            }
        }
        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);
        }
Exemplo n.º 15
0
        private void ReleaseExplorers()
        {
            if (explorers != null)
            {
                ((Outlook.ExplorersEvents_Event)explorers).NewExplorer -= ThisAddIn_NewExplorer;

                Marshal.ReleaseComObject(explorers);
                explorers = null;
            }
        }
		/// <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;
			_explorers.NewExplorer -= OutlookGnuPG_NewExplorer;

			_wrappedObjects.Clear();
			_wrappedObjects = null;
			_inspectors = null;
			_explorers = null;
		}
Exemplo n.º 17
0
    /// <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;
    }
Exemplo n.º 18
0
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
      // tell the engine what the folders are.
      TheEngine.SetFolders(new Folders(Application.Session.DefaultStore.GetRootFolder()));

      // get the explorers.
      _explorers = this.Application.Explorers;

      // new email arrives.
      Application.NewMailEx += Application_NewMailEx;
    }
Exemplo n.º 19
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            WriteToLog("ThisAddIn_Startup");

            explorers              = Application.Explorers;
            explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);
            foreach (Outlook.Explorer explorer in explorers)
            {
                explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange);
                listExplorers.Add(explorer);
            }
        }
Exemplo n.º 20
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            selectExplorers              = this.Application.Explorers;
            selectExplorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);

            Banckle.Auth ath = new Banckle.Auth();
            ath.APIKey = Properties.Settings.Default.APIKey;

            contacts.APIKey = Properties.Settings.Default.APIKey;
            contacts.Token  = ath.getToken(Properties.Settings.Default.Id, Properties.Settings.Default.Password);

            AddToolbar();
        }
Exemplo n.º 21
0
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            UIDispatcher = Dispatcher.CurrentDispatcher;
            AppInfo      = OutlookUtils.GetAppInfo();

            explorers  = Application.Explorers;
            inspectors = Application.Inspectors;

            new ExplorerWrapper(Application.ActiveExplorer());

            ((Outlook.ApplicationEvents_11_Event)Application).Quit    += ThisAddIn_Quit;
            ((Outlook.ExplorersEvents_Event)explorers).NewExplorer    += ThisAddIn_NewExplorer;
            ((Outlook.InspectorsEvents_Event)inspectors).NewInspector += ThisAddIn_NewInspector;
        }
Exemplo n.º 22
0
        /// <summary>
        /// This method is called when our add-in gets loaded into Outlook.
        /// </summary>
        /// <param name="sender">The sender is the Outlook instance.</param>
        /// <param name="e">No usefull parameters.</param>
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // initialize the List that will keep an eye on our active Outlook Explorers.
            _WrappedExplorers = new Hashtable(10);

            // Do we have already some explorers after startup ?
            _Explorers = Application.Explorers;
            for (int i = _Explorers.Count; i >= 1; i--)
            {
                // Wrap the Explorer and do some usefull with it
                WrapExplorer(_Explorers[i]);
            }

            // get notified of new opened Explorers
            _Explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);
        }
        public override void Dispose()
        {
            base.Dispose();
            if (application != null)
            {
                UnbindEvents();
#if (COMRELEASE)
                System.Runtime.InteropServices.Marshal.ReleaseComObject(inspectors);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(explorers);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(application);
#endif
                inspectors  = null;
                explorers   = null;
                application = null;
            }
        }
        /// <summary>
        /// This method is called when our add-in gets loaded into Outlook.
        /// </summary>
        /// <param name="sender">The sender is the Outlook instance.</param>
        /// <param name="e">No usefull parameters.</param>
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // initialize the List that will keep an eye on our active Outlook Explorers.
            _WrappedExplorers = new Hashtable(10);

            // Do we have already some explorers after startup ?
            _Explorers = Application.Explorers;
            for (int i = _Explorers.Count; i >= 1; i--)
            {
                // Wrap the Explorer and do some usefull with it
                WrapExplorer(_Explorers[i]);
            }

            // get notified of new opened Explorers
            _Explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);
        }
Exemplo n.º 25
0
        private void ThisAddIn_Shutdown(object sender, EventArgs e)
        {
            // Unhook event handlers
            _explorers.NewExplorer   -= OutlookEvent_Explorers_NewExplorer;
            _inspectors.NewInspector -= OutlookEvent__Inspectors_NewInspector;

            // Dereference objects
            _explorers  = null;
            _inspectors = null;
            Windows.Clear();
            Windows = null;
            InspectorWindows.Clear();
            InspectorWindows = null;
            Ribbon           = null;
            _application     = null;
        }
Exemplo n.º 26
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 handlers 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);
            }
        }
Exemplo n.º 27
0
    private void OutlookGnuPG_Startup(object sender, EventArgs e)
    {
      _settings = new Properties.Settings();

      if (string.IsNullOrEmpty(_settings.GnuPgPath))
      {
        _gnuPg = new GnuPG();
        Settings(); // Prompt for GnuPG Path
      }
      else
      {
        _gnuPg = new GnuPG(null, _settings.GnuPgPath);
        if (!_gnuPg.BinaryExists())
        {
          _settings.GnuPgPath = string.Empty;
          Settings(); // Prompt for GnuPG Path
        }
      }
      _gnuPg.OutputType = OutputTypes.AsciiArmor;

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

      // Initialize command bar.
      // Must be saved/closed in Explorer Close 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;
#if VSTO2008
      ((ApplicationEvents_11_Event)Application).Quit += OutlookGnuPG_Quit;
#endif

      // 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);
    }
Exemplo n.º 28
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);
            }
        }
Exemplo n.º 29
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;
        }
Exemplo n.º 30
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            WriteToLog("ThisAddIn_Startup");

            Application.Explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);

            #if TEST_ACTIVE_EXPLORER
            explorer = Application.ActiveExplorer();
            explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange);
            #else
            explorers = Application.Explorers;
            WriteToLog(string.Format("explorers.Count={0}", explorers.Count));
            foreach (Outlook.Explorer explorer in explorers)
            {
                explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange);
            }
            #endif

            Application.ItemLoad += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemLoadEventHandler(Application_ItemLoad);
        }
Exemplo n.º 31
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;
        }
        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);
        }
Exemplo n.º 33
0
        /// <summary>
        ///      Implements the OnStartupComplete method of the IDTExtensibility2 interface.
        ///      Receives notification that the host application has completed loading.
        /// </summary>
        /// <param term='custom'>
        ///      Array of parameters that are host application specific.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnStartupComplete(ref System.Array custom)
        {
            // This method is called after the host application has completed loading. At this point, all host resources are available for use
              // by the Add-in. This is an ideal place to construct the UI of your Add-in types, as you can safely obtain the set of Explorers and Inspectors.

              m_Explorers = m_OutlookAppObj.Explorers;
              m_Windows = new List<OutlookExplorer>();

              // Wire up event handlers to handle multiple Explorer windows
              m_Explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer);

              // Add the ActiveExplorer to m_Windows
              Outlook.Explorer expl = m_OutlookAppObj.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);
        }
Exemplo n.º 34
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // Custom context menu item event managed
            this.Application.ItemContextMenuDisplay += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(MenuItem_ItemContextMenuDisplay);

            slxUserControl = new CustomTaskPane.SLX_UserControl();
            slxTaskPane = this.CustomTaskPanes.Add(slxUserControl, "SalesLogix");
            slxTaskPane.Visible = true;
            slxTaskPane.Width = 290;

            activeExplorer = this.Application.ActiveExplorer();

            activeExplorer.SelectionChange += new Outlook.ExplorerEvents_10_SelectionChangeEventHandler(activeExplorer_SelectionChange);

            selectExplorers = this.Application.Explorers;

            selectExplorers.NewExplorer += new Outlook
                .ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);

            AddToolbar();
        }
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     selectExplorers = this.Application.Explorers;
     selectExplorers.NewExplorer += new Outlook
         .ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);
     AddToolbar();
 }
        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;
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            selectExplorers = this.Application.Explorers;
            selectExplorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);

            Banckle.Auth ath = new Banckle.Auth();
            ath.APIKey = Properties.Settings.Default.APIKey;

            contacts.APIKey = Properties.Settings.Default.APIKey;
            contacts.Token = ath.getToken(Properties.Settings.Default.Id, Properties.Settings.Default.Password);

            AddToolbar();
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            selectExplorers = this.Application.Explorers;
            selectExplorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);

            contacts.APIKey = Properties.Settings.Default.APIKey;
            AddToolbar();
        }
Exemplo n.º 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 ThisAddIn_Startup(object sender, EventArgs e)
        {
            //Executive flag addin
            _outlookNameSpace = Application.GetNamespace("MAPI");
            _inbox = _outlookNameSpace.GetDefaultFolder(
                Outlook.OlDefaultFolders.olFolderInbox);

            //Generate contacts from email I have received from capSpire
            _contacts = _outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
            _items = _inbox.Items;
            _items.ItemAdd +=
                items_ItemAdd;
            AddContactsToItems();

            _selectExplorers = Application.Explorers;
            _selectExplorers.NewExplorer += newExplorer_Event;
            AddToolbar();
        }