コード例 #1
0
ファイル: OutlookGnuPG.cs プロジェクト: eabeles/OutlookGnuPG
        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);
        }
コード例 #2
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     inspectors = this.Application.Inspectors;
     inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
 }
コード例 #3
0
ファイル: OutlookGnuPG.cs プロジェクト: eabeles/OutlookGnuPG
        /// <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;
        }