Пример #1
0
        public override void Show()
        {
            base.Show();

            Console.WriteLine();

            try
            {
                Task <List <PetStatsDTO> > petStats = MainUI.client.GetPets();
                Console.WriteLine("fetching your pets information...");
                petStats.Wait();

                if (petStats.Result != null)
                {
                    ObjectsList list = new ObjectsList(" ", petStats.Result.ToList <object>());
                    list.Show();
                }
                else
                {
                    Console.WriteLine("No Data Found");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("oopsi doopi something went wrong or" + e.InnerException);
                Console.WriteLine("enter any key to go back");
                Console.ReadKey();
                return;
            }
            Console.WriteLine();
            Console.WriteLine("Press any key to go back");
            Console.WriteLine();
            Console.ReadKey();
        }
Пример #2
0
        public override void Show()
        {
            char c = '\r';

            while (c == '\r')
            {
                base.Show();
                Console.WriteLine("Please type the amount of recent activities you want to see");
                int option = 0;
                int.TryParse(Console.ReadLine(), out option);

                try
                {
                    Task <List <ActivityHistoryDTO> > t = MainUI.client.GetActivityHistory();
                    Console.WriteLine("please wait while we fetch your history of activities :)");
                    t.Wait();
                    if (t.Result != null)
                    {
                        List <object> lst  = t.Result.Take(option).ToList <object>();
                        ObjectsList   list = new ObjectsList(" ", lst);
                        list.Show();
                    }
                    else
                    {
                        Console.WriteLine("No data found!");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error with user logged in or " + e.InnerException);
                    Console.WriteLine("press any key to go back");
                    Console.ReadKey();
                    return;
                }


                Console.WriteLine();
                Console.WriteLine("would you like to search again?");
                Console.WriteLine("press enter to search again or any other key to go back");
                c = Console.ReadKey().KeyChar;
            }
        }