Ejemplo n.º 1
0
        private void RequestContacts()
        {
            this.socket.NotNull <MessengerSocket, MessengerAuthenticationException>("Authenticate first");

            AddressBookRequest request  = new AddressBookRequest(this.Credentials["contacts.msn.com"].SecurityToken.Replace("&", "&amp;"), false);
            IList <Contact>    contacts = request.RequestContacts();

            this.Contacts = contacts;


            //#region Output

            //lock (Console.Out)
            //{
            //    ConsoleColor backup = Console.BackgroundColor;
            //    ConsoleColor backup1 = Console.ForegroundColor;
            //    Console.ForegroundColor = ConsoleColor.Black;
            //    int i = 0;
            //    string s = string.Empty;
            //    if (Console.WindowWidth - 127 >= 0)
            //    {
            //        s = new string(' ', Console.WindowWidth - 127);
            //    }

            //    foreach (Contact item in contacts)
            //    {
            //        Console.BackgroundColor = (i % 2) == 0 ? ConsoleColor.Yellow : ConsoleColor.Cyan;
            //        Console.WriteLine(string.Format("{0,3} {1,22} DP| {2,32} QN| {3,64} P| {4}", i++, Slack(item.DisplayName, 12), Slack(item.QuickName, 32), Slack(item.PassportName, 64), s));
            //    }
            //    Console.ForegroundColor = backup1;
            //    Console.BackgroundColor = backup;
            //}

            //#endregion
        }