示例#1
0
        void InitializeServices()
        {
            if (_servicesLoaded)
            {
                return;
            }

            if (GetService <AnkhRuntime>() == null)
            {
                _container.AddService(typeof(AnkhRuntime), this, true);

                if (_container.GetService(typeof(IAnkhServiceProvider)) == null)
                {
                    _container.AddService(typeof(IAnkhServiceProvider), this);
                }
            }

            if (GetService <AnkhServiceEvents>() == null)
            {
                AnkhServiceEvents se = new AnkhServiceEvents(Context);
                _container.AddService(typeof(AnkhServiceEvents), se);
                _container.AddService(typeof(IAnkhServiceEvents), se);
            }

            if (GetService <SynchronizationContext>() == null)
            {
                _container.AddService(typeof(SynchronizationContext), new System.Windows.Forms.WindowsFormsSynchronizationContext());
            }

#if DEBUG
            PreloadServicesViaEnsure = true;
#endif
            // If the parent container is not hooked up yet, we have to reinitialize later!
            _servicesLoaded = (GetService <AnkhRuntime>() != null);
        }
示例#2
0
        public void Start()
        {
            InitializeServices();

            foreach (Module module in _modules)
            {
                module.OnInitialize();
            }

            foreach (IAnkhServiceImplementation service in _services)
            {
                service.OnInitialize();
            }

            AnkhServiceEvents events = GetService <AnkhServiceEvents>();

            if (events != null)
            {
                events.OnRuntimeLoaded(EventArgs.Empty);
                events.OnRuntimeStarted(EventArgs.Empty);
            }
        }