//------------------------------------------------------------------------------
// <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.Phone.ServiceReference, version 3.7.0.0
// 
namespace WP7PushClient.GetNotificationURLService {
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="GetNotificationURLService.IReceiveNotificationURLService")]
    public interface IReceiveNotificationURLService {
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IReceiveNotificationURLService/GetNotificationURL", ReplyAction="http://tempuri.org/IReceiveNotificationURLService/GetNotificationURLResponse")]
        System.IAsyncResult BeginGetNotificationURL(string value, System.AsyncCallback callback, object asyncState);
        
        void EndGetNotificationURL(System.IAsyncResult result);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface IReceiveNotificationURLServiceChannel : WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class ReceiveNotificationURLServiceClient : System.ServiceModel.ClientBase<WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService>, WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService {
        
        private BeginOperationDelegate onBeginGetNotificationURLDelegate;
        
        private EndOperationDelegate onEndGetNotificationURLDelegate;
        
        private System.Threading.SendOrPostCallback onGetNotificationURLCompletedDelegate;
        
        private BeginOperationDelegate onBeginOpenDelegate;
        
        private EndOperationDelegate onEndOpenDelegate;
        
        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
        
        private BeginOperationDelegate onBeginCloseDelegate;
        
        private EndOperationDelegate onEndCloseDelegate;
        
        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
        
        public ReceiveNotificationURLServiceClient() {
        }
        
        public ReceiveNotificationURLServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public ReceiveNotificationURLServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ReceiveNotificationURLServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public ReceiveNotificationURLServiceClient(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<System.ComponentModel.AsyncCompletedEventArgs> GetNotificationURLCompleted;
        
        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 WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService.BeginGetNotificationURL(string value, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginGetNotificationURL(value, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        void WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService.EndGetNotificationURL(System.IAsyncResult result) {
            base.Channel.EndGetNotificationURL(result);
        }
        
        private System.IAsyncResult OnBeginGetNotificationURL(object[] inValues, System.AsyncCallback callback, object asyncState) {
            string value = ((string)(inValues[0]));
            return ((WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService)(this)).BeginGetNotificationURL(value, callback, asyncState);
        }
        
        private object[] OnEndGetNotificationURL(System.IAsyncResult result) {
            ((WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService)(this)).EndGetNotificationURL(result);
            return null;
        }
        
        private void OnGetNotificationURLCompleted(object state) {
            if ((this.GetNotificationURLCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.GetNotificationURLCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void GetNotificationURLAsync(string value) {
            this.GetNotificationURLAsync(value, null);
        }
        
        public void GetNotificationURLAsync(string value, object userState) {
            if ((this.onBeginGetNotificationURLDelegate == null)) {
                this.onBeginGetNotificationURLDelegate = new BeginOperationDelegate(this.OnBeginGetNotificationURL);
            }
            if ((this.onEndGetNotificationURLDelegate == null)) {
                this.onEndGetNotificationURLDelegate = new EndOperationDelegate(this.OnEndGetNotificationURL);
            }
            if ((this.onGetNotificationURLCompletedDelegate == null)) {
                this.onGetNotificationURLCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNotificationURLCompleted);
            }
            base.InvokeAsync(this.onBeginGetNotificationURLDelegate, new object[] {
                        value}, this.onEndGetNotificationURLDelegate, this.onGetNotificationURLCompletedDelegate, 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 WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService CreateChannel() {
            return new ReceiveNotificationURLServiceClientChannel(this);
        }
        
        private class ReceiveNotificationURLServiceClientChannel : ChannelBase<WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService>, WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService {
            
            public ReceiveNotificationURLServiceClientChannel(System.ServiceModel.ClientBase<WP7PushClient.GetNotificationURLService.IReceiveNotificationURLService> client) : 
                    base(client) {
            }
            
            public System.IAsyncResult BeginGetNotificationURL(string value, System.AsyncCallback callback, object asyncState) {
                object[] _args = new object[1];
                _args[0] = value;
                System.IAsyncResult _result = base.BeginInvoke("GetNotificationURL", _args, callback, asyncState);
                return _result;
            }
            
            public void EndGetNotificationURL(System.IAsyncResult result) {
                object[] _args = new object[0];
                base.EndInvoke("GetNotificationURL", _args, result);
            }
        }
    }
}
