/// <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 + "."); } } } }
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); }
/// <summary> /// Blogs the item. /// </summary> /// <param name="rssFragment">RSS fragment.</param> /// <param name="edited">Edited.</param> public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited) { if (!IsBloggarInstalled) { throw new ApplicationException("No registry setting for w.bloggar located. Please install w.bloggar from http://www.wbloggar.com to get this feature to work"); } string wbloggarPath = ((string)BloggarRegistryKey.GetValue("InstallPath")); XslTransform transform = new XslTransform(); transform.Load(new XmlTextReader(XsltStream), null, null); string tempfile = Path.GetTempFileName(); transform.Transform(rssFragment, null, new StreamWriter(tempfile), null); Process.Start(wbloggarPath + @"\wbloggar.exe", tempfile); }
public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited) { /* check to see if w::bloggar installed */ RegistryKey rkey; rkey = Registry.CurrentUser.OpenSubKey(@"Software\VB and VBA Program Settings\Bloggar"); if (rkey == null) { throw new ApplicationException(Resource.Manager["RES_ExceptionWBloggarNotFound"]); } string wbloggarPath = ((string)rkey.GetValue("InstallPath")); XslTransform transform = new XslTransform(); transform.Load(new XmlTextReader(new StringReader(styleSheet))); string tempfile = Path.GetTempFileName(); transform.Transform(rssFragment, null, new StreamWriter(tempfile)); Process.Start(wbloggarPath + @"\wbloggar.exe", tempfile); }
public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited) { LaunchEmail(GetMailUrl(rssFragment.CreateNavigator())); }