コード例 #1
0
        /// <summary>
        /// Parameterises and remotes a TPollClientTasks Object that will be used by the
        /// Client to poll for ClientTasks.
        ///
        /// @comment WARNING: If you need to rename this function or change its parameters,
        /// you also need to change the String with its name and the parameters in the
        /// .NET Reflection call in TClientAppDomainConnection!
        ///
        /// @comment The Client needs to make calls to the TPollClientTasks Object
        /// in regular intervals. If the calls don't come anymore, the Client's
        /// AppDomain will be unloaded by a thread of TClientStillAliveCheck!
        ///
        /// </summary>
        /// <returns>The URL at which the remoted TPollClientTasks Object can be reached.
        /// </returns>
        public String GetPollClientTasksURL()
        {
            // Set Parameters for TPollClientTasks Class
            new TPollClientTasksParameters(FClientTasksManager);

            FRemotedPollClientTaskObject = new TPollClientTasks();

            // Start ClientStillAliveCheck Thread
            new ClientStillAliveCheck.TClientStillAliveCheck(FClientServerConnectionType, new TDelegateTearDownAppDomain(
                                                                 TearDownAppDomain), FRandomAppDomainTearDownToken);

            if (TLogging.DL >= 5)
            {
                Console.WriteLine("TClientDomainManager.GetPollClientTasksURL: created TClientStillAliveCheck.");
            }

            string ReturnValue = TConfigurableMBRObject.BuildRandomURI("PollClientTasks");

            if (TLogging.DL >= 9)
            {
                Console.WriteLine("TClientDomainManager.GetPollClientTasksURL: remote at: " + ReturnValue);
            }

            return(ReturnValue);
        }
コード例 #2
0
        /// <summary>
        /// create a object that can be remoted to a client
        /// </summary>
        public static object CreateRemotableObject(Type ARemotableObject, ICrossDomainService ObjectToRemote)
        {
            // need to calculate the URI for this object and pass it to the new namespace object
            string ObjectURI = TConfigurableMBRObject.BuildRandomURI(ObjectToRemote.GetType().ToString());

            // we need to add the service in the main domain
            DomainManagerBase.UClientManagerCallForwarderRef.AddCrossDomainService(
                DomainManagerBase.GClientID.ToString(), ObjectURI, ObjectToRemote);

            try
            {
                // create the object
                return(Activator.CreateInstance(ARemotableObject, new object[] { ObjectURI }));
            }
            catch (Exception ex)
            {
                TLogging.Log(ex.ToString());
                throw;
            }
        }