コード例 #1
0
        private async void ThisAddIn_Startup(object sender, EventArgs e)
        {
            try
            {
                // Sometimes outlook raises this event multiple times (seems to be a bug)
                if (ComponentContainer != null)
                {
                    return;
                }

                XmlConfigurator.Configure();
                s_logger.Info("Startup entered.");

                ComponentContainer = new ComponentContainer(Application);
                ComponentContainer.SynchronizationFailedWhileReportsFormWasNotVisible += ComponentContainer_SynchronizationFailedWhileReportsFormWasNotVisible;
                ComponentContainer.StatusChanged            += ComponentContainer_StatusChanged;
                ((ApplicationEvents_Event)Application).Quit += ThisAddIn_Quit;

                _explorers              = Application.Explorers;
                _explorers.NewExplorer += Explorers_NewExplorer;

                AddToolBarIfRequired();

                ComponentContainer.EnsureSynchronizationContext();

                s_logger.Info("Initializing component container.");
                await ComponentContainer.Initialize();

                s_logger.Info("Startup exiting.");
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }
コード例 #2
0
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            try
            {
                // Sometimes outlook raises this event multiple times (seems to be a bug)
                if (ComponentContainer != null)
                {
                    return;
                }

                XmlConfigurator.Configure();
                s_logger.Info("Startup entered.");

                ComponentContainer = new StartupComponentContainer();

                ((ApplicationEvents_Event)Application).Quit += ThisAddIn_Quit;
                _explorers              = Application.Explorers;
                _explorers.NewExplorer += Explorers_NewExplorer;
                AddToolBarIfRequired();

                _startupTimer          = new Timer();
                _startupTimer.Tick    += StartupTimer_Tick;
                _startupTimer.Interval = 2000;
                _startupTimer.Enabled  = true;

                s_logger.Info("Startup exiting.");
            }
            catch (Exception x)
            {
                ComponentContainer = new LoadErrorComponentContainer(x.ToString());
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }
コード例 #3
0
        //public TabblesRibbon Ribbon
        //{
        //    set
        //    {
        //        //value.TagEmailsWithTabbles += (sender, args) =>
        //        //{
        //        //    TagSelectedEmailsWithTabbles();
        //        //};
        //        //value.OpenEmailInTabbles += (sender, args) =>
        //        //{
        //        //    OpenSelectedEmailInTabbles();
        //        //};
        //        //value.TabblesSearch += (sender, args) =>
        //        //{
        //        //    TabblesSearch();
        //        //};
        //        //value.SyncWithTabbles += (sender, args) =>
        //        //{
        //        //    //RegistryManager.SetSyncPerformed(false);

        //        //    // SUJAYXML
        //        //    //xmlFileManager.SetSyncPerformed(false);

        //        //    if (StartSync != null)
        //        //    {
        //        //        StartSync();
        //        //    }
        //        //};
        //        //value.IsAnyEmailSelected += () =>
        //        //{
        //        //    return IsAnyEmailSelected(true);
        //        //};
        //    }
        //}

        public MenuManager(Application outlookApp)
        {
            this.outlookApp     = outlookApp;
            this.outlookVersion = Utils.ParseMajorVersion(outlookApp);
            this.outlookPrefix  = Utils.GetOutlookPrefix();

            this.explorerList = new List <Explorer>();
            //this.buttonList = new List<CommandBarButton>();

            //this.onceItemChanged = new HashSet<string>();

            InternallyChangedMailIds = new HashSet <string>();

            //culture info for localization
            int languageId = outlookApp.LanguageSettings.LanguageID[MsoAppLanguageID.msoLanguageIDUI];

            this.outlookCulture = new CultureInfo(languageId);
            Thread.CurrentThread.CurrentUICulture = this.outlookCulture;

            //CheckMenus();


            this.explorers              = this.outlookApp.Explorers;
            this.explorers.NewExplorer += OnNewExplorer;

            //FillItemsToListen();

            foreach (Explorer explorer in this.explorers)
            {
                AddExplorerListeners(explorer);
            }
        }
コード例 #4
0
ファイル: ThisAddIn.cs プロジェクト: ttzv/SafeAddress
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            this.safeDomains = new ArrayList(ConfigurationManager.AppSettings["safeDomains"].Split(','));
            ArrayList userSafeDomains = new ArrayList(Properties.Settings.Default.safeDomains.Split(','));

            this.safeDomains.AddRange(userSafeDomains);

            ctpWindowWrapper      = new CTP_InspectorWrapper();
            mailItemWindowWrapper = new MailItem_InspectorWrapper();

            explorers              = this.Application.Explorers;
            explorers.NewExplorer += Explorers_NewExplorer;

            Explorer currentExplorer = this.Application.ActiveExplorer();

            currentExplorer.InlineResponse      += CurrentExplorer_InlineResponse;
            currentExplorer.InlineResponseClose += CurrentExplorer_InlineResponseClose;
            ExplorerEvents_10_Event explorerEvents = currentExplorer;

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

            this._explorersCount      = this.explorers.Count;
            this.inlineResponseActive = false;
            this.anyInspectorActive   = false;

            Application.ItemSend += Application_ItemSend;
        }
