view SilverlightExampleApp/SilverlightExampleApp.Interfaces/Services/AuthenticationService.cs @ 60:fc62c971a117

upload to blog
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 21:19:39 +0100
parents 3591c26bd63e
children
line wrap: on
line source

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17379
//
//     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 SlSvcUtil, version 5.0.61118.0
// 


[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="", ConfigurationName="AuthenticationService")]
public interface AuthenticationService
{
    
    [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:AuthenticationService/Authenticate", ReplyAction="urn:AuthenticationService/AuthenticateResponse")]
    System.IAsyncResult BeginAuthenticate(string username, string password, System.AsyncCallback callback, object asyncState);
    
    bool EndAuthenticate(System.IAsyncResult result);
    
    [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:AuthenticationService/LogOut", ReplyAction="urn:AuthenticationService/LogOutResponse")]
    System.IAsyncResult BeginLogOut(System.AsyncCallback callback, object asyncState);
    
    bool EndLogOut(System.IAsyncResult result);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface AuthenticationServiceChannel : AuthenticationService, System.ServiceModel.IClientChannel
{
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class AuthenticateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
    
    private object[] results;
    
    public AuthenticateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState)
    {
        this.results = results;
    }
    
    public bool Result
    {
        get
        {
            base.RaiseExceptionIfNecessary();
            return ((bool)(this.results[0]));
        }
    }
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class LogOutCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
    
    private object[] results;
    
    public LogOutCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState)
    {
        this.results = results;
    }
    
    public bool Result
    {
        get
        {
            base.RaiseExceptionIfNecessary();
            return ((bool)(this.results[0]));
        }
    }
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class AuthenticationServiceClient : System.ServiceModel.ClientBase<AuthenticationService>, AuthenticationService
{
    
    private BeginOperationDelegate onBeginAuthenticateDelegate;
    
    private EndOperationDelegate onEndAuthenticateDelegate;
    
    private System.Threading.SendOrPostCallback onAuthenticateCompletedDelegate;
    
    private BeginOperationDelegate onBeginLogOutDelegate;
    
    private EndOperationDelegate onEndLogOutDelegate;
    
    private System.Threading.SendOrPostCallback onLogOutCompletedDelegate;
    
    private BeginOperationDelegate onBeginOpenDelegate;
    
    private EndOperationDelegate onEndOpenDelegate;
    
    private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
    
    private BeginOperationDelegate onBeginCloseDelegate;
    
    private EndOperationDelegate onEndCloseDelegate;
    
    private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
    
    public AuthenticationServiceClient()
    {
    }
    
    public AuthenticationServiceClient(string endpointConfigurationName) : 
            base(endpointConfigurationName)
    {
    }
    
    public AuthenticationServiceClient(string endpointConfigurationName, string remoteAddress) : 
            base(endpointConfigurationName, remoteAddress)
    {
    }
    
    public AuthenticationServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(endpointConfigurationName, remoteAddress)
    {
    }
    
    public AuthenticationServiceClient(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<AuthenticateCompletedEventArgs> AuthenticateCompleted;
    
    public event System.EventHandler<LogOutCompletedEventArgs> LogOutCompleted;
    
    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 AuthenticationService.BeginAuthenticate(string username, string password, System.AsyncCallback callback, object asyncState)
    {
        return base.Channel.BeginAuthenticate(username, password, callback, asyncState);
    }
    
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    bool AuthenticationService.EndAuthenticate(System.IAsyncResult result)
    {
        return base.Channel.EndAuthenticate(result);
    }
    
    private System.IAsyncResult OnBeginAuthenticate(object[] inValues, System.AsyncCallback callback, object asyncState)
    {
        string username = ((string)(inValues[0]));
        string password = ((string)(inValues[1]));
        return ((AuthenticationService)(this)).BeginAuthenticate(username, password, callback, asyncState);
    }
    
    private object[] OnEndAuthenticate(System.IAsyncResult result)
    {
        bool retVal = ((AuthenticationService)(this)).EndAuthenticate(result);
        return new object[] {
                retVal};
    }
    
    private void OnAuthenticateCompleted(object state)
    {
        if ((this.AuthenticateCompleted != null))
        {
            InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
            this.AuthenticateCompleted(this, new AuthenticateCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
        }
    }
    
    public void AuthenticateAsync(string username, string password)
    {
        this.AuthenticateAsync(username, password, null);
    }
    
    public void AuthenticateAsync(string username, string password, object userState)
    {
        if ((this.onBeginAuthenticateDelegate == null))
        {
            this.onBeginAuthenticateDelegate = new BeginOperationDelegate(this.OnBeginAuthenticate);
        }
        if ((this.onEndAuthenticateDelegate == null))
        {
            this.onEndAuthenticateDelegate = new EndOperationDelegate(this.OnEndAuthenticate);
        }
        if ((this.onAuthenticateCompletedDelegate == null))
        {
            this.onAuthenticateCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnAuthenticateCompleted);
        }
        base.InvokeAsync(this.onBeginAuthenticateDelegate, new object[] {
                    username,
                    password}, this.onEndAuthenticateDelegate, this.onAuthenticateCompletedDelegate, userState);
    }
    
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    System.IAsyncResult AuthenticationService.BeginLogOut(System.AsyncCallback callback, object asyncState)
    {
        return base.Channel.BeginLogOut(callback, asyncState);
    }
    
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    bool AuthenticationService.EndLogOut(System.IAsyncResult result)
    {
        return base.Channel.EndLogOut(result);
    }
    
    private System.IAsyncResult OnBeginLogOut(object[] inValues, System.AsyncCallback callback, object asyncState)
    {
        return ((AuthenticationService)(this)).BeginLogOut(callback, asyncState);
    }
    
    private object[] OnEndLogOut(System.IAsyncResult result)
    {
        bool retVal = ((AuthenticationService)(this)).EndLogOut(result);
        return new object[] {
                retVal};
    }
    
    private void OnLogOutCompleted(object state)
    {
        if ((this.LogOutCompleted != null))
        {
            InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
            this.LogOutCompleted(this, new LogOutCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
        }
    }
    
    public void LogOutAsync()
    {
        this.LogOutAsync(null);
    }
    
    public void LogOutAsync(object userState)
    {
        if ((this.onBeginLogOutDelegate == null))
        {
            this.onBeginLogOutDelegate = new BeginOperationDelegate(this.OnBeginLogOut);
        }
        if ((this.onEndLogOutDelegate == null))
        {
            this.onEndLogOutDelegate = new EndOperationDelegate(this.OnEndLogOut);
        }
        if ((this.onLogOutCompletedDelegate == null))
        {
            this.onLogOutCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnLogOutCompleted);
        }
        base.InvokeAsync(this.onBeginLogOutDelegate, null, this.onEndLogOutDelegate, this.onLogOutCompletedDelegate, 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 AuthenticationService CreateChannel()
    {
        return new AuthenticationServiceClientChannel(this);
    }
    
    private class AuthenticationServiceClientChannel : ChannelBase<AuthenticationService>, AuthenticationService
    {
        
        public AuthenticationServiceClientChannel(System.ServiceModel.ClientBase<AuthenticationService> client) : 
                base(client)
        {
        }
        
        public System.IAsyncResult BeginAuthenticate(string username, string password, System.AsyncCallback callback, object asyncState)
        {
            object[] _args = new object[2];
            _args[0] = username;
            _args[1] = password;
            System.IAsyncResult _result = base.BeginInvoke("Authenticate", _args, callback, asyncState);
            return _result;
        }
        
        public bool EndAuthenticate(System.IAsyncResult result)
        {
            object[] _args = new object[0];
            bool _result = ((bool)(base.EndInvoke("Authenticate", _args, result)));
            return _result;
        }
        
        public System.IAsyncResult BeginLogOut(System.AsyncCallback callback, object asyncState)
        {
            object[] _args = new object[0];
            System.IAsyncResult _result = base.BeginInvoke("LogOut", _args, callback, asyncState);
            return _result;
        }
        
        public bool EndLogOut(System.IAsyncResult result)
        {
            object[] _args = new object[0];
            bool _result = ((bool)(base.EndInvoke("LogOut", _args, result)));
            return _result;
        }
    }
}