コード例 #1
0
ファイル: Program.cs プロジェクト: llalwani/RestBugs
        static void Go()
        {
            var resp = _client.GetAsync(BugsMediaTypeConstants.ENTRY_PATH).Result;
            //TODO: factory logic to select the correct represenation impl based on content-type header
            IRepresentation representation = new HtmlBugRepresentation(resp);

            representation.Display();

            while (true)
            {
                try {
                    Console.Write("\nCommand: ");
                    var command = Console.ReadLine();
                    if (command == "q")
                    {
                        break;
                    }

                    var newReq = representation.ProcessCommand(command);

                    var newResp = _client.SendAsync(newReq).Result;

                    //add logic to check for failure codes before automatically overwriting the context variable
                    resp           = newResp;
                    representation = new HtmlBugRepresentation(resp);
                    representation.Display();
                }
                catch (Exception ex) {
                    Console.WriteLine("ERROR: " + ex.Message);
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: satish860/RestBugs
        static void Go()
        {
            var resp = _client.GetAsync(BugsMediaTypeConstants.ENTRY_PATH).Result;
            //TODO: factory logic to select the correct represenation impl based on content-type header
            IRepresentation representation = new HtmlBugRepresentation(resp);
            representation.Display();

            while(true) {
                try {
                    Console.Write("\nCommand: ");
                    var command = Console.ReadLine();
                    if (command == "q")
                        break;

                    var newReq = representation.ProcessCommand(command);

                    var newResp = _client.SendAsync(newReq).Result;

                    //add logic to check for failure codes before automatically overwriting the context variable
                    resp = newResp;
                    representation = new HtmlBugRepresentation(resp);
                    representation.Display();
                }
                catch(Exception ex) {
                    Console.WriteLine("ERROR: " + ex.Message);
                }
            }
        }