Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SimpleMathClient proxy = new SimpleMathClient("NetTcpBinding_ISimpleMath");
            //SimpleMathClient proxy1 = new SimpleMathClient("BasicHttpBinding_ISimpleMath");
            int Square = proxy.Square(10);
            int Cube   = proxy.Cube(10);
            int Add    = proxy.Add(10, 20);

            Console.WriteLine("Enter a char");

            char z = char.Parse(Console.ReadLine());

            List <Person> c = proxy.GetPerson(z).ToList();

            foreach (Person p in c)
            {
                Console.WriteLine("name " + p.PersonName + " place is" + " " + p.Place);
                Console.ReadLine();
            }

            Console.WriteLine("Square is:" + Square);
            Console.WriteLine("Cube is:" + Cube);
            Console.WriteLine("Addition is:" + Add);

            // Console.WriteLine(" Person is:" +PersonName);
            Console.WriteLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            /*MathClient mathClient = new MathClient("BasicHttpBinding_IMath");
             * Console.WriteLine($"Add: {mathClient.Add(3.5, 4.5)}");
             * Console.WriteLine($"Subtract: {mathClient.Add(4.5, 3.5)}");
             * Console.WriteLine($"Multiply: {mathClient.Add(3.5, 4.5)}");
             * Console.WriteLine($"Division: {mathClient.Add(3.5, 4.5)}");*/

            Console.WriteLine("Press Enter to run the client.........");
            Console.ReadLine();

            Console.WriteLine("Enter X:");
            double x = double.Parse(Console.ReadLine());

            Console.WriteLine("Enter Y:");
            double y = double.Parse(Console.ReadLine());

            SimpleMathClient mathClient = new SimpleMathClient("BasicHttpBinding_SimpleMath");

            try
            {
                Console.WriteLine($"Add: {mathClient.add(x, y)}");
                Console.WriteLine($"Subtract: {mathClient.sub(x, y)}");
                //Console.WriteLine($"Multiply: {mathClient.mul(x, y)}");
                //Console.WriteLine($"Division: {mathClient.div(x, y)}");
                List <double> numbers = new List <double>();
                numbers.Add(3.5);
                numbers.Add(3.5);
                numbers.Add(3.5);
                //mathClient.addList(numbers);
                Console.WriteLine("Call is Completed.......");

                //mathClient.addList(numbers);
                Console.WriteLine("Call is Completed.......");

                //mathClient.addList(numbers);
                Console.WriteLine("Call is Completed.......");
            }
            catch (FaultException fe)
            {
                Console.WriteLine(fe.Reason);
            }
            Console.ReadLine();
        }