Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter login:"******"Enter password:"******"Authorization error: " + e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine("Network error: " + e.Message);
            }
        }
Exemplo n.º 2
0
        private static void Run(VKHandler vkHandler)
        {
            while (true)
            {
                Console.WriteLine("Enter user name to write to this friend");
                Console.WriteLine("Enter \"friends\" to see friends list");
                Console.WriteLine("Enter \"exit\" to close program");
                var str = Console.ReadLine();
                switch (str)
                {
                case "friends":
                    vkHandler.WriteFriends();
                    break;

                case "exit":
                    Environment.Exit(0);
                    break;

                default:
                    try
                    {
                        var user = vkHandler.getUser(str);
                        Console.WriteLine("Enter message:");
                        str = Console.ReadLine();
                        vkHandler.SendMessage(user, str);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }

                    break;
                }
                Console.WriteLine();
            }
        }