Пример #1
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);
    }
Пример #2
0
        internal Settings(Properties.Settings settings)
        {
            InitializeComponent();

            AutoDecrypt  = settings.AutoDecrypt;
            AutoVerify   = settings.AutoVerify;
            AutoEncrypt  = settings.AutoEncrypt;
            AutoSign     = settings.AutoSign;
            Encrypt2Self = settings.Encrypt2Self;

            DefaultKey        = settings.DefaultKey;
            GnuPgPath         = settings.GnuPgPath;
            _originalExeWidth = GnuPgExe.Width;
            DefaultDomain     = settings.DefaultDomain;

            // Temporary disable all settings regarding auto-verify/decrypt
            // MainTabControl.TabPages.RemoveByKey(ReadTab.Name);
        }