//------------------------------------------------------------------------------
// <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.50401.0
// 
namespace SLAdvanced.LocalData.GeoDataService {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="ExposedGeoCity", Namespace="http://schemas.datacontract.org/2004/07/WebSamples.Services.ExposedEntities")]
    public partial class ExposedGeoCity : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string CityInformationField;
        
        private string CityNameField;
        
        private double DemographicInformationField;
        
        private double DistanceField;
        
        private double LatitudeField;
        
        private double LongitudeField;
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string CityInformation {
            get {
                return this.CityInformationField;
            }
            set {
                if ((object.ReferenceEquals(this.CityInformationField, value) != true)) {
                    this.CityInformationField = value;
                    this.RaisePropertyChanged("CityInformation");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public string CityName {
            get {
                return this.CityNameField;
            }
            set {
                if ((object.ReferenceEquals(this.CityNameField, value) != true)) {
                    this.CityNameField = value;
                    this.RaisePropertyChanged("CityName");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double DemographicInformation {
            get {
                return this.DemographicInformationField;
            }
            set {
                if ((this.DemographicInformationField.Equals(value) != true)) {
                    this.DemographicInformationField = value;
                    this.RaisePropertyChanged("DemographicInformation");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double Distance {
            get {
                return this.DistanceField;
            }
            set {
                if ((this.DistanceField.Equals(value) != true)) {
                    this.DistanceField = value;
                    this.RaisePropertyChanged("Distance");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double Latitude {
            get {
                return this.LatitudeField;
            }
            set {
                if ((this.LatitudeField.Equals(value) != true)) {
                    this.LatitudeField = value;
                    this.RaisePropertyChanged("Latitude");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute()]
        public double Longitude {
            get {
                return this.LongitudeField;
            }
            set {
                if ((this.LongitudeField.Equals(value) != true)) {
                    this.LongitudeField = value;
                    this.RaisePropertyChanged("Longitude");
                }
            }
        }
        
        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="", ConfigurationName="LocalData.GeoDataService.GeoCityExpositionService")]
    public interface GeoCityExpositionService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:GeoCityExpositionService/GetAllNearbyCities", ReplyAction="urn:GeoCityExpositionService/GetAllNearbyCitiesResponse")]
        System.IAsyncResult BeginGetAllNearbyCities(double lat, double lng, int radius, System.AsyncCallback callback, object asyncState);
        
        System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> EndGetAllNearbyCities(System.IAsyncResult result);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:GeoCityExpositionService/GetCitiesBounded", ReplyAction="urn:GeoCityExpositionService/GetCitiesBoundedResponse")]
        System.IAsyncResult BeginGetCitiesBounded(double topLeftLat, double topLeftLong, double botRightLat, double botRightLong, System.AsyncCallback callback, object asyncState);
        
        System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> EndGetCitiesBounded(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface GeoCityExpositionServiceChannel : SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetAllNearbyCitiesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetAllNearbyCitiesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetCitiesBoundedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetCitiesBoundedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GeoCityExpositionServiceClient : System.ServiceModel.ClientBase<SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService>, SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService {
        
        private BeginOperationDelegate onBeginGetAllNearbyCitiesDelegate;
        
        private EndOperationDelegate onEndGetAllNearbyCitiesDelegate;
        
        private System.Threading.SendOrPostCallback onGetAllNearbyCitiesCompletedDelegate;
        
        private BeginOperationDelegate onBeginGetCitiesBoundedDelegate;
        
        private EndOperationDelegate onEndGetCitiesBoundedDelegate;
        
        private System.Threading.SendOrPostCallback onGetCitiesBoundedCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public GeoCityExpositionServiceClient() {
        }
        
        public GeoCityExpositionServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public GeoCityExpositionServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public GeoCityExpositionServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public GeoCityExpositionServiceClient(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<GetAllNearbyCitiesCompletedEventArgs> GetAllNearbyCitiesCompleted;
        
        public event System.EventHandler<GetCitiesBoundedCompletedEventArgs> GetCitiesBoundedCompleted;
        
        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 SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService.BeginGetAllNearbyCities(double lat, double lng, int radius, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetAllNearbyCities(lat, lng, radius, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService.EndGetAllNearbyCities(System.IAsyncResult result) {
            return base.Channel.EndGetAllNearbyCities(result);
        }
        
        private System.IAsyncResult OnBeginGetAllNearbyCities(object[] inValues, System.AsyncCallback callback, object asyncState) {
            double lat = ((double)(inValues[0]));
            double lng = ((double)(inValues[1]));
            int radius = ((int)(inValues[2]));
            return ((SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService)(this)).BeginGetAllNearbyCities(lat, lng, radius, callback, asyncState);
        }
        
        private object[] OnEndGetAllNearbyCities(System.IAsyncResult result) {
            System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> retVal = ((SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService)(this)).EndGetAllNearbyCities(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetAllNearbyCitiesCompleted(object state) {
            if ((this.GetAllNearbyCitiesCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetAllNearbyCitiesCompleted(this, new GetAllNearbyCitiesCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetAllNearbyCitiesAsync(double lat, double lng, int radius) {
            this.GetAllNearbyCitiesAsync(lat, lng, radius, null);
        }
        
        public void GetAllNearbyCitiesAsync(double lat, double lng, int radius, object userState) {
            if ((this.onBeginGetAllNearbyCitiesDelegate == null)) {
                this.onBeginGetAllNearbyCitiesDelegate = new BeginOperationDelegate(this.OnBeginGetAllNearbyCities);
            }
            if ((this.onEndGetAllNearbyCitiesDelegate == null)) {
                this.onEndGetAllNearbyCitiesDelegate = new EndOperationDelegate(this.OnEndGetAllNearbyCities);
            }
            if ((this.onGetAllNearbyCitiesCompletedDelegate == null)) {
                this.onGetAllNearbyCitiesCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetAllNearbyCitiesCompleted);
            }
            base.InvokeAsync(this.onBeginGetAllNearbyCitiesDelegate, new object[] {
                        lat,
                        lng,
                        radius}, this.onEndGetAllNearbyCitiesDelegate, this.onGetAllNearbyCitiesCompletedDelegate, userState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.IAsyncResult SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService.BeginGetCitiesBounded(double topLeftLat, double topLeftLong, double botRightLat, double botRightLong, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetCitiesBounded(topLeftLat, topLeftLong, botRightLat, botRightLong, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService.EndGetCitiesBounded(System.IAsyncResult result) {
            return base.Channel.EndGetCitiesBounded(result);
        }
        
        private System.IAsyncResult OnBeginGetCitiesBounded(object[] inValues, System.AsyncCallback callback, object asyncState) {
            double topLeftLat = ((double)(inValues[0]));
            double topLeftLong = ((double)(inValues[1]));
            double botRightLat = ((double)(inValues[2]));
            double botRightLong = ((double)(inValues[3]));
            return ((SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService)(this)).BeginGetCitiesBounded(topLeftLat, topLeftLong, botRightLat, botRightLong, callback, asyncState);
        }
        
        private object[] OnEndGetCitiesBounded(System.IAsyncResult result) {
            System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> retVal = ((SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService)(this)).EndGetCitiesBounded(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetCitiesBoundedCompleted(object state) {
            if ((this.GetCitiesBoundedCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetCitiesBoundedCompleted(this, new GetCitiesBoundedCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetCitiesBoundedAsync(double topLeftLat, double topLeftLong, double botRightLat, double botRightLong) {
            this.GetCitiesBoundedAsync(topLeftLat, topLeftLong, botRightLat, botRightLong, null);
        }
        
        public void GetCitiesBoundedAsync(double topLeftLat, double topLeftLong, double botRightLat, double botRightLong, object userState) {
            if ((this.onBeginGetCitiesBoundedDelegate == null)) {
                this.onBeginGetCitiesBoundedDelegate = new BeginOperationDelegate(this.OnBeginGetCitiesBounded);
            }
            if ((this.onEndGetCitiesBoundedDelegate == null)) {
                this.onEndGetCitiesBoundedDelegate = new EndOperationDelegate(this.OnEndGetCitiesBounded);
            }
            if ((this.onGetCitiesBoundedCompletedDelegate == null)) {
                this.onGetCitiesBoundedCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCitiesBoundedCompleted);
            }
            base.InvokeAsync(this.onBeginGetCitiesBoundedDelegate, new object[] {
                        topLeftLat,
                        topLeftLong,
                        botRightLat,
                        botRightLong}, this.onEndGetCitiesBoundedDelegate, this.onGetCitiesBoundedCompletedDelegate, 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 SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService CreateChannel() {
            return new GeoCityExpositionServiceClientChannel(this);
        }
        
        private class GeoCityExpositionServiceClientChannel : ChannelBase<SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService>, SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService {
            
            public GeoCityExpositionServiceClientChannel(System.ServiceModel.ClientBase<SLAdvanced.LocalData.GeoDataService.GeoCityExpositionService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetAllNearbyCities(double lat, double lng, int radius, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[3];
                _args[0] = lat;
                _args[1] = lng;
                _args[2] = radius;
                System.IAsyncResult _result = base.BeginInvoke("GetAllNearbyCities", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> EndGetAllNearbyCities(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> _result = ((System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity>)(base.EndInvoke("GetAllNearbyCities", _args, result)));
                return _result;
            }
            
            public System.IAsyncResult BeginGetCitiesBounded(double topLeftLat, double topLeftLong, double botRightLat, double botRightLong, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[4];
                _args[0] = topLeftLat;
                _args[1] = topLeftLong;
                _args[2] = botRightLat;
                _args[3] = botRightLong;
                System.IAsyncResult _result = base.BeginInvoke("GetCitiesBounded", _args, callback, asyncState);
                return _result;
            }
            
            public System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> EndGetCitiesBounded(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity> _result = ((System.Collections.Generic.List<SLAdvanced.LocalData.GeoDataService.ExposedGeoCity>)(base.EndInvoke("GetCitiesBounded", _args, result)));
                return _result;
            }
        }
    }
}
