Esempio n. 1
0
 public void EnterEmbeddedObjectMode()
 {
     if (null != _classFactoryOfFileComObject)
     {
         _classFactoryOfFileComObject.RevokeClassObject();
         ComDebug.ReportInfo("{0}.EnterEmbeddedObjectMode Revoked: {1}", GetType().Name, _classFactoryOfFileComObject.GetType().Name);
         _classFactoryOfFileComObject = null;
     }
 }
Esempio n. 2
0
        private void InternalStopLocalServer()
        {
            ComDebug.ReportInfo("Stop local server");

            if (null != _embeddedComObject)
            {
                _embeddedComObject.Dispose();
                _embeddedComObject = null;
            }

            foreach (var co in _linkedDocumentsComObjects.Values)
            {
                co.Dispose();
            }
            _linkedDocumentsComObjects.Clear();

            if (null != _fileComObject)
            {
                _fileComObject.Dispose();
                _fileComObject = null;
            }

            if (null != _classFactoryOfDocumentComObject)
            {
                _classFactoryOfDocumentComObject.RevokeClassObject();
                ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", GetType().Name, _classFactoryOfDocumentComObject.GetType().Name);
                _classFactoryOfDocumentComObject = null;
            }

            if (null != _classFactoryOfFileComObject)
            {
                _classFactoryOfFileComObject.RevokeClassObject();
                ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", GetType().Name, _classFactoryOfFileComObject.GetType().Name);
                _classFactoryOfFileComObject = null;
            }

            if (null != _garbageCollector)
            {
                // Now stop the Garbage Collector thread.
                _garbageCollector.StopThread();
                _garbageCollector.WaitForThreadToStop();
                _garbageCollector = null;
                ComDebug.ReportInfo("StopLocalServer: GarbageCollector thread stopped.");
            }

            IsActive = false;
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
		private void InternalStopLocalServer()
		{
			ComDebug.ReportInfo("Stop local server");

			if (null != _embeddedComObject)
			{
				_embeddedComObject.Dispose();
				_embeddedComObject = null;
			}

			foreach (var co in _linkedDocumentsComObjects.Values)
			{
				co.Dispose();
			}
			_linkedDocumentsComObjects.Clear();

			if (null != _fileComObject)
			{
				_fileComObject.Dispose();
				_fileComObject = null;
			}

			if (null != _classFactoryOfDocumentComObject)
			{
				_classFactoryOfDocumentComObject.RevokeClassObject();
				ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", this.GetType().Name, _classFactoryOfDocumentComObject.GetType().Name);
				_classFactoryOfDocumentComObject = null;
			}

			if (null != _classFactoryOfFileComObject)
			{
				_classFactoryOfFileComObject.RevokeClassObject();
				ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", this.GetType().Name, _classFactoryOfFileComObject.GetType().Name);
				_classFactoryOfFileComObject = null;
			}

			if (null != _garbageCollector)
			{
				// Now stop the Garbage Collector thread.
				_garbageCollector.StopThread();
				_garbageCollector.WaitForThreadToStop();
				_garbageCollector = null;
				ComDebug.ReportInfo("StopLocalServer: GarbageCollector thread stopped.");
			}

			IsActive = false;
		}
Esempio n. 5
0
		public void EnterEmbeddedObjectMode()
		{
			if (null != _classFactoryOfFileComObject)
			{
				_classFactoryOfFileComObject.RevokeClassObject();
				ComDebug.ReportInfo("{0}.EnterEmbeddedObjectMode Revoked: {1}", this.GetType().Name, _classFactoryOfFileComObject.GetType().Name);
				_classFactoryOfFileComObject = null;
			}
		}
Esempio n. 6
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();
		}