コード例 #1
0
 public RoslynVisualizationService(
     IModelServiceFactory modelServiceFactory,
     IDiagramServiceFactory diagramServiceFactory,
     IUiServiceFactory uiServiceFactory,
     IDiagramPluginFactory diagramPluginFactory,
     IEnumerable <DiagramPluginId> diagramPluginIds)
     : base(modelServiceFactory,
            diagramServiceFactory,
            uiServiceFactory,
            diagramPluginFactory,
            diagramPluginIds)
 {
 }
コード例 #2
0
        public VisualizationService(
            IModelServiceFactory modelServiceFactory,
            IDiagramServiceFactory diagramServiceFactory,
            IUiServiceFactory uiServiceFactory,
            IDiagramPluginFactory diagramPluginFactory,
            IEnumerable <DiagramPluginId> diagramPluginIds)
        {
            ModelServiceFactory   = modelServiceFactory;
            DiagramServiceFactory = diagramServiceFactory;
            UiServiceFactory      = uiServiceFactory;
            DiagramPluginFactory  = diagramPluginFactory;
            DiagramPluginIds      = diagramPluginIds;

            ModelService     = ModelServiceFactory.Create();
            _diagramServices = new Dictionary <DiagramId, IDiagramService>();
            _diagramUis      = new Dictionary <DiagramId, IUiService>();
            _diagramPlugins  = new Dictionary <DiagramId, List <IDiagramPlugin> >();
        }
コード例 #3
0
        public ComponentContainer(Application application, IUiServiceFactory uiServiceFactory, IGeneralOptionsDataAccess generalOptionsDataAccess, IComWrapperFactory comWrapperFactory, IExceptionHandlingStrategy exceptionHandlingStrategy)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }
            if (uiServiceFactory == null)
            {
                throw new ArgumentNullException(nameof(uiServiceFactory));
            }
            if (generalOptionsDataAccess == null)
            {
                throw new ArgumentNullException(nameof(generalOptionsDataAccess));
            }
            if (comWrapperFactory == null)
            {
                throw new ArgumentNullException(nameof(comWrapperFactory));
            }

            s_logger.Info("Startup...");

            if (GeneralOptionsDataAccess.WpfRenderModeSoftwareOnly)
            {
                RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
            }

            _generalOptionsDataAccess = generalOptionsDataAccess;

            _synchronizationStatus = new SynchronizationStatus();

            var generalOptions = _generalOptionsDataAccess.LoadOptions();

            _daslFilterProvider = new DaslFilterProvider(generalOptions.IncludeCustomMessageClasses);

            SetWpfLocale();

            ConfigureServicePointManager(generalOptions);
            ConfigureLogLevel(generalOptions.EnableDebugLog);

            _session = application.Session;

            _outlookAccountPasswordProvider =
                string.IsNullOrEmpty(_session.CurrentProfileName)
              ? NullOutlookAccountPasswordProvider.Instance
              : new OutlookAccountPasswordProvider(_session.CurrentProfileName, application.Version);

            _globalTimeZoneCache = new GlobalTimeZoneCache();

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

            _optionsDataAccess = new OptionsDataAccess(
                Path.Combine(
                    _applicationDataDirectory,
                    GetOrCreateConfigFileName(_applicationDataDirectory, _session.CurrentProfileName)
                    ));
            _profileStatusesViewModel = new ProfileStatusesViewModel(this);
            _uiService = uiServiceFactory.Create(_profileStatusesViewModel);

            _queryFolderStrategyWrapper = new OutlookFolderStrategyWrapper(QueryOutlookFolderByRequestingItemStrategy.Instance);

            _totalProgressFactory = new TotalProgressFactory(
                _uiService,
                generalOptions.ShowProgressBar,
                generalOptions.ThresholdForProgressDisplay,
                ExceptionHandler.Instance);


            _synchronizerFactory = new SynchronizerFactory(
                GetProfileDataDirectory,
                _totalProgressFactory,
                new OutlookSession(_session),
                _daslFilterProvider,
                _outlookAccountPasswordProvider,
                _globalTimeZoneCache,
                _queryFolderStrategyWrapper,
                exceptionHandlingStrategy,
                comWrapperFactory);

            _synchronizationReportRepository = CreateSynchronizationReportRepository();

            UpdateGeneralOptionDependencies(generalOptions);

            _scheduler = new Scheduler(
                _synchronizerFactory,
                this,
                EnsureSynchronizationContext,
                new FolderChangeWatcherFactory(
                    _session),
                _synchronizationStatus);

            var options = _optionsDataAccess.Load();

            EnsureCacheCompatibility(options);


            _profileStatusesViewModel.EnsureProfilesDisplayed(options);


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

            _reportGarbageCollection = new ReportGarbageCollection(_synchronizationReportRepository, TimeSpan.FromDays(generalOptions.MaxReportAgeInDays));

            _trayNotifier = generalOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance;

            try
            {
                using (var syncObjects = GenericComObjectWrapper.Create(_session.SyncObjects))
                {
                    if (syncObjects.Inner != null && syncObjects.Inner.Count > 0)
                    {
                        _syncObject = syncObjects.Inner[1];
                        if (generalOptions.TriggerSyncAfterSendReceive)
                        {
                            _syncObject.SyncEnd += SyncObject_SyncEnd;
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                s_logger.Error("Can't access SyncObjects", ex);
            }

            _categorySwitcher = new CategorySwitcher(new OutlookSession(_session), _daslFilterProvider, _queryFolderStrategyWrapper);
        }