Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

RSS Feed Aggregator and Blogging Smart Client

, 16 Aug 2005 CPOL
RSS Feed aggregator and blogging Smart Client which uses Enterprise Library, Updater Application Block, lots of XML hacks and desktop tricks. A comprehensive guide to real life hurdles of Smart Client development.
rssfeeder_src.zip
RSSFeeder
RSSBlogAPI
RSSBlogAPI.csproj.user
Web References
CommunityServer
blogservice.disco
blogservice.wsdl
Reference.map
DotText
Reference.map
simpleblogservice.disco
simpleblogservice.wsdl
RSSCommon
Helper
PropertyEditor
RSSCommon.csproj.user
RSSFeeder
Controls
docs
dropshadow.png
My Pic 7.jpg
WIndows98.jpg
Helpers
Resources
E-mail.ico
rss.ico
RSSFeeder.mdb
RSSFeeder.csproj.user
RSSStarter.exe
RSSFeederResources
PublicQueue.ico
RSSFeeder.mdb
RSSFeederResources.csproj.user
RSSFeederSetup
Messages.ico
RSSFeederSetup.vdproj
Test
RSSStarter
DummyForm.frm
DummyForm.frx
MainModule.bas
RSSStarter.exe
RSSStarter.vbp
RSSStarter.vbw
RSSTests
App.ico
RSSTests.csproj.user
Thirdparty
AxInterop.DHTMLEDLib.dll
AxInterop.SHDocVw.dll
Eyefinder.dll
GotDotNet.Exslt.dll
HttpDownloader.dll
Interop.DHTMLEDLib.dll
Interop.SHDocVw.dll
Interop.WindowsInstaller.dll
Microsoft.ApplicationBlocks.Updater.ActivationProcessors.dll
Microsoft.ApplicationBlocks.Updater.dll
Microsoft.ApplicationBlocks.Updater.Downloaders.dll
Microsoft.Practices.EnterpriseLibrary.Caching.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Configuration.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.dll
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll
Microsoft.Practices.EnterpriseLibrary.Security.dll
NotifyIconBalloon.dll
SandBar.dll
SandDock.dll
SgmlReaderDll.dll
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace RSSBlogAPI
{
	/// <summary>
	/// Summary description for WebLogViewControl.
	/// </summary>
	public class WebLogViewControl : System.Windows.Forms.UserControl
	{
		#region Designer

		private System.Windows.Forms.Panel bottomPanel;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.Panel topPanel;
		private System.Windows.Forms.PropertyGrid propertyGrid;
		private System.Windows.Forms.ListView postListView;
		private System.Windows.Forms.ColumnHeader titleColumn;
		private System.Windows.Forms.ColumnHeader statusColumn;
		private System.Windows.Forms.ImageList viewImages;
		private System.Windows.Forms.ColumnHeader dateColumn;
		private System.ComponentModel.IContainer components;

		public WebLogViewControl( WebLog log )
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitializeComponent call

			this._WebLog = log;
			this._WebLog.PropertyChanged += new PropertyChangedEventHandler(_WebLog_PropertyChanged);
		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(WebLogViewControl));
			this.bottomPanel = new System.Windows.Forms.Panel();
			this.propertyGrid = new System.Windows.Forms.PropertyGrid();
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.topPanel = new System.Windows.Forms.Panel();
			this.postListView = new System.Windows.Forms.ListView();
			this.titleColumn = new System.Windows.Forms.ColumnHeader();
			this.statusColumn = new System.Windows.Forms.ColumnHeader();
			this.dateColumn = new System.Windows.Forms.ColumnHeader();
			this.viewImages = new System.Windows.Forms.ImageList(this.components);
			this.bottomPanel.SuspendLayout();
			this.topPanel.SuspendLayout();
			this.SuspendLayout();
			// 
			// bottomPanel
			// 
			this.bottomPanel.Controls.Add(this.propertyGrid);
			this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.bottomPanel.Location = new System.Drawing.Point(0, 168);
			this.bottomPanel.Name = "bottomPanel";
			this.bottomPanel.Size = new System.Drawing.Size(150, 192);
			this.bottomPanel.TabIndex = 0;
			// 
			// propertyGrid
			// 
			this.propertyGrid.CommandsVisibleIfAvailable = true;
			this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
			this.propertyGrid.LargeButtons = false;
			this.propertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar;
			this.propertyGrid.Location = new System.Drawing.Point(0, 0);
			this.propertyGrid.Name = "propertyGrid";
			this.propertyGrid.Size = new System.Drawing.Size(150, 192);
			this.propertyGrid.TabIndex = 1;
			this.propertyGrid.Text = "propertyGrid1";
			this.propertyGrid.ViewBackColor = System.Drawing.SystemColors.Window;
			this.propertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText;
			this.propertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid_PropertyValueChanged);
			// 
			// splitter1
			// 
			this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.splitter1.Location = new System.Drawing.Point(0, 165);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(150, 3);
			this.splitter1.TabIndex = 1;
			this.splitter1.TabStop = false;
			// 
			// topPanel
			// 
			this.topPanel.BackColor = System.Drawing.Color.White;
			this.topPanel.Controls.Add(this.postListView);
			this.topPanel.Dock = System.Windows.Forms.DockStyle.Fill;
			this.topPanel.Location = new System.Drawing.Point(0, 0);
			this.topPanel.Name = "topPanel";
			this.topPanel.Size = new System.Drawing.Size(150, 165);
			this.topPanel.TabIndex = 2;
			// 
			// postListView
			// 
			this.postListView.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.postListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						   this.titleColumn,
																						   this.statusColumn,
																						   this.dateColumn});
			this.postListView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.postListView.FullRowSelect = true;
			this.postListView.GridLines = true;
			this.postListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
			this.postListView.HideSelection = false;
			this.postListView.Location = new System.Drawing.Point(0, 0);
			this.postListView.MultiSelect = false;
			this.postListView.Name = "postListView";
			this.postListView.Size = new System.Drawing.Size(150, 165);
			this.postListView.SmallImageList = this.viewImages;
			this.postListView.TabIndex = 0;
			this.postListView.View = System.Windows.Forms.View.Details;
			this.postListView.SelectedIndexChanged += new System.EventHandler(this.postListView_SelectedIndexChanged);
			// 
			// titleColumn
			// 
			this.titleColumn.Text = "Title";
			this.titleColumn.Width = 105;
			// 
			// statusColumn
			// 
			this.statusColumn.Text = "Status";
			this.statusColumn.Width = 45;
			// 
			// dateColumn
			// 
			this.dateColumn.Text = "Date";
			// 
			// viewImages
			// 
			this.viewImages.ImageSize = new System.Drawing.Size(16, 16);
			this.viewImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("viewImages.ImageStream")));
			this.viewImages.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// WebLogViewControl
			// 
			this.Controls.Add(this.topPanel);
			this.Controls.Add(this.splitter1);
			this.Controls.Add(this.bottomPanel);
			this.Name = "WebLogViewControl";
			this.Size = new System.Drawing.Size(150, 360);
			this.Load += new System.EventHandler(this.WebLogViewControl_Load);
			this.bottomPanel.ResumeLayout(false);
			this.topPanel.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#endregion

		#region My Code

		private WebLog _WebLog;

		public event EventHandler OnPostSelect;

		public event EventHandler OnPostDelete;

		public Post SelectedPost
		{
			get
			{
				if( 0 == this.postListView.SelectedItems.Count ) return null;
				else return (this.postListView.SelectedItems[0] as PostListViewItem).Post;				
			}
		}

		public void DeleteSelectedPost()
		{
			if( null != this.SelectedPost )
				this._WebLog.Posts.Remove( this.SelectedPost );

			WebLogProvider.SaveWebLogs();

			this.ReloadPosts( null );

			if( null != OnPostDelete ) OnPostDelete( this, EventArgs.Empty );
		}

		private void WebLogViewControl_Load(object sender, System.EventArgs e)
		{
			this.ShowWebLog();
		}

		private void ShowWebLog()
		{
			this.LoadPosts();
			this.ShowProperties();
		}

		private void LoadPosts()
		{
			this.postListView.Items.Clear();
			foreach( Post post in this._WebLog.Posts )
			{
				this.postListView.Items.Add( new PostListViewItem( post ) );
			}
		}

		public void ReloadPosts(Post selectedPost)
		{
			this.LoadPosts();

			if( null != selectedPost )
			{
				// select the item in the list view which contains the specified post
				this.postListView.SelectedItems.Clear();
				foreach( PostListViewItem item in this.postListView.Items )
				{
					if( item.Post == selectedPost ) item.Selected = true;
				}
			}

			// If no item was selected, at least select the first item if any
			if( 0 == this.postListView.SelectedItems.Count )
				if( 0 != this.postListView.Items.Count )
					this.postListView.Items[0].Selected = true;
		}

		private void ShowProperties()
		{
			this.propertyGrid.SelectedObject = this._WebLog;
		}

		private void _WebLog_PropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			this.ShowWebLog();
		}

		private void propertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e)
		{
			WebLogProvider.SaveWebLogs();
		}

		private void postListView_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if( null != OnPostSelect ) OnPostSelect( this, e );	
		}

		private class PostListViewItem : ListViewItem
		{
			public Post Post;
			public PostListViewItem( Post post ) : base( post.Title )
			{
				this.Post = post;
				if( null != post.ErrorInPost && post.ErrorInPost.Length > 0 )
				{
					base.SubItems.Add( "Error" );
					base.ImageIndex = 3;
				}
				else if( post.IsSend && !post.IsSent )
				{
					base.SubItems.Add( "Queued" );
					base.ImageIndex = 1;
				}
				else if( post.IsSent && !post.IsSend )
				{
					base.ForeColor = Color.Gray;
					base.SubItems.Add( "Sent" );
					base.ImageIndex = 2;
				}
				else
				{
					base.SubItems.Add( "Draft" );
					base.ImageIndex = 0;
				}

				base.SubItems.Add( post.Date.ToString() );

			}
		}

		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Omar Al Zabir
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411028.1 | Last Updated 16 Aug 2005
Article Copyright 2005 by Omar Al Zabir
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid