//------------------------------------------------------------------------------
// <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 Olympics.WSData {
    using System.Runtime.Serialization;
    
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="CountryInfo", Namespace="http://tempuri.org/")]
    public partial class CountryInfo : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string CountryNameField;
        
        private int GoldMedalsField;
        
        private int SilverMedalsField;
        
        private int BronzeMedalsField;
        
        private string FlagUrlField;
        
        private double LatitudeField;
        
        private double LongitudeField;
        
        private int TotalMedalsField;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string CountryName {
            get {
                return this.CountryNameField;
            }
            set {
                if ((object.ReferenceEquals(this.CountryNameField, value) != true)) {
                    this.CountryNameField = value;
                    this.RaisePropertyChanged("CountryName");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
        public int GoldMedals {
            get {
                return this.GoldMedalsField;
            }
            set {
                if ((this.GoldMedalsField.Equals(value) != true)) {
                    this.GoldMedalsField = value;
                    this.RaisePropertyChanged("GoldMedals");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
        public int SilverMedals {
            get {
                return this.SilverMedalsField;
            }
            set {
                if ((this.SilverMedalsField.Equals(value) != true)) {
                    this.SilverMedalsField = value;
                    this.RaisePropertyChanged("SilverMedals");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=3)]
        public int BronzeMedals {
            get {
                return this.BronzeMedalsField;
            }
            set {
                if ((this.BronzeMedalsField.Equals(value) != true)) {
                    this.BronzeMedalsField = value;
                    this.RaisePropertyChanged("BronzeMedals");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=4)]
        public string FlagUrl {
            get {
                return this.FlagUrlField;
            }
            set {
                if ((object.ReferenceEquals(this.FlagUrlField, value) != true)) {
                    this.FlagUrlField = value;
                    this.RaisePropertyChanged("FlagUrl");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=5)]
        public double Latitude {
            get {
                return this.LatitudeField;
            }
            set {
                if ((this.LatitudeField.Equals(value) != true)) {
                    this.LatitudeField = value;
                    this.RaisePropertyChanged("Latitude");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=6)]
        public double Longitude {
            get {
                return this.LongitudeField;
            }
            set {
                if ((this.LongitudeField.Equals(value) != true)) {
                    this.LongitudeField = value;
                    this.RaisePropertyChanged("Longitude");
                }
            }
        }
        
        [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=7)]
        public int TotalMedals {
            get {
                return this.TotalMedalsField;
            }
            set {
                if ((this.TotalMedalsField.Equals(value) != true)) {
                    this.TotalMedalsField = value;
                    this.RaisePropertyChanged("TotalMedals");
                }
            }
        }
        
        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(ConfigurationName="WSData.OlympicsDataSoap")]
    public interface OlympicsDataSoap {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/GetMedals", ReplyAction="*")]
        System.IAsyncResult BeginGetMedals(Olympics.WSData.GetMedalsRequest request, System.AsyncCallback callback, object asyncState);
        
        Olympics.WSData.GetMedalsResponse EndGetMedals(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 GetMedalsRequest {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="GetMedals", Namespace="http://tempuri.org/", Order=0)]
        public Olympics.WSData.GetMedalsRequestBody Body;
        
        public GetMedalsRequest() {
        }
        
        public GetMedalsRequest(Olympics.WSData.GetMedalsRequestBody 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()]
    public partial class GetMedalsRequestBody {
        
        public GetMedalsRequestBody() {
        }
    }
    
    [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 GetMedalsResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="GetMedalsResponse", Namespace="http://tempuri.org/", Order=0)]
        public Olympics.WSData.GetMedalsResponseBody Body;
        
        public GetMedalsResponse() {
        }
        
        public GetMedalsResponse(Olympics.WSData.GetMedalsResponseBody 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://tempuri.org/")]
    public partial class GetMedalsResponseBody {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo> GetMedalsResult;
        
        public GetMedalsResponseBody() {
        }
        
        public GetMedalsResponseBody(System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo> GetMedalsResult) {
            this.GetMedalsResult = GetMedalsResult;
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface OlympicsDataSoapChannel : Olympics.WSData.OlympicsDataSoap, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GetMedalsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public GetMedalsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo> Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo>)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class OlympicsDataSoapClient : System.ServiceModel.ClientBase<Olympics.WSData.OlympicsDataSoap>, Olympics.WSData.OlympicsDataSoap {
        
        private BeginOperationDelegate onBeginGetMedalsDelegate;
        
        private EndOperationDelegate onEndGetMedalsDelegate;
        
        private System.Threading.SendOrPostCallback onGetMedalsCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public OlympicsDataSoapClient() {
        }
        
        public OlympicsDataSoapClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public OlympicsDataSoapClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public OlympicsDataSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public OlympicsDataSoapClient(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<GetMedalsCompletedEventArgs> GetMedalsCompleted;
        
        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 Olympics.WSData.OlympicsDataSoap.BeginGetMedals(Olympics.WSData.GetMedalsRequest request, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetMedals(request, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.IAsyncResult BeginGetMedals(System.AsyncCallback callback, object asyncState) {
            Olympics.WSData.GetMedalsRequest inValue = new Olympics.WSData.GetMedalsRequest();
            inValue.Body = new Olympics.WSData.GetMedalsRequestBody();
            return ((Olympics.WSData.OlympicsDataSoap)(this)).BeginGetMedals(inValue, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Olympics.WSData.GetMedalsResponse Olympics.WSData.OlympicsDataSoap.EndGetMedals(System.IAsyncResult result) {
            return base.Channel.EndGetMedals(result);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        private System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo> EndGetMedals(System.IAsyncResult result) {
            Olympics.WSData.GetMedalsResponse retVal = ((Olympics.WSData.OlympicsDataSoap)(this)).EndGetMedals(result);
            return retVal.Body.GetMedalsResult;
        }
        
        private System.IAsyncResult OnBeginGetMedals(object[] inValues, System.AsyncCallback callback, object asyncState) {
            return this.BeginGetMedals(callback, asyncState);
        }
        
        private object[] OnEndGetMedals(System.IAsyncResult result) {
            System.Collections.ObjectModel.ObservableCollection<Olympics.WSData.CountryInfo> retVal = this.EndGetMedals(result);
            return new object[] {
                    retVal};
        }
        
        private void OnGetMedalsCompleted(object state) {
            if ((this.GetMedalsCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetMedalsCompleted(this, new GetMedalsCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetMedalsAsync() {
            this.GetMedalsAsync(null);
        }
        
        public void GetMedalsAsync(object userState) {
            if ((this.onBeginGetMedalsDelegate == null)) {
                this.onBeginGetMedalsDelegate = new BeginOperationDelegate(this.OnBeginGetMedals);
            }
            if ((this.onEndGetMedalsDelegate == null)) {
                this.onEndGetMedalsDelegate = new EndOperationDelegate(this.OnEndGetMedals);
            }
            if ((this.onGetMedalsCompletedDelegate == null)) {
                this.onGetMedalsCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetMedalsCompleted);
            }
            base.InvokeAsync(this.onBeginGetMedalsDelegate, null, this.onEndGetMedalsDelegate, this.onGetMedalsCompletedDelegate, 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 Olympics.WSData.OlympicsDataSoap CreateChannel() {
            return new OlympicsDataSoapClientChannel(this);
        }
        
        private class OlympicsDataSoapClientChannel : ChannelBase<Olympics.WSData.OlympicsDataSoap>, Olympics.WSData.OlympicsDataSoap {
            
            public OlympicsDataSoapClientChannel(System.ServiceModel.ClientBase<Olympics.WSData.OlympicsDataSoap> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetMedals(Olympics.WSData.GetMedalsRequest request, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = request;
                System.IAsyncResult _result = base.BeginInvoke("GetMedals", _args, callback, asyncState);
                return _result;
            }
            
            public Olympics.WSData.GetMedalsResponse EndGetMedals(System.IAsyncResult result) {
                object[] _args = new object[0];
                Olympics.WSData.GetMedalsResponse _result = ((Olympics.WSData.GetMedalsResponse)(base.EndInvoke("GetMedals", _args, result)));
                return _result;
            }
        }
    }
}