コード例 #5
0
        private void MeetingInfoMain_Startup(object sender, System.EventArgs e)
        {
            ci = new CultureInfo(setting.Language);

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

            Explorers_NewExplorer(this.Application.ActiveExplorer());
            explorers              = this.Application.Explorers;
            explorers.NewExplorer +=
                new ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);

            labels = new Dictionary <int, ElementWrapper>()
            {
                { 0, _ribbon.Label1 },
                { 1, _ribbon.Label2 },
                { 2, _ribbon.Label3 },
                { 3, _ribbon.Label4 },
                { 4, _ribbon.DirectAccept },
            };

            DPrint("Assembly full name:\n   " + typeof(MeetingInfoMain).Assembly.FullName, 2);
            DPrint("Assembly qualified name:\n   " + typeof(MeetingInfoMain).AssemblyQualifiedName, 2);
        }
コード例 #6
0
 public void Dispose()
 {
     explorers.NewExplorer -= NewExplorer;
     inspectors.NewInspector -= NewInspector;
     explorers.ReleaseComObject();
     inspectors.ReleaseComObject();
     explorers = null;
     inspectors = null;
 }
コード例 #7
0
 public void Dispose()
 {
     explorers.NewExplorer   -= NewExplorer;
     inspectors.NewInspector -= NewInspector;
     explorers.ReleaseComObject();
     inspectors.ReleaseComObject();
     explorers  = null;
     inspectors = null;
 }
コード例 #8
0
        private void ThisAddIn_Shutdown(object sender, EventArgs e)
        {
            inspectors.NewInspector -= NewInspector;
            inspectors        = null;
            InspectorWrappers = null;

            explorers.NewExplorer -= NewExplorer;
            explorers              = null;
            ExplorerWrappers       = null;
        }
コード例 #9
0
ファイル: ThisAddIn.cs プロジェクト: hasnain2663/spikes
        private void ThisAddIn_Shutdown(object sender, EventArgs e)
        {
            inspectors.NewInspector -= NewInspector;
            inspectors = null;
            InspectorWrappers = null;

            explorers.NewExplorer -= NewExplorer;
            explorers = null;
            ExplorerWrappers = null;
        }
コード例 #10
0
 public ExplorerWatcher(Explorers explorers)
 {
     log.Info("Setting up Explorer event watchers.");
     //Watch existing explorers
     for (int e = 1; e <= explorers.Count; e++)
     {
         watchForPasteEvents(explorers[e]);
     }
     //Watch for new explorers
     this.explorers              = explorers;
     this.explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(explorers_NewExplorer);
 }
コード例 #11
0
 public ExplorerWatcher(Explorers explorers)
 {
     log.Info("Setting up Explorer event watchers.");
     log.Debug("Watch needed for " + explorers.Count + " existing explorers.");
     for (int e = 1; e <= explorers.Count; e++)
     {
         watchForPasteEvents(explorers[e]);
     }
     log.Fine("Watch for new explorers.");
     this.explorers              = explorers;
     this.explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(explorers_NewExplorer);
 }
コード例 #12
0
        public bool UpdateView()
        {
            // アプリ表示時以外はアプリは表示しないようにする。
            var nowUpdated = Explorers.DiffUpdate(
                _explorerDic.Values.Where(x => IsShowApplication || x.IsExplorer).ToArray(),
                new ExplorerEqualityComparer());
            var closeUpdated = ClosedExplorers.DiffUpdate(
                _closedExplorerDic.Values.Where(x => IsShowApplication || x.IsExplorer).ToArray(),
                new ExplorerEqualityComparer());

            return(nowUpdated || closeUpdated);
        }
コード例 #13
0
        public static string Get(Explorers explore)
        {
            switch (explore)
            {
            case Explorers.Chrome: return(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");

            case Explorers.Firefox: return(@"C:\Program Files\Mozilla Firefox\firefox.exe");

            case Explorers.Opera: return(@"C:\Program Files\Opera\launcher.exe");

            default: return(null);
            }
        }
コード例 #14
0
ファイル: ThisAddIn.cs プロジェクト: zuphzuph/SwordPhish
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            HasConfig = !String.IsNullOrWhiteSpace(Configuration.ReportRecipient);

            _explorers              = Application.Explorers;
            _explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(NewExplorer);

            _inspectors = Application.Inspectors;
            _inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(NewInspector);

            _currentExplorer = this.Application.ActiveExplorer();
            _currentExplorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange);
        }
コード例 #15
0
        public ExplorerWatcher(Application oApp)
        {
            Explorers explorers = null;

            try {
                explorers = oApp.Explorers;

                log.Info("Setting up Explorer event watchers.");
                log.Debug("Watch needed for " + explorers.Count + " existing explorers.");
                for (int e = 1; e <= explorers.Count; e++)
                {
                    watchForPasteEvents(explorers[e]);
                }
                log.Fine("Watch for new explorers.");
                this.explorers              = explorers;
                this.explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(explorers_NewExplorer);
            } finally {
                explorers = (Explorers)Calendar.ReleaseObject(explorers);
            }
        }
コード例 #16
0
ファイル: ThisAddIn.cs プロジェクト: hasnain2663/spikes
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            InspectorWrappers = new Dictionary<Inspector, InspectorWrapper>();
            ExplorerWrappers = new Dictionary<Explorer, ExplorerWrapper>();

            inspectors = Application.Inspectors;
            inspectors.NewInspector += NewInspector;

            foreach (Inspector inspector in inspectors)
            {
                NewInspector(inspector);
            }

            explorers = Application.Explorers;
            explorers.NewExplorer += NewExplorer;

            foreach (Explorer explorer in explorers)
            {
                NewExplorer(explorer);
            }
        }
コード例 #17
0
        private void ThisAddIn_Startup(object sender, EventArgs e)
        {
            InspectorWrappers = new Dictionary <Inspector, InspectorWrapper>();
            ExplorerWrappers  = new Dictionary <Explorer, ExplorerWrapper>();

            inspectors = Application.Inspectors;
            inspectors.NewInspector += NewInspector;

            foreach (Inspector inspector in inspectors)
            {
                NewInspector(inspector);
            }

            explorers              = Application.Explorers;
            explorers.NewExplorer += NewExplorer;

            foreach (Explorer explorer in explorers)
            {
                NewExplorer(explorer);
            }
        }
コード例 #18
0
        public Boolean NoGUIexists()
        {
            Boolean retVal = (oApp == null);

            if (!retVal)
            {
                Explorers explorers = null;
                try {
                    explorers = oApp.Explorers;
                    retVal    = (explorers.Count == 0);
                } catch (System.Exception) {
                    if (System.Diagnostics.Process.GetProcessesByName("OUTLOOK").Count() == 0)
                    {
                        log.Fine("No running outlook.exe process found.");
                        retVal = true;
                    }
                    else
                    {
                        OutlookOgcs.Calendar.AttachToOutlook(ref oApp, openOutlookOnFail: false);
                        try {
                            explorers = oApp.Explorers;
                            retVal    = (explorers.Count == 0);
                        } catch {
                            log.Warn("Failed to reattach to Outlook instance.");
                            retVal = true;
                        }
                    }
                } finally {
                    explorers = (Explorers)OutlookOgcs.Calendar.ReleaseObject(explorers);
                }
            }
            if (retVal)
            {
                log.Fine("No Outlook GUI detected.");
            }
            return(retVal);
        }
コード例 #19
0
        public bool CloseExplorer(Explorer explorer, ExplorerCloseReason closeReason)
        {
            if (explorer.IsPined)
            {
                return(false);                  // ピン留めの場合閉じない。
            }
            if (GetForegroundWindow() == (IntPtr)explorer.Handle)
            {
                return(false);                                                   // アクティブな場合閉じない。
            }
            if (closeReason == ExplorerCloseReason.Expiration && _closedExplorerDic.Values.Where(x => x.IsFavorited).Select(x => x.LocationUrl).Contains(explorer.LocationUrl))
            {
                return(false);                                                                                                                                                                // 期限切れで閉じるときはお気に入りのパスは閉じない。
            }
            var handle = explorer.Exit();

            _explorerDic.Remove(handle);
            Explorers.Remove(explorer);
            if (explorer.IsExplorer)
            {
                AddOrUpdateClosedDictionary(explorer);                      // エクスプローラだけ追加する
            }
            return(true);
        }
コード例 #20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="outlookApplication"></param>
 public OutlookViewProvider(_Application outlookApplication)
 {
     explorers = outlookApplication.Explorers;
     inspectors = outlookApplication.Inspectors;
 }
コード例 #21
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="outlookApplication"></param>
 public OutlookViewProvider(_Application outlookApplication)
 {
     explorers  = outlookApplication.Explorers;
     inspectors = outlookApplication.Inspectors;
 }