コード例 #1
0
ファイル: Program.cs プロジェクト: ChuckTest/WCFTest
        private static void Main()
        {
            try
            {

                CallbackType callbackType = new CallbackType();
                InstanceContext instanceContext = new InstanceContext(callbackType);

                HelloIndigoContractClient client = new HelloIndigoContractClient(instanceContext);

                const string message = "Hello world!";
                Console.WriteLine("Send message \"{0}\" to server.", message);
                Console.WriteLine("Client started on thread {0}", Thread.CurrentThread.GetHashCode());
                Console.WriteLine();

                client.HelloIndigo(message);

            }
            catch (Exception ex)
            {
                while (ex != null)
                {
                    Console.WriteLine(ex.Message);
                    ex = ex.InnerException;
                }
            }
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ChuckTest/WCFTest
 public Form1()
 {
     InitializeComponent();
     StartPosition = FormStartPosition.CenterScreen;
     InstanceContext instanceContext = new InstanceContext(this);
     client = new HelloIndigoContractClient(instanceContext);
     WSDualHttpBinding binding = client.Endpoint.Binding as WSDualHttpBinding;
     if (binding != null)
     {
         binding.ClientBaseAddress = new Uri("http://localhost:8101");
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: omidnasri/Learning-WCF
        public Form1()
        {
            InitializeComponent();

            this.Text = string.Format("Callback Client - Thread {0}", Thread.CurrentThread.GetHashCode());

            InstanceContext context = new InstanceContext(this);

            m_proxy = new HelloIndigoContractClient(context);

            WSDualHttpBinding binding = m_proxy.Endpoint.Binding as WSDualHttpBinding;

            if (binding != null)
            {
                binding.ClientBaseAddress = new Uri("http://localhost:8101");
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: omidnasri/Learning-WCF
        static void Main(string[] args)
        {
            Console.WriteLine("Client running on thread {0}", Thread.CurrentThread.GetHashCode());
            Console.WriteLine();

            CallbackType    cb      = new CallbackType();
            InstanceContext context = new InstanceContext(cb);

            using (HelloIndigoContractClient proxy = new HelloIndigoContractClient(context))
            {
                Console.WriteLine("Calling HelloIndigo()");
                proxy.HelloIndigo("Hello from Client.");
                Console.WriteLine("Returned from HelloIndigo()");

                Console.ReadLine();
            }
        }