Ejemplo n.º 1
0
        public DataTable GetContactsNames()
        {
            OAuth2Parameters parameters = new OAuth2Parameters();

            parameters.AccessToken  = credential.Token.AccessToken;
            parameters.RefreshToken = credential.Token.RefreshToken;

            RequestSettings settings = new RequestSettings(ApplicationName, parameters);
            ContactsRequest cr       = new ContactsRequest(settings);

            Nameday   nday      = new Nameday();
            DataTable dataTable = new DataTable();

            DataColumn dataCol = dataTable.Columns.Add("Jmeno", typeof(string));

            dataCol.AllowDBNull = false;
            dataCol.Unique      = true;

            dataCol          = dataTable.Columns.Add("Datum", typeof(string));
            dataCol.ReadOnly = true;

            Feed <Contact> f = cr.GetContacts();

            foreach (Contact entry in f.Entries)
            {
                if (entry.Name != null)
                {
                    Name name = entry.Name;
                    if (!string.IsNullOrEmpty(name.GivenName))
                    {
                        Console.WriteLine("\t\t" + name.GivenName);
                        dataTable.Rows.Add(new Object[] { name.GivenName, nday.GetDate(name.GivenName) });
                    }
                    else
                    {
                        Console.WriteLine("\t\t (no given name found)");
                    }
                }
                else
                {
                    Console.WriteLine("\t (no name found)");
                }
            }
            return(dataTable);
        }
Ejemplo n.º 2
0
 private void input_TextChanged(object sender, TextChangedEventArgs e)
 {
     label.Content = nday.GetDate(input.Text);
 }