Example #1
0
 /// <summary>
 /// Notifies the ComManager that we are about to enter linked object mode.
 /// </summary>
 /// <remarks>
 /// We do the following here:
 /// <para>
 /// We revoke the class factory of the GraphDocumentComObject. If this is not done and a user copies an embedded graph object, the container application would try
 /// to open the graph mini project just here in this application instance, because the class factory of the GraphDocumentComObject is still active. In order to avoid this,
 /// the class factory of the GraphDocumentComObject is revoked here (if it is active).
 /// </para>
 /// </remarks>
 public void EnterLinkedObjectMode()
 {
     if (null != _classFactoryOfDocumentComObject)
     {
         _classFactoryOfDocumentComObject.RevokeClassObject();
         ComDebug.ReportInfo("{0}.EnterLinkedObjectMode Revoked: {1}", GetType().Name, _classFactoryOfDocumentComObject.GetType().Name);
         _classFactoryOfDocumentComObject = null;
     }
 }
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();
		}
Example #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();
        }