Example #1
0
        public void StartLocalServer()
        {
            IsActive = true;

            ComDebug.ReportInfo("Starting local server");

            // if we are in 64 bit mode, make sure that the PreferredServerBitness flag is set in the registry

            {
                // Register the FileComObject
                _classFactoryOfFileComObject = new ClassFactory_ProjectFileComObject(this)
                {
                    ClassContext = (uint)(CLSCTX.CLSCTX_LOCAL_SERVER),
                    ClassId      = Marshal.GenerateGuidForType(typeof(ProjectFileComObject)),
                    Flags        = (uint)REGCLS.REGCLS_SINGLEUSE | (uint)REGCLS.REGCLS_SUSPENDED
                };
                _classFactoryOfFileComObject.RegisterClassObject();
                ComDebug.ReportInfo("{0}.StartLocalServer Registered: {1}", GetType().Name, _classFactoryOfFileComObject.GetType().Name);
            }

            if (ApplicationWasStartedWithEmbeddingArg)
            {
                // Register the SimpleCOMObjectClassFactory.
                _classFactoryOfDocumentComObject = new ClassFactory_GraphDocumentEmbeddedComObject(this)
                {
                    ClassContext = (uint)(CLSCTX.CLSCTX_LOCAL_SERVER),
                    ClassId      = Marshal.GenerateGuidForType(typeof(GraphDocumentEmbeddedComObject)),
                    Flags        = (uint)REGCLS.REGCLS_SINGLEUSE | (uint)REGCLS.REGCLS_SUSPENDED
                };
                _classFactoryOfDocumentComObject.RegisterClassObject();
                ComDebug.ReportInfo("{0}.StartLocalServer Registered: {1}", GetType().Name, _classFactoryOfDocumentComObject.GetType().Name);
            }

            ClassFactoryBase.ResumeClassObjects();

            // Start up the garbage collection thread.
            _garbageCollector = new GarbageCollector(1000);
            var GarbageCollectionThread = new Thread(new ThreadStart(_garbageCollector.GCWatch))
            {
                // Set the name of the thread object.
                Name         = "GarbCollThread",
                IsBackground = true
            };

            // Start the thread.
            GarbageCollectionThread.Start();
        }
Example #2
0
		public void StartLocalServer()
		{
			IsActive = true;

			ComDebug.ReportInfo("Starting local server");

			// if we are in 64 bit mode, make sure that the PreferredServerBitness flag is set in the registry

			{
				// Register the FileComObject
				_classFactoryOfFileComObject = new ClassFactory_ProjectFileComObject(this);
				_classFactoryOfFileComObject.ClassContext = (uint)(CLSCTX.CLSCTX_LOCAL_SERVER);
				_classFactoryOfFileComObject.ClassId = Marshal.GenerateGuidForType(typeof(ProjectFileComObject));
				_classFactoryOfFileComObject.Flags = (uint)REGCLS.REGCLS_SINGLEUSE | (uint)REGCLS.REGCLS_SUSPENDED;
				_classFactoryOfFileComObject.RegisterClassObject();
				ComDebug.ReportInfo("{0}.StartLocalServer Registered: {1}", this.GetType().Name, _classFactoryOfFileComObject.GetType().Name);
			}

			if (ApplicationWasStartedWithEmbeddingArg)
			{
				// Register the SimpleCOMObjectClassFactory.
				_classFactoryOfDocumentComObject = new ClassFactory_GraphDocumentEmbeddedComObject(this);
				_classFactoryOfDocumentComObject.ClassContext = (uint)(CLSCTX.CLSCTX_LOCAL_SERVER);
				_classFactoryOfDocumentComObject.ClassId = Marshal.GenerateGuidForType(typeof(GraphDocumentEmbeddedComObject));
				_classFactoryOfDocumentComObject.Flags = (uint)REGCLS.REGCLS_SINGLEUSE | (uint)REGCLS.REGCLS_SUSPENDED;
				_classFactoryOfDocumentComObject.RegisterClassObject();
				ComDebug.ReportInfo("{0}.StartLocalServer Registered: {1}", this.GetType().Name, _classFactoryOfDocumentComObject.GetType().Name);
			}

			ClassFactoryBase.ResumeClassObjects();

			// Start up the garbage collection thread.
			_garbageCollector = new GarbageCollector(1000);
			Thread GarbageCollectionThread = new Thread(new ThreadStart(_garbageCollector.GCWatch));

			// Set the name of the thread object.
			GarbageCollectionThread.Name = "GarbCollThread";
			GarbageCollectionThread.IsBackground = true;

			// Start the thread.
			GarbageCollectionThread.Start();
		}