Exemple #1
0
        private void Register(CrossDomainTraceHelper parentDomain)
        {
            // Store the parent domain to pass messages to later
            _parentDomain = parentDomain;

            var logginService = new CrossAppDomainTraceService();

            MetaPackServiceContainer.Instance.ReplaceService(typeof(TraceServiceBase), logginService);

            CrossAppDomainTraceService.OnTraceEvent += (s, e) =>
            {
                Write(e.TraceString);
            };
        }
Exemple #2
0
        public static void StartListening(AppDomain domain)
        {
            var listenerType = typeof(CrossDomainTraceHelper);

            // Create a remote instance
            var remoteHelper =
                (CrossDomainTraceHelper)domain.CreateInstanceAndUnwrap(
                    listenerType.Assembly.FullName,
                    listenerType.FullName);

            // Create a local instance
            var localHelper = new CrossDomainTraceHelper();

            // Register the local helper in the remote domain
            remoteHelper.Register(localHelper);
        }