public ComponentContainer (NameSpace session)
    {
      try
      {
        XmlConfigurator.Configure();

        _session = session;
        s_logger.Info ("Startup...");

        EnsureSynchronizationContext();

        var applicationDataDirectory = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer");

        _optionsDataAccess = new OptionsDataAccess (
            Path.Combine (
                applicationDataDirectory,
                GetOrCreateConfigFileName (applicationDataDirectory, _session.CurrentProfileName)
                ));

        var synchronizerFactory = new SynchronizerFactory (
            applicationDataDirectory,
            new TotalProgressFactory (
                new ProgressFormFactory(),
                int.Parse (ConfigurationManager.AppSettings["loadOperationThresholdForProgressDisplay"]),
                ExceptionHandler.Instance),
            _session,
            TimeSpan.Parse (ConfigurationManager.AppSettings["calDavConnectTimeout"]),
            TimeSpan.Parse (ConfigurationManager.AppSettings["calDavReadWriteTimeout"]));

        _scheduler = new Scheduler (synchronizerFactory, EnsureSynchronizationContext);
        _scheduler.SetOptions (_optionsDataAccess.LoadOptions());

        _updateChecker = new UpdateChecker (new AvailableVersionService(), () => _optionsDataAccess.IgnoreUpdatesTilVersion);
        _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound;
        _updateChecker.IsEnabled = _optionsDataAccess.ShouldCheckForNewerVersions;
      }
      catch (Exception x)
      {
        ExceptionHandler.Instance.LogException (x, s_logger);
        throw;
      }

      s_logger.Info ("Startup finnished");
    }
    public ComponentContainer (Application application)
    {
      _generalOptionsDataAccess = new GeneralOptionsDataAccess();

      var generalOptions = _generalOptionsDataAccess.LoadOptions();

      ConfigureServicePointManager (generalOptions);

      _itemChangeWatcher = new OutlookItemChangeWatcher (application.Inspectors);
      _itemChangeWatcher.ItemSavedOrDeleted += ItemChangeWatcherItemSavedOrDeleted;
      _session = application.Session;
      s_logger.Info ("Startup...");

      EnsureSynchronizationContext();

      _applicationDataDirectory = Path.Combine (
          Environment.GetFolderPath (
              generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData),
          "CalDavSynchronizer");

      _optionsDataAccess = new OptionsDataAccess (
          Path.Combine (
              _applicationDataDirectory,
              GetOrCreateConfigFileName (_applicationDataDirectory, _session.CurrentProfileName)
              ));

      var synchronizerFactory = new SynchronizerFactory (
          GetProfileDataDirectory,
          new TotalProgressFactory (
              new ProgressFormFactory(),
              int.Parse (ConfigurationManager.AppSettings["loadOperationThresholdForProgressDisplay"]),
              ExceptionHandler.Instance),
          _session,
          TimeSpan.Parse (ConfigurationManager.AppSettings["calDavConnectTimeout"]),
          TimeSpan.Parse (ConfigurationManager.AppSettings["calDavReadWriteTimeout"]));

      _scheduler = new Scheduler (synchronizerFactory, EnsureSynchronizationContext);
      _scheduler.SetOptions (_optionsDataAccess.LoadOptions());

      _updateChecker = new UpdateChecker (new AvailableVersionService(), () => _generalOptionsDataAccess.IgnoreUpdatesTilVersion);
      _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound;
      _updateChecker.IsEnabled = generalOptions.ShouldCheckForNewerVersions;
    }