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

A Simple Silverlight RSS Reader

, 21 Jun 2010
This is a simple Silverlight RSS Reader which pulls out data from a feed URL.
RSSReader.zip
RSSReader
RSSReader.suo
RSSReader.Web
App_Data
bin
RSSReader.dll
RSSReader.pdb
RSSReader.Web.dll
RSSReader.Web.pdb
System.Windows.Controls.Theming.Toolkit.dll
System.Windows.Controls.Theming.TwilightBlue.dll
ClientBin
RSSReader.xap
Properties
RSSReader.Web.csproj.user
RSSReaderService.svc
RSSReader
Bin
Debug
de
es
fr
Images
it
ja
ko
RSSReader.dll
RSSReader.xap
System.Windows.Controls.Theming.Toolkit.dll
System.Windows.Controls.Theming.TwilightBlue.dll
zh-Hans
zh-Hant
Properties
RSSReader.csproj.user
RSSReader.suo
Service References
RSSService
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
RSSReader.RSSService.RSSItem.datasource
RSSReaderService.disco
RSSReaderService.wsdl
ServiceReferences.ClientConfig
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 3.0.40818.0
// 
namespace RSSReader.RSSService {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="RSSItem", Namespace="http://schemas.datacontract.org/2004/07/RSSReader.Web")]
    public partial class RSSItem : object, System.ComponentModel.INotifyPropertyChanged {
        
        private System.Uri PermalinkField;
        
        private string PublishDateField;
        
        private string SummaryField;
        
        private string TitleField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public System.Uri Permalink {
            get {
                return this.PermalinkField;
            }
            set {
                if ((object.ReferenceEquals(this.PermalinkField, value) != true)) {
                    this.PermalinkField = value;
                    this.RaisePropertyChanged("Permalink");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string PublishDate {
            get {
                return this.PublishDateField;
            }
            set {
                if ((object.ReferenceEquals(this.PublishDateField, value) != true)) {
                    this.PublishDateField = value;
                    this.RaisePropertyChanged("PublishDate");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Summary {
            get {
                return this.SummaryField;
            }
            set {
                if ((object.ReferenceEquals(this.SummaryField, value) != true)) {
                    this.SummaryField = value;
                    this.RaisePropertyChanged("Summary");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string Title {
            get {
                return this.TitleField;
            }
            set {
                if ((object.ReferenceEquals(this.TitleField, value) != true)) {
                    this.TitleField = value;
                    this.RaisePropertyChanged("Title");
                }
            }
        }
        
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        
        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="RSSService.IRSSReaderService")]
    public interface IRSSReaderService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IRSSReaderService/GetFeed", ReplyAction="http://tempuri.org/IRSSReaderService/GetFeedResponse")]
        System.IAsyncResult BeginGetFeed(string uri, System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> EndGetFeed(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IRSSReaderServiceChannel : RSSReader.RSSService.IRSSReaderService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetFeedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetFeedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class RSSReaderServiceClient : System.ServiceModel.ClientBase<RSSReader.RSSService.IRSSReaderService>, RSSReader.RSSService.IRSSReaderService {
        
        private BeginOperationDelegate onBeginGetFeedDelegate;
        
        private EndOperationDelegate onEndGetFeedDelegate;
        
        private System.Threading.SendOrPostCallback onGetFeedCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public RSSReaderServiceClient() {
        }
        
        public RSSReaderServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public RSSReaderServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public RSSReaderServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public RSSReaderServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public System.Net.CookieContainer CookieContainer {
            get {
                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
                if ((httpCookieContainerManager != null)) {
                    return httpCookieContainerManager.CookieContainer;
                }
                else {
                    return null;
                }
            }
            set {
                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
                if ((httpCookieContainerManager != null)) {
                    httpCookieContainerManager.CookieContainer = value;
                }
                else {
                    throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
                            "ookieContainerBindingElement.");
                }
            }
        }
        
        public event System.EventHandler<GetFeedCompletedEventArgs> GetFeedCompleted;
        
        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
        
        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult RSSReader.RSSService.IRSSReaderService.BeginGetFeed(string uri, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetFeed(uri, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> RSSReader.RSSService.IRSSReaderService.EndGetFeed(System.IAsyncResult result) {
            return base.Channel.EndGetFeed(result);
        }
        
        private System.IAsyncResult OnBeginGetFeed(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string uri = ((string)(inValues[0]));
            return ((RSSReader.RSSService.IRSSReaderService)(this)).BeginGetFeed(uri, callback, asyncState);
        }
        
        private object[] OnEndGetFeed(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> retVal = ((RSSReader.RSSService.IRSSReaderService)(this)).EndGetFeed(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetFeedCompleted(object state) {
            if ((this.GetFeedCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetFeedCompleted(this, new GetFeedCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetFeedAsync(string uri) {
            this.GetFeedAsync(uri, null);
        }
        
        public void GetFeedAsync(string uri, object userState) {
            if ((this.onBeginGetFeedDelegate == null)) {
                this.onBeginGetFeedDelegate = new BeginOperationDelegate(this.OnBeginGetFeed);
            }
            if ((this.onEndGetFeedDelegate == null)) {
                this.onEndGetFeedDelegate = new EndOperationDelegate(this.OnEndGetFeed);
            }
            if ((this.onGetFeedCompletedDelegate == null)) {
                this.onGetFeedCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetFeedCompleted);
            }
            base.InvokeAsync(this.onBeginGetFeedDelegate, new object[] {
                        uri}, this.onEndGetFeedDelegate, this.onGetFeedCompletedDelegate, userState);
        }
        
        private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
        }
        
        private object[] OnEndOpen(System.IAsyncResult result) {
            ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
            return null;
        }
        
        private void OnOpenCompleted(object state) {
            if ((this.OpenCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void OpenAsync() {
            this.OpenAsync(null);
        }
        
        public void OpenAsync(object userState) {
            if ((this.onBeginOpenDelegate == null)) {
                this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
            }
            if ((this.onEndOpenDelegate == null)) {
                this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
            }
            if ((this.onOpenCompletedDelegate == null)) {
                this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
            }
            base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
        }
        
        private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
        }
        
        private object[] OnEndClose(System.IAsyncResult result) {
            ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
            return null;
        }
        
        private void OnCloseCompleted(object state) {
            if ((this.CloseCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void CloseAsync() {
            this.CloseAsync(null);
        }
        
        public void CloseAsync(object userState) {
            if ((this.onBeginCloseDelegate == null)) {
                this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
            }
            if ((this.onEndCloseDelegate == null)) {
                this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
            }
            if ((this.onCloseCompletedDelegate == null)) {
                this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
            }
            base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
        }
        
        protected override RSSReader.RSSService.IRSSReaderService CreateChannel() {
            return new RSSReaderServiceClientChannel(this);
        }
        
        private class RSSReaderServiceClientChannel : ChannelBase<RSSReader.RSSService.IRSSReaderService>, RSSReader.RSSService.IRSSReaderService {
            
            public RSSReaderServiceClientChannel(System.ServiceModel.ClientBase<RSSReader.RSSService.IRSSReaderService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetFeed(string uri, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = uri;
                System.IAsyncResult _result = base.BeginInvoke("GetFeed", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> EndGetFeed(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem> _result = ((System.Collections.ObjectModel.ObservableCollection<RSSReader.RSSService.RSSItem>)(base.EndInvoke("GetFeed", _args, result)));
                return _result;
            }
        }
    }
}

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

Arun Jacob
Software Developer Tata Consultancy Services
India India
I have been working in different .NET Technologies like ASP.NET,WPF,Silverlight for the last few years.I am enjoying my life as a Programmer and spending time with my Family,Friends & Camera.
 
My Technical Blog


My Photo Blog


| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 22 Jun 2010
Article Copyright 2010 by Arun Jacob
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid