예제 #1
0
        static void Main()
        {
            Console.WriteLine("***** Magic Egith Ball Service Client *****");
            string question = "My Question";
            string answer   = new EightBallClient().ObtainAnswerToQuestion(question);

            Console.WriteLine($"Question : {question}");
            Console.WriteLine($"Answer   : {answer}");
        }
예제 #2
0
파일: Program.cs 프로젝트: ch3rag/C-Sharp
 static void Main(string[] args)
 {
     using (EightBallClient ball = new EightBallClient()) {
         Console.Write("Your question: ");
         string question = Console.ReadLine();
         string answer   = ball.ObtainAnswerToQuestion(question);
         Console.WriteLine("8-Ball says: {0}", answer);
     }
     Console.ReadLine();
 }
예제 #3
0
 static void Main(string[] args)
 {
     Console.WriteLine("***** Ask the Magic 8 Ball * ****\n");
     using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall"))
     {
         Console.Write("Your question: ");
         string question = Console.ReadLine();
         string answer   = ball.ObtainAnswerToQuestion(question);
         Console.WriteLine("8-Ball says: {0}", answer);
     }
     Console.ReadLine();
 }
예제 #4
0
 static void Main(string[] args)
 {
     Console.WriteLine("******** Ask the Magic 8 ball *****\n");
     using (EightBallClient ball = new EightBallClient())
     {
         Console.WriteLine("Your question:");
         string q      = Console.ReadLine();
         string answer = ball.ObtainAnswerToQuestion(q);
         Console.WriteLine($"Eight ball says: {answer}");
         Console.ReadLine();
     }
 }
예제 #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Ask the Magic 8 Ball*****\n");

            //You can enter into the client constructor which binding
            //you want to use when instantiating the class
            using (EightBallClient ball = new EightBallClient("BasicHttpBinding_IEightBall"))
            {
                Console.WriteLine("Your question: ");
                string question = Console.ReadLine();
                string answer   = ball.ObtainAnswertoQuestion(question);
                Console.WriteLine($"8-Ball says: {answer}");
            }
            Console.ReadLine();
        }
예제 #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("*** Ask the Magic 8 Ball ***");

            //NetTcpBinding_IEightBall
            using (var ball = new EightBallClient("BasicHttpBinding_IEightBall"))
            {
                Console.Write("Your question: ");
                string question = Console.ReadLine();
                string answer   = ball.ObtainAnswerToQuestion(question);
                Console.WriteLine($"8-Ball says: {answer}");
            }

            Console.ReadLine();
        }
예제 #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Ask the Magic 8 Ball *****\n");

            using (EightBallClient ball = new EightBallClient("basicHttpBinding_IEightBall"))
            {
                Console.Write("Your question: ");
                //string question = Console.ReadLine();
                string question = "Will there be another fire?";
                string answer   =
                    ball.ObtainAnswerToQuestion(question);
                Console.WriteLine("In response to {0}   8-Ball says: {1}", question, answer);
                Console.ReadLine();
            }
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("******ask the magic 8 ball******\n");
            //1 使用http的方式
            //using(EightBallClient ball=new EightBallClient("BasicHttpBinding_IEightBall"))
            //2 使用tcp的方式
            using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall"))
            {
                Console.WriteLine("输入你的问题");
                string question = Console.ReadLine();

                string answer = ball.ObtainAnswerToQuestion(question);
                Console.WriteLine("8-Ball says:{0}", answer);
            }
            Console.ReadLine();
        }
예제 #9
0
        static void Main(string[] args)
        {
            EightBallClient client = new EightBallClient();


            while (true)
            {
                Console.ReadKey();
                Console.WriteLine(client.ObtainAnswerToQuestion("hehe"));
            }
            //Console.WriteLine("****  Ask the Magic 8 Ball *****\n");
            //using (EightBallClient ball = new EightBallClient())
            //{
            //    Console.WriteLine();
            //}
        }
예제 #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("*** Ask the Magic 8 Ball ****\n");
            using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall"))
            {
                bool isExit = false;
                while (isExit == false)
                {
                    Console.WriteLine("Your question:");
                    string question = Console.ReadLine();
                    if (question == "Exit")
                    {
                        isExit = true;
                    }
                    else
                    {
                        string answer = ball.ObtainAnswerToQuestion(question);
                        Console.WriteLine($"8-Ball says: {answer}");
                    }
                }
            }

            Console.ReadLine();
        }