Esempio n. 1
0
        /// <summary>
        /// Gives the user the ability to rate an item and send the rating
        /// to AmphetaRate.
        /// </summary>
        /// <param name="rssFragment"></param>
        /// <param name="edited"></param>
        public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited)
        {
            if (this.UserID == null)
            {
                MessageBox.Show("You cannot submit a rating without a valid AmphetaRate user id. Please configure one.");
                return;
            }

            XPathNavigator navigator = rssFragment.CreateNavigator();

            string title = (string)navigator.Evaluate("string(//item/title/text())");
            string link  = (string)navigator.Evaluate("string(//item/link/text())");

            using (RatingForm form = new RatingForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    string url = String.Format("http://amphetarate.sourceforge.net/dinka-add-rating.php?rating={0}&title={1}&xmlurl={2}&desc={3}&link={4}&guid={5}&uid={6}&encoding={7}", form.SelectedRating, Encode(title), Encode(link), "", "", "", Encode(this.UserID), "unicode-entities");
                    //MessageBox.Show(url);
                    HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                    request.Method = "GET";
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        MessageBox.Show("An error occurred while submitting the rating. The server responded with " + response.StatusDescription + ".");
                    }
                }
            }
        }
Esempio n. 2
0
        public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited)
        {
            /* check to see if Windows Live Writer installed */
            if (!this.IsWriterInstalled)
            {
                throw new ApplicationException(Resource.Manager["RES_ExceptionLiveWriterNotFound"]);
            }

            /* instantiate Live Writer object */
            IWindowsLiveWriterApplication liveWriter = (IWindowsLiveWriterApplication) new WindowsLiveWriterApplicationClass();

            string title       = rssFragment.CreateNavigator().Evaluate("string(//item/title/text())").ToString();
            string description = rssFragment.CreateNavigator().Evaluate("string(//item/description/text())").ToString();
            string link        = rssFragment.CreateNavigator().Evaluate("string(//item/link/text())").ToString();
            string feedName    = rssFragment.CreateNavigator().Evaluate("string(//channel/title/text())").ToString();

            liveWriter.BlogThisFeedItem(feedName, title, link, description, String.Empty, String.Empty, String.Empty, String.Empty);
        }
Esempio n. 3
0
 public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited)
 {
     LaunchEmail(GetMailUrl(rssFragment.CreateNavigator()));
 }