Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C#

A Simple Solution to Some Problems with Asynchrony in Silverlight

Rate me:
Please Sign up or sign in to vote.
4.69/5 (8 votes)
9 Mar 2010CPOL15 min read 24.9K   128   25  
A small, extensible suite of classes that elegantly solve some common problems involving asynchrony and event handling that tend to occur when Silverlight and WCF are used together.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4016
//
//     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.40624.0
// 
namespace TaskManagerDemo.ExampleServiceReference {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="CityZipCode", Namespace="http://schemas.datacontract.org/2004/07/TaskManagerDemo.Web.DataContracts")]
    public partial class CityZipCode : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string CityField;
        
        private string ZipCodeField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string City {
            get {
                return this.CityField;
            }
            set {
                if ((object.ReferenceEquals(this.CityField, value) != true)) {
                    this.CityField = value;
                    this.RaisePropertyChanged("City");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string ZipCode {
            get {
                return this.ZipCodeField;
            }
            set {
                if ((object.ReferenceEquals(this.ZipCodeField, value) != true)) {
                    this.ZipCodeField = value;
                    this.RaisePropertyChanged("ZipCode");
                }
            }
        }
        
        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="ExampleServiceReference.IExampleService")]
    public interface IExampleService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IExampleService/GetAllCityZipCodes", ReplyAction="http://tempuri.org/IExampleService/GetAllCityZipCodesResponse")]
        System.IAsyncResult BeginGetAllCityZipCodes(System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetAllCityZipCodes(System.IAsyncResult result);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IExampleService/GetSelectedCities", ReplyAction="http://tempuri.org/IExampleService/GetSelectedCitiesResponse")]
        System.IAsyncResult BeginGetSelectedCities(int factor, System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetSelectedCities(System.IAsyncResult result);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IExampleService/GetSelectedZipCodes", ReplyAction="http://tempuri.org/IExampleService/GetSelectedZipCodesResponse")]
        System.IAsyncResult BeginGetSelectedZipCodes(int factor, System.AsyncCallback callback, object asyncState);
        
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetSelectedZipCodes(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IExampleServiceChannel : TaskManagerDemo.ExampleServiceReference.IExampleService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetAllCityZipCodesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetAllCityZipCodesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetSelectedCitiesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetSelectedCitiesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class GetSelectedZipCodesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetSelectedZipCodesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class ExampleServiceClient : System.ServiceModel.ClientBase<TaskManagerDemo.ExampleServiceReference.IExampleService>, TaskManagerDemo.ExampleServiceReference.IExampleService {
        
        private BeginOperationDelegate onBeginGetAllCityZipCodesDelegate;
        
        private EndOperationDelegate onEndGetAllCityZipCodesDelegate;
        
        private System.Threading.SendOrPostCallback onGetAllCityZipCodesCompletedDelegate;
        
        private BeginOperationDelegate onBeginGetSelectedCitiesDelegate;
        
        private EndOperationDelegate onEndGetSelectedCitiesDelegate;
        
        private System.Threading.SendOrPostCallback onGetSelectedCitiesCompletedDelegate;
        
        private BeginOperationDelegate onBeginGetSelectedZipCodesDelegate;
        
        private EndOperationDelegate onEndGetSelectedZipCodesDelegate;
        
        private System.Threading.SendOrPostCallback onGetSelectedZipCodesCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public ExampleServiceClient() {
        }
        
        public ExampleServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public ExampleServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ExampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ExampleServiceClient(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<GetAllCityZipCodesCompletedEventArgs> GetAllCityZipCodesCompleted;
        
        public event System.EventHandler<GetSelectedCitiesCompletedEventArgs> GetSelectedCitiesCompleted;
        
        public event System.EventHandler<GetSelectedZipCodesCompletedEventArgs> GetSelectedZipCodesCompleted;
        
        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 TaskManagerDemo.ExampleServiceReference.IExampleService.BeginGetAllCityZipCodes(System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetAllCityZipCodes(callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> TaskManagerDemo.ExampleServiceReference.IExampleService.EndGetAllCityZipCodes(System.IAsyncResult result) {
            return base.Channel.EndGetAllCityZipCodes(result);
        }
        
        private System.IAsyncResult OnBeginGetAllCityZipCodes(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).BeginGetAllCityZipCodes(callback, asyncState);
        }
        
        private object[] OnEndGetAllCityZipCodes(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> retVal = ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).EndGetAllCityZipCodes(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetAllCityZipCodesCompleted(object state) {
            if ((this.GetAllCityZipCodesCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetAllCityZipCodesCompleted(this, new GetAllCityZipCodesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetAllCityZipCodesAsync() {
            this.GetAllCityZipCodesAsync(null);
        }
        
        public void GetAllCityZipCodesAsync(object userState) {
            if ((this.onBeginGetAllCityZipCodesDelegate == null)) {
                this.onBeginGetAllCityZipCodesDelegate = new BeginOperationDelegate(this.OnBeginGetAllCityZipCodes);
            }
            if ((this.onEndGetAllCityZipCodesDelegate == null)) {
                this.onEndGetAllCityZipCodesDelegate = new EndOperationDelegate(this.OnEndGetAllCityZipCodes);
            }
            if ((this.onGetAllCityZipCodesCompletedDelegate == null)) {
                this.onGetAllCityZipCodesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetAllCityZipCodesCompleted);
            }
            base.InvokeAsync(this.onBeginGetAllCityZipCodesDelegate, null, this.onEndGetAllCityZipCodesDelegate, this.onGetAllCityZipCodesCompletedDelegate, userState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult TaskManagerDemo.ExampleServiceReference.IExampleService.BeginGetSelectedCities(int factor, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetSelectedCities(factor, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> TaskManagerDemo.ExampleServiceReference.IExampleService.EndGetSelectedCities(System.IAsyncResult result) {
            return base.Channel.EndGetSelectedCities(result);
        }
        
        private System.IAsyncResult OnBeginGetSelectedCities(object[] inValues, System.AsyncCallback callback, object asyncState) {
            int factor = ((int)(inValues[0]));
            return ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).BeginGetSelectedCities(factor, callback, asyncState);
        }
        
        private object[] OnEndGetSelectedCities(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> retVal = ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).EndGetSelectedCities(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetSelectedCitiesCompleted(object state) {
            if ((this.GetSelectedCitiesCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetSelectedCitiesCompleted(this, new GetSelectedCitiesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetSelectedCitiesAsync(int factor) {
            this.GetSelectedCitiesAsync(factor, null);
        }
        
        public void GetSelectedCitiesAsync(int factor, object userState) {
            if ((this.onBeginGetSelectedCitiesDelegate == null)) {
                this.onBeginGetSelectedCitiesDelegate = new BeginOperationDelegate(this.OnBeginGetSelectedCities);
            }
            if ((this.onEndGetSelectedCitiesDelegate == null)) {
                this.onEndGetSelectedCitiesDelegate = new EndOperationDelegate(this.OnEndGetSelectedCities);
            }
            if ((this.onGetSelectedCitiesCompletedDelegate == null)) {
                this.onGetSelectedCitiesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetSelectedCitiesCompleted);
            }
            base.InvokeAsync(this.onBeginGetSelectedCitiesDelegate, new object[] {
                        factor}, this.onEndGetSelectedCitiesDelegate, this.onGetSelectedCitiesCompletedDelegate, userState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult TaskManagerDemo.ExampleServiceReference.IExampleService.BeginGetSelectedZipCodes(int factor, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetSelectedZipCodes(factor, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> TaskManagerDemo.ExampleServiceReference.IExampleService.EndGetSelectedZipCodes(System.IAsyncResult result) {
            return base.Channel.EndGetSelectedZipCodes(result);
        }
        
        private System.IAsyncResult OnBeginGetSelectedZipCodes(object[] inValues, System.AsyncCallback callback, object asyncState) {
            int factor = ((int)(inValues[0]));
            return ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).BeginGetSelectedZipCodes(factor, callback, asyncState);
        }
        
        private object[] OnEndGetSelectedZipCodes(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> retVal = ((TaskManagerDemo.ExampleServiceReference.IExampleService)(this)).EndGetSelectedZipCodes(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetSelectedZipCodesCompleted(object state) {
            if ((this.GetSelectedZipCodesCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetSelectedZipCodesCompleted(this, new GetSelectedZipCodesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetSelectedZipCodesAsync(int factor) {
            this.GetSelectedZipCodesAsync(factor, null);
        }
        
        public void GetSelectedZipCodesAsync(int factor, object userState) {
            if ((this.onBeginGetSelectedZipCodesDelegate == null)) {
                this.onBeginGetSelectedZipCodesDelegate = new BeginOperationDelegate(this.OnBeginGetSelectedZipCodes);
            }
            if ((this.onEndGetSelectedZipCodesDelegate == null)) {
                this.onEndGetSelectedZipCodesDelegate = new EndOperationDelegate(this.OnEndGetSelectedZipCodes);
            }
            if ((this.onGetSelectedZipCodesCompletedDelegate == null)) {
                this.onGetSelectedZipCodesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetSelectedZipCodesCompleted);
            }
            base.InvokeAsync(this.onBeginGetSelectedZipCodesDelegate, new object[] {
                        factor}, this.onEndGetSelectedZipCodesDelegate, this.onGetSelectedZipCodesCompletedDelegate, 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 TaskManagerDemo.ExampleServiceReference.IExampleService CreateChannel() {
            return new ExampleServiceClientChannel(this);
        }
        
        private class ExampleServiceClientChannel : ChannelBase<TaskManagerDemo.ExampleServiceReference.IExampleService>, TaskManagerDemo.ExampleServiceReference.IExampleService {
            
            public ExampleServiceClientChannel(System.ServiceModel.ClientBase<TaskManagerDemo.ExampleServiceReference.IExampleService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetAllCityZipCodes(System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[0];
                System.IAsyncResult _result = base.BeginInvoke("GetAllCityZipCodes", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetAllCityZipCodes(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> _result = ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(base.EndInvoke("GetAllCityZipCodes", _args, result)));
                return _result;
            }
            
            public System.IAsyncResult BeginGetSelectedCities(int factor, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = factor;
                System.IAsyncResult _result = base.BeginInvoke("GetSelectedCities", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetSelectedCities(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> _result = ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(base.EndInvoke("GetSelectedCities", _args, result)));
                return _result;
            }
            
            public System.IAsyncResult BeginGetSelectedZipCodes(int factor, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = factor;
                System.IAsyncResult _result = base.BeginInvoke("GetSelectedZipCodes", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> EndGetSelectedZipCodes(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode> _result = ((System.Collections.ObjectModel.ObservableCollection<TaskManagerDemo.ExampleServiceReference.CityZipCode>)(base.EndInvoke("GetSelectedZipCodes", _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)


Written By
Software Developer (Senior) Concur
United States United States
George Henry has worked as a software developer for more than 20 years. He is currently employed by Concur in Bellevue, Washington, USA.

Comments and Discussions