public static void Initialize (NameSpace mapiNameSpace)
    {
      s_mapiNameSpace = mapiNameSpace;
      const string testerServerEmailAddress = "*****@*****.**";

      if (mapiNameSpace == null)
        throw new ArgumentNullException ("mapiNameSpace");

      _entityMapper = new EventEntityMapper (
          mapiNameSpace.CurrentUser.Address,
          new Uri ("mailto:" + testerServerEmailAddress),
          mapiNameSpace.Application.TimeZones.CurrentTimeZone.ID,
          mapiNameSpace.Application.Version,
          new EventMappingConfiguration());

      s_outlookFolderEntryId = ConfigurationManager.AppSettings[string.Format ("{0}.OutlookFolderEntryId", Environment.MachineName)];
      s_outlookFolderStoreId = ConfigurationManager.AppSettings[string.Format ("{0}.OutlookFolderStoreId", Environment.MachineName)];

      _outlookRepository = new OutlookEventRepository (mapiNameSpace, s_outlookFolderEntryId, s_outlookFolderStoreId, NullDateTimeRangeProvider.Instance);

      s_synchronizerFactory = new SynchronizerFactory (
          _ => @"a:\invalid path",
          NullTotalProgressFactory.Instance,
          s_mapiNameSpace,
          TimeSpan.Zero,
          TimeSpan.Zero);

      s_outlookEventRepository = new OutlookEventRepository (
          s_mapiNameSpace,
          s_outlookFolderEntryId,
          s_outlookFolderStoreId,
          NullDateTimeRangeProvider.Instance);
    }
    public ComponentContainer (Application application)
    {
      try
      {
        XmlConfigurator.Configure();

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

        EnsureSynchronizationContext();

        _applicationDataDirectory = Path.Combine (Environment.GetFolderPath (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(), () => _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");
    }
        private void InitializeSynchronizer()
        {
            try
              {
            XmlConfigurator.Configure();

            Session = Application.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 Ui.ProgressFormFactory(),
                int.Parse (ConfigurationManager.AppSettings["loadOperationThresholdForProgressDisplay"]),
                ExceptionHandler.Instance),
            Application.Session);

            Scheduler = new Scheduler (synchronizerFactory);
            Scheduler.SetOptions (OptionsDataAccess.LoadOptions());
              }
              catch (Exception x)
              {
            ExceptionHandler.Instance.LogException (x, s_logger);
            throw;
              }

              s_logger.Info ("Startup finnished");
        }
    public static void Initialize (NameSpace mapiNameSpace)
    {
      s_mapiNameSpace = mapiNameSpace;
      const string testerServerEmailAddress = "*****@*****.**";

      if (mapiNameSpace == null)
        throw new ArgumentNullException ("mapiNameSpace");

      var globalTimeZoneCache = new GlobalTimeZoneCache();

      var eventMappingConfiguration = new EventMappingConfiguration();
      s_entityMapper = new EventEntityMapper (
          mapiNameSpace.CurrentUser.Address,
          new Uri ("mailto:" + testerServerEmailAddress),
          mapiNameSpace.Application.TimeZones.CurrentTimeZone.ID,
          mapiNameSpace.Application.Version,
          new TimeZoneCache (null, false, globalTimeZoneCache), 
          eventMappingConfiguration,
          null);

      s_outlookFolderEntryId = ConfigurationManager.AppSettings[string.Format ("{0}.OutlookFolderEntryId", Environment.MachineName)];
      s_outlookFolderStoreId = ConfigurationManager.AppSettings[string.Format ("{0}.OutlookFolderStoreId", Environment.MachineName)];

      var daslFilterProvider = new DaslFilterProvider (false);

      s_synchronizerFactory = new SynchronizerFactory (
          _ => @"a:\invalid path",
          NullTotalProgressFactory.Instance,
          s_mapiNameSpace,
          daslFilterProvider,
          new OutlookAccountPasswordProvider (mapiNameSpace.CurrentProfileName, mapiNameSpace.Application.Version),
          globalTimeZoneCache);

      s_outlookEventRepository = new OutlookEventRepository (
          s_mapiNameSpace,
          s_outlookFolderEntryId,
          s_outlookFolderStoreId,
          NullDateTimeRangeProvider.Instance,
          eventMappingConfiguration,
          daslFilterProvider);
    }