Exemple #1
0
        static void Main(string[] args) 
        {
            using (MyMathClient proxy = new MyMathClient())
            {
                int result = proxy.AddInt(35, 38);
                Console.WriteLine("result: {0}", result);

                double result0 = proxy.AddDouble(35, 38);
                Console.WriteLine("result: {0}", result0);

                MathResult result1 = proxy.Total(35, 38);
                Console.WriteLine("result: {0} {1} {2} {3}", result1.Sum, result1.Sub, result1.Mult, result1.Div);

                Console.WriteLine("Async Call");
                proxy.BeginAddInt(10, 20, AddIntCallBack, proxy);
                Console.WriteLine("AsyncAdd was called");

                Console.WriteLine("Call One Way Operation");
                proxy.OneWayOperation("one way");
                Console.WriteLine("One Way Operation was called");

                Console.WriteLine("Call Two Way Operation");
                proxy.TwoWayOperation("two way");
                Console.WriteLine("Two Way Operation was called");

                Console.ReadLine();
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            MyMathClient proxy = new MyMathClient();

            MathResult mr = proxy.Total(35, 38);
            Console.WriteLine("Результат: {0} {1} {2} {3}", mr.sum, mr.subtr, mr.div, mr.mult);

            Console.WriteLine("Для завершения нажмите<ENTER>.\n\n");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            try
            {
                //ChannelFactory<IMyMath> factory = new ChannelFactory<IMyMath>(
                //    new WSHttpBinding(),
                //    new EndpointAddress("http://localhost/MathService/ep1")
                //    );
                //IMyMath channel = factory.CreateChannel();

                MyMathClient proxy = new MyMathClient();
                MathResult mr = proxy.Total(35, 48);

                Console.WriteLine("result: {0} {1} {2} {3}" , mr.sum , mr.subrt , mr.div , mr.mult);
                Console.WriteLine("Для завершения нажмите <ENTER>\n");
                Console.ReadLine();
                //factory.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }