//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34209
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.34209.
// 
#pragma warning disable 1591

namespace AgentWebservicesClient.AgentUtilityWS {
    using System;
    using System.Web.Services;
    using System.Diagnostics;
    using System.Web.Services.Protocols;
    using System.Xml.Serialization;
    using System.ComponentModel;
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.34209")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="AgentUtilityWSSoap", Namespace="http://nortel.com/CCMMAgentWebservices/")]
    public partial class AgentUtilityWS : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        private System.Threading.SendOrPostCallback AgentDesktopLoginOperationCompleted;
        
        private System.Threading.SendOrPostCallback AgentDesktopLogoffOperationCompleted;
        
        private bool useDefaultCredentialsSetExplicitly;
        
        /// <remarks/>
        public AgentUtilityWS() {
            this.Url = global::AgentWebservicesClient.Properties.Settings.Default.AgentWebservicesClient_AgentUtilityWS_AgentUtilityWS;
            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
                this.UseDefaultCredentials = true;
                this.useDefaultCredentialsSetExplicitly = false;
            }
            else {
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        public new string Url {
            get {
                return base.Url;
            }
            set {
                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
                            && (this.useDefaultCredentialsSetExplicitly == false)) 
                            && (this.IsLocalFileSystemWebService(value) == false))) {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }
        
        public new bool UseDefaultCredentials {
            get {
                return base.UseDefaultCredentials;
            }
            set {
                base.UseDefaultCredentials = value;
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        /// <remarks/>
        public event AgentDesktopLoginCompletedEventHandler AgentDesktopLoginCompleted;
        
        /// <remarks/>
        public event AgentDesktopLogoffCompletedEventHandler AgentDesktopLogoffCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://nortel.com/CCMMAgentWebservices/AgentDesktopLogin", RequestNamespace="http://nortel.com/CCMMAgentWebservices/", ResponseNamespace="http://nortel.com/CCMMAgentWebservices/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string AgentDesktopLogin(string username, string password) {
            object[] results = this.Invoke("AgentDesktopLogin", new object[] {
                        username,
                        password});
            return ((string)(results[0]));
        }
        
        /// <remarks/>
        public void AgentDesktopLoginAsync(string username, string password) {
            this.AgentDesktopLoginAsync(username, password, null);
        }
        
        /// <remarks/>
        public void AgentDesktopLoginAsync(string username, string password, object userState) {
            if ((this.AgentDesktopLoginOperationCompleted == null)) {
                this.AgentDesktopLoginOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAgentDesktopLoginOperationCompleted);
            }
            this.InvokeAsync("AgentDesktopLogin", new object[] {
                        username,
                        password}, this.AgentDesktopLoginOperationCompleted, userState);
        }
        
        private void OnAgentDesktopLoginOperationCompleted(object arg) {
            if ((this.AgentDesktopLoginCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.AgentDesktopLoginCompleted(this, new AgentDesktopLoginCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://nortel.com/CCMMAgentWebservices/AgentDesktopLogoff", RequestNamespace="http://nortel.com/CCMMAgentWebservices/", ResponseNamespace="http://nortel.com/CCMMAgentWebservices/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public void AgentDesktopLogoff(string username) {
            this.Invoke("AgentDesktopLogoff", new object[] {
                        username});
        }
        
        /// <remarks/>
        public void AgentDesktopLogoffAsync(string username) {
            this.AgentDesktopLogoffAsync(username, null);
        }
        
        /// <remarks/>
        public void AgentDesktopLogoffAsync(string username, object userState) {
            if ((this.AgentDesktopLogoffOperationCompleted == null)) {
                this.AgentDesktopLogoffOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAgentDesktopLogoffOperationCompleted);
            }
            this.InvokeAsync("AgentDesktopLogoff", new object[] {
                        username}, this.AgentDesktopLogoffOperationCompleted, userState);
        }
        
        private void OnAgentDesktopLogoffOperationCompleted(object arg) {
            if ((this.AgentDesktopLogoffCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.AgentDesktopLogoffCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        public new void CancelAsync(object userState) {
            base.CancelAsync(userState);
        }
        
        private bool IsLocalFileSystemWebService(string url) {
            if (((url == null) 
                        || (url == string.Empty))) {
                return false;
            }
            System.Uri wsUri = new System.Uri(url);
            if (((wsUri.Port >= 1024) 
                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
                return true;
            }
            return false;
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.34209")]
    public delegate void AgentDesktopLoginCompletedEventHandler(object sender, AgentDesktopLoginCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.34209")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class AgentDesktopLoginCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal AgentDesktopLoginCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public string Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.34209")]
    public delegate void AgentDesktopLogoffCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

#pragma warning restore 1591