コード例 #1
0
        /// <summary>
        /// This function will call the method of the global service that will get a reference and
        /// call a method of the local one.
        /// </summary>
        private void GetLocalUsingGlobalCallback(object sender, EventArgs args)
        {
            // Get a reference to the global service.
            IMyGlobalService service = GetService(typeof(SMyGlobalService)) as IMyGlobalService;

            if (null == service)
            {
                // The previous call failed, but we expected it to succeed.
                // Write a message on the debug output and exit.
                Debug.WriteLine("Can not get the global service.");
                return;
            }
            // Now call the method that will cause the call in the local service.
            service.CallLocalService();
        }