示例#1
0
        private List<Post> ParsePosts(XmlNodeList nodeList)
        {
            List<Post> posts = new List<Post> (nodeList.Count);

            foreach (XmlNode node in nodeList)
            {
                string href = node.Attributes[ Constants.XmlAttribute.Href ].Value;
                string description = node.Attributes[ Constants.XmlAttribute.Description ].Value;
                string hash = node.Attributes[ Constants.XmlAttribute.Hash ].Value;
                string tag = node.Attributes[ Constants.XmlAttribute.Tag ].Value;
                string time = node.Attributes[ Constants.XmlAttribute.Time ].Value;
                string extended = (node.Attributes[ Constants.XmlAttribute.Extended ] == null) ? String.Empty : node.Attributes[ Constants.XmlAttribute.Extended ].Value;
                bool shared = true;
                if (node.Attributes[ Constants.XmlAttribute.Shared ] != null)
                    shared = (node.Attributes[ Constants.XmlAttribute.Shared ].Value != Constants.UrlParameter.No);

                Post post = new Post (href, description, hash, tag, time, extended, shared);
                posts.Add (post);
            }
            return posts;
        }
    /// <summary>
    /// Show posts added today from logged in user's account
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ShowTodaysPosts(object sender, EventArgs e)
    {
        try
        {
            IList<DeliciousOAuth.Post> oAuthResult = new DeliciousOAuth.Post(delOAuth).Get(DateTime.Today);

            gridPosts.DataSource = oAuthResult;
            gridPosts.DataBind();
            gridPosts.Visible = true;
        }
        catch (Exception exp)
        {
            txtOutput.Text += "\nException: " + exp.Message;
        }
    }