Click here to Skip to main content
15,897,371 members
Articles / Programming Languages / C# 4.0

Silverlight Report Viewer using View Model (MVVM)

Rate me:
Please Sign up or sign in to vote.
4.88/5 (20 votes)
13 Dec 2011Ms-PL3 min read 153.1K   6.2K   68  
Viewing .rdlc reports from Silverlight using View Model (MVVM)
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     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 4.0.50826.0
// 
namespace SimpleConfigurator.Peoplews {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="Person", Namespace="http://OpenLightGroup.net/")]
    public partial class Person : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string NameField;
        
        private string DescriptionField;
        
        private string GenderField;
        
        private int AgeField;
        
        private int WeightField;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string Name {
            get {
                return this.NameField;
            }
            set {
                if ((object.ReferenceEquals(this.NameField, value) != true)) {
                    this.NameField = value;
                    this.RaisePropertyChanged("Name");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string Description {
            get {
                return this.DescriptionField;
            }
            set {
                if ((object.ReferenceEquals(this.DescriptionField, value) != true)) {
                    this.DescriptionField = value;
                    this.RaisePropertyChanged("Description");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public string Gender {
            get {
                return this.GenderField;
            }
            set {
                if ((object.ReferenceEquals(this.GenderField, value) != true)) {
                    this.GenderField = value;
                    this.RaisePropertyChanged("Gender");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=3)]
        public int Age {
            get {
                return this.AgeField;
            }
            set {
                if ((this.AgeField.Equals(value) != true)) {
                    this.AgeField = value;
                    this.RaisePropertyChanged("Age");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=4)]
        public int Weight {
            get {
                return this.WeightField;
            }
            set {
                if ((this.WeightField.Equals(value) != true)) {
                    this.WeightField = value;
                    this.RaisePropertyChanged("Weight");
                }
            }
        }
        
        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", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="http://OpenLightGroup.net/", ConfigurationName="Peoplews.WebServiceSoap")]
    public interface WebServiceSoap {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://OpenLightGroup.net/SearchPeople", ReplyAction="*")]
        System.IAsyncResult BeginSearchPeople(SimpleConfigurator.Peoplews.SearchPeopleRequest request, System.AsyncCallback callback, object asyncState);
        
        SimpleConfigurator.Peoplews.SearchPeopleResponse EndSearchPeople(System.IAsyncResult result);
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class SearchPeopleRequest {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="SearchPeople", Namespace="http://OpenLightGroup.net/", Order=0)]
        public SimpleConfigurator.Peoplews.SearchPeopleRequestBody Body;
        
        public SearchPeopleRequest() {
        }
        
        public SearchPeopleRequest(SimpleConfigurator.Peoplews.SearchPeopleRequestBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://OpenLightGroup.net/")]
    public partial class SearchPeopleRequestBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string Gender;
        
        [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
        public int AgeHigh;
        
        [System.Runtime.Serialization.DataMemberAttribute(Order=2)]
        public int AgeLow;
        
        [System.Runtime.Serialization.DataMemberAttribute(Order=3)]
        public int WeightHigh;
        
        [System.Runtime.Serialization.DataMemberAttribute(Order=4)]
        public int WeightLow;
        
        public SearchPeopleRequestBody() {
        }
        
        public SearchPeopleRequestBody(string Gender, int AgeHigh, int AgeLow, int WeightHigh, int WeightLow) {
            this.Gender = Gender;
            this.AgeHigh = AgeHigh;
            this.AgeLow = AgeLow;
            this.WeightHigh = WeightHigh;
            this.WeightLow = WeightLow;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class SearchPeopleResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="SearchPeopleResponse", Namespace="http://OpenLightGroup.net/", Order=0)]
        public SimpleConfigurator.Peoplews.SearchPeopleResponseBody Body;
        
        public SearchPeopleResponse() {
        }
        
        public SearchPeopleResponse(SimpleConfigurator.Peoplews.SearchPeopleResponseBody Body) {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://OpenLightGroup.net/")]
    public partial class SearchPeopleResponseBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person> SearchPeopleResult;
        
        public SearchPeopleResponseBody() {
        }
        
        public SearchPeopleResponseBody(System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person> SearchPeopleResult) {
            this.SearchPeopleResult = SearchPeopleResult;
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface WebServiceSoapChannel : SimpleConfigurator.Peoplews.WebServiceSoap, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class SearchPeopleCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public SearchPeopleCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class WebServiceSoapClient : System.ServiceModel.ClientBase<SimpleConfigurator.Peoplews.WebServiceSoap>, SimpleConfigurator.Peoplews.WebServiceSoap {
        
        private BeginOperationDelegate onBeginSearchPeopleDelegate;
        
        private EndOperationDelegate onEndSearchPeopleDelegate;
        
        private System.Threading.SendOrPostCallback onSearchPeopleCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public WebServiceSoapClient() {
        }
        
        public WebServiceSoapClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public WebServiceSoapClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public WebServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public WebServiceSoapClient(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<SearchPeopleCompletedEventArgs> SearchPeopleCompleted;
        
        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 SimpleConfigurator.Peoplews.WebServiceSoap.BeginSearchPeople(SimpleConfigurator.Peoplews.SearchPeopleRequest request, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginSearchPeople(request, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.IAsyncResult BeginSearchPeople(string Gender, int AgeHigh, int AgeLow, int WeightHigh, int WeightLow, System.AsyncCallback callback, object asyncState) {
            SimpleConfigurator.Peoplews.SearchPeopleRequest inValue = new SimpleConfigurator.Peoplews.SearchPeopleRequest();
            inValue.Body = new SimpleConfigurator.Peoplews.SearchPeopleRequestBody();
            inValue.Body.Gender = Gender;
            inValue.Body.AgeHigh = AgeHigh;
            inValue.Body.AgeLow = AgeLow;
            inValue.Body.WeightHigh = WeightHigh;
            inValue.Body.WeightLow = WeightLow;
            return ((SimpleConfigurator.Peoplews.WebServiceSoap)(this)).BeginSearchPeople(inValue, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        SimpleConfigurator.Peoplews.SearchPeopleResponse SimpleConfigurator.Peoplews.WebServiceSoap.EndSearchPeople(System.IAsyncResult result) {
            return base.Channel.EndSearchPeople(result);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person> EndSearchPeople(System.IAsyncResult result) {
            SimpleConfigurator.Peoplews.SearchPeopleResponse retVal = ((SimpleConfigurator.Peoplews.WebServiceSoap)(this)).EndSearchPeople(result);
            return retVal.Body.SearchPeopleResult;
        }
        
        private System.IAsyncResult OnBeginSearchPeople(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string Gender = ((string)(inValues[0]));
            int AgeHigh = ((int)(inValues[1]));
            int AgeLow = ((int)(inValues[2]));
            int WeightHigh = ((int)(inValues[3]));
            int WeightLow = ((int)(inValues[4]));
            return this.BeginSearchPeople(Gender, AgeHigh, AgeLow, WeightHigh, WeightLow, callback, asyncState);
        }
        
        private object[] OnEndSearchPeople(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<SimpleConfigurator.Peoplews.Person> retVal = this.EndSearchPeople(result);
            return new object[] {
                    retVal};
        }
        
        private void OnSearchPeopleCompleted(object state) {
            if ((this.SearchPeopleCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.SearchPeopleCompleted(this, new SearchPeopleCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void SearchPeopleAsync(string Gender, int AgeHigh, int AgeLow, int WeightHigh, int WeightLow) {
            this.SearchPeopleAsync(Gender, AgeHigh, AgeLow, WeightHigh, WeightLow, null);
        }
        
        public void SearchPeopleAsync(string Gender, int AgeHigh, int AgeLow, int WeightHigh, int WeightLow, object userState) {
            if ((this.onBeginSearchPeopleDelegate == null)) {
                this.onBeginSearchPeopleDelegate = new BeginOperationDelegate(this.OnBeginSearchPeople);
            }
            if ((this.onEndSearchPeopleDelegate == null)) {
                this.onEndSearchPeopleDelegate = new EndOperationDelegate(this.OnEndSearchPeople);
            }
            if ((this.onSearchPeopleCompletedDelegate == null)) {
                this.onSearchPeopleCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnSearchPeopleCompleted);
            }
            base.InvokeAsync(this.onBeginSearchPeopleDelegate, new object[] {
                        Gender,
                        AgeHigh,
                        AgeLow,
                        WeightHigh,
                        WeightLow}, this.onEndSearchPeopleDelegate, this.onSearchPeopleCompletedDelegate, 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 SimpleConfigurator.Peoplews.WebServiceSoap CreateChannel() {
            return new WebServiceSoapClientChannel(this);
        }
        
        private class WebServiceSoapClientChannel : ChannelBase<SimpleConfigurator.Peoplews.WebServiceSoap>, SimpleConfigurator.Peoplews.WebServiceSoap {
            
            public WebServiceSoapClientChannel(System.ServiceModel.ClientBase<SimpleConfigurator.Peoplews.WebServiceSoap> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginSearchPeople(SimpleConfigurator.Peoplews.SearchPeopleRequest request, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = request;
                System.IAsyncResult _result = base.BeginInvoke("SearchPeople", _args, callback, asyncState);
                return _result;
            }
            
            public SimpleConfigurator.Peoplews.SearchPeopleResponse EndSearchPeople(System.IAsyncResult result) {
                object[] _args = new object[0];
                SimpleConfigurator.Peoplews.SearchPeopleResponse _result = ((SimpleConfigurator.Peoplews.SearchPeopleResponse)(base.EndInvoke("SearchPeople", _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 Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior) http://ADefWebserver.com
United States United States
Michael Washington is a Microsoft MVP. He is a ASP.NET and
C# programmer.
He is the founder of
AiHelpWebsite.com,
LightSwitchHelpWebsite.com, and
HoloLensHelpWebsite.com.

He has a son, Zachary and resides in Los Angeles with his wife Valerie.

He is the Author of:

Comments and Discussions