private async void StartupTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                s_logger.Info("StartupTimer_Tick entered.");

                _startupTimer.Enabled = false;
                _startupTimer.Dispose();
                _startupTimer = null;

                if (ComponentContainer is ComponentContainer)
                {
                    s_logger.Info("ComponentContainer already created. StartupTimer_Tick exiting.");
                    return;
                }

                ComponentContainer = new ComponentContainer(Application, new GeneralOptionsDataAccess(), new ComWrapperFactory(), new ExceptionHandlingStrategy());
                ComponentContainer.SynchronizationFailedWhileReportsFormWasNotVisible += ComponentContainer_SynchronizationFailedWhileReportsFormWasNotVisible;
                ComponentContainer.StatusChanged += ComponentContainer_StatusChanged;

                CalDavSynchronizer.ComponentContainer.EnsureSynchronizationContext();

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

                s_logger.Info("StartupTimer_Tick exiting.");
            }
            catch (Exception x)
            {
                ComponentContainer = new LoadErrorComponentContainer(x.ToString());
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }
Beispiel #2
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();

                CalDavSynchronizer.ComponentContainer.EnsureSynchronizationContext();

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

                s_logger.Info("Startup exiting.");
            }
            catch (Exception x)
            {
                ComponentContainer = new LoadErrorComponentContainer(x.ToString());
                ExceptionHandler.Instance.DisplayException(x, s_logger);
            }
        }