Exemple #1
0
        public void Initialize()
        {
            var applicationDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer");

            var optionsDataAccess = new OptionsDataAccess(
                Path.Combine(
                    applicationDataDirectory,
                    ComponentContainer.GetOrCreateConfigFileName(applicationDataDirectory, "Outlook")
                    ));

            var options = optionsDataAccess.LoadOptions().Single(o => o.Name == ProfileName);

            if (ServerAdapterTypeOverride.HasValue)
            {
                options.ServerAdapterType = ServerAdapterTypeOverride.Value;
            }

            _calDavDataAccess = new CalDavDataAccess(
                new Uri(options.CalenderUrl),
                SynchronizerFactory.CreateWebDavClient(
                    options,
                    TimeSpan.FromSeconds(30),
                    new OutlookAccountPasswordProvider("Outlook", "16.0.0.4266"),
                    new GeneralOptionsDataAccess().LoadOptions()));
        }
Exemple #2
0
        public void Initialize()
        {
            var applicationDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer");

            var optionsDataAccess = new OptionsDataAccess(
                Path.Combine(
                    applicationDataDirectory,
                    ComponentContainer.GetOrCreateConfigFileName(applicationDataDirectory, "Outlook")
                    ));

            var options = optionsDataAccess.LoadOptions().Single(o => o.Name == ProfileName);

            _calDavDataAccess = SynchronizerFactory.CreateCalDavDataAccess(
                options.CalenderUrl,
                options.UserName,
                options.Password,
                TimeSpan.FromSeconds(30),
                options.ServerAdapterType);
        }
Exemple #3
0
        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 Contracts.Options[] LoadOptions(string fileName)
        {
            var dataAccess = new OptionsDataAccess(fileName);

            return(dataAccess.LoadOptions());
        }