//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     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.42000.
// 
#pragma warning disable 1591

namespace SignLibTest.remote.signature {
    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.7.3056.0")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="RemoteSignatureSoap", Namespace="http://ca.signfiles.com/RemoteSigner/")]
    public partial class RemoteSignature : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        private System.Threading.SendOrPostCallback GetSigningCertificateOperationCompleted;
        
        private System.Threading.SendOrPostCallback RemoteSignOperationCompleted;
        
        private System.Threading.SendOrPostCallback RemoteSignWithOidOperationCompleted;
        
        private bool useDefaultCredentialsSetExplicitly;
        
        /// <remarks/>
        public RemoteSignature() {
            this.Url = global::SignLibTest.Properties.Settings.Default.SignLibTest_remote_signature_RemoteSignature;
            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 GetSigningCertificateCompletedEventHandler GetSigningCertificateCompleted;
        
        /// <remarks/>
        public event RemoteSignCompletedEventHandler RemoteSignCompleted;
        
        /// <remarks/>
        public event RemoteSignWithOidCompletedEventHandler RemoteSignWithOidCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ca.signfiles.com/RemoteSigner/GetSigningCertificate", RequestNamespace="http://ca.signfiles.com/RemoteSigner/", ResponseNamespace="http://ca.signfiles.com/RemoteSigner/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
        public byte[] GetSigningCertificate() {
            object[] results = this.Invoke("GetSigningCertificate", new object[0]);
            return ((byte[])(results[0]));
        }
        
        /// <remarks/>
        public void GetSigningCertificateAsync() {
            this.GetSigningCertificateAsync(null);
        }
        
        /// <remarks/>
        public void GetSigningCertificateAsync(object userState) {
            if ((this.GetSigningCertificateOperationCompleted == null)) {
                this.GetSigningCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSigningCertificateOperationCompleted);
            }
            this.InvokeAsync("GetSigningCertificate", new object[0], this.GetSigningCertificateOperationCompleted, userState);
        }
        
        private void OnGetSigningCertificateOperationCompleted(object arg) {
            if ((this.GetSigningCertificateCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetSigningCertificateCompleted(this, new GetSigningCertificateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ca.signfiles.com/RemoteSigner/RemoteSign", RequestNamespace="http://ca.signfiles.com/RemoteSigner/", ResponseNamespace="http://ca.signfiles.com/RemoteSigner/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
        public byte[] RemoteSign([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] hashToSign, HashAlgorithm signatureAlgorithm) {
            object[] results = this.Invoke("RemoteSign", new object[] {
                        hashToSign,
                        signatureAlgorithm});
            return ((byte[])(results[0]));
        }
        
        /// <remarks/>
        public void RemoteSignAsync(byte[] hashToSign, HashAlgorithm signatureAlgorithm) {
            this.RemoteSignAsync(hashToSign, signatureAlgorithm, null);
        }
        
        /// <remarks/>
        public void RemoteSignAsync(byte[] hashToSign, HashAlgorithm signatureAlgorithm, object userState) {
            if ((this.RemoteSignOperationCompleted == null)) {
                this.RemoteSignOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoteSignOperationCompleted);
            }
            this.InvokeAsync("RemoteSign", new object[] {
                        hashToSign,
                        signatureAlgorithm}, this.RemoteSignOperationCompleted, userState);
        }
        
        private void OnRemoteSignOperationCompleted(object arg) {
            if ((this.RemoteSignCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.RemoteSignCompleted(this, new RemoteSignCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ca.signfiles.com/RemoteSigner/RemoteSignWithOid", RequestNamespace="http://ca.signfiles.com/RemoteSigner/", ResponseNamespace="http://ca.signfiles.com/RemoteSigner/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
        public byte[] RemoteSignWithOid([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] hashToSign, string signatureAlgorithmOID) {
            object[] results = this.Invoke("RemoteSignWithOid", new object[] {
                        hashToSign,
                        signatureAlgorithmOID});
            return ((byte[])(results[0]));
        }
        
        /// <remarks/>
        public void RemoteSignWithOidAsync(byte[] hashToSign, string signatureAlgorithmOID) {
            this.RemoteSignWithOidAsync(hashToSign, signatureAlgorithmOID, null);
        }
        
        /// <remarks/>
        public void RemoteSignWithOidAsync(byte[] hashToSign, string signatureAlgorithmOID, object userState) {
            if ((this.RemoteSignWithOidOperationCompleted == null)) {
                this.RemoteSignWithOidOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoteSignWithOidOperationCompleted);
            }
            this.InvokeAsync("RemoteSignWithOid", new object[] {
                        hashToSign,
                        signatureAlgorithmOID}, this.RemoteSignWithOidOperationCompleted, userState);
        }
        
        private void OnRemoteSignWithOidOperationCompleted(object arg) {
            if ((this.RemoteSignWithOidCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.RemoteSignWithOidCompleted(this, new RemoteSignWithOidCompletedEventArgs(invokeArgs.Results, 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.Xml", "4.7.3056.0")]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://ca.signfiles.com/RemoteSigner/")]
    public enum HashAlgorithm {
        
        /// <remarks/>
        SHA1,
        
        /// <remarks/>
        SHA256,
        
        /// <remarks/>
        SHA384,
        
        /// <remarks/>
        SHA512,
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    public delegate void GetSigningCertificateCompletedEventHandler(object sender, GetSigningCertificateCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetSigningCertificateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetSigningCertificateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public byte[] Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((byte[])(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    public delegate void RemoteSignCompletedEventHandler(object sender, RemoteSignCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class RemoteSignCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal RemoteSignCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public byte[] Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((byte[])(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    public delegate void RemoteSignWithOidCompletedEventHandler(object sender, RemoteSignWithOidCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class RemoteSignWithOidCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal RemoteSignWithOidCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public byte[] Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((byte[])(this.results[0]));
            }
        }
    }
}

#pragma warning restore 1591