// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
// 
// 對這個檔案所做的變更可能會造成錯誤的行為，而且如果重新產生程式碼，
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------


using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using Microsoft.VisualBasic.CompilerServices;

// 
// 原始程式碼已由 Microsoft.VSDesigner 自動產生，版本 4.0.30319.42000。
// 
namespace AutoRunLib_C.wsERP_WorkFlow
{

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
    [DebuggerStepThrough()]
    [DesignerCategory("code")]
    [WebServiceBinding(Name = "WFMESServiceSoap", Namespace = "http://tempuri.org/")]
    public partial class WFMESService : SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback XMLAdapterOperationCompleted;

        private bool useDefaultCredentialsSetExplicitly;

        /// <remarks/>
        public WFMESService() : base()
        {
            Url = My.MySettings.Default.AutoRunLib_wsERP_WorkFlow_WFMESService;
            if (IsLocalFileSystemWebService(Url) == true)
            {
                UseDefaultCredentials = true;
                useDefaultCredentialsSetExplicitly = false;
            }
            else
            {
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        public new string Url
        {
            get
            {
                return base.Url;
            }
            set
            {
                if (IsLocalFileSystemWebService(base.Url) == true && useDefaultCredentialsSetExplicitly == false && IsLocalFileSystemWebService(value) == false)

                {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }

        public new bool UseDefaultCredentials
        {
            get
            {
                return base.UseDefaultCredentials;
            }
            set
            {
                base.UseDefaultCredentials = value;
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        /// <remarks/>
        public event XMLAdapterCompletedEventHandler XMLAdapterCompleted;

        /// <remarks/>
        [SoapDocumentMethod("http://tempuri.org/XMLAdapter", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
        public string XMLAdapter(string sXML)
        {
            object[] results = Invoke("XMLAdapter", new object[] { sXML });
            return Conversions.ToString(results[0]);
        }

        /// <remarks/>
        public IAsyncResult BeginXMLAdapter(string sXML, AsyncCallback callback, object asyncState)
        {
            return BeginInvoke("XMLAdapter", new object[] { sXML }, callback, asyncState);
        }

        /// <remarks/>
        public string EndXMLAdapter(IAsyncResult asyncResult)
        {
            object[] results = EndInvoke(asyncResult);
            return Conversions.ToString(results[0]);
        }

        /// <remarks/>
        public void XMLAdapterAsync(string sXML)
        {
            XMLAdapterAsync(sXML, null);
        }

        /// <remarks/>
        public void XMLAdapterAsync(string sXML, object userState)
        {
            if (XMLAdapterOperationCompleted == null)
            {
                XMLAdapterOperationCompleted = OnXMLAdapterOperationCompleted;
            }
            InvokeAsync("XMLAdapter", new object[] { sXML }, XMLAdapterOperationCompleted, userState);
        }

        private void OnXMLAdapterOperationCompleted(object arg)
        {
            if (XMLAdapterCompleted != null)
            {
                InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
                XMLAdapterCompleted?.Invoke(this, new XMLAdapterCompletedEventArgs(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 || ReferenceEquals(url, string.Empty))
            {
                return false;
            }
            var wsUri = new Uri(url);
            if (wsUri.Port >= 1024 && string.Compare(wsUri.Host, "localHost", StringComparison.OrdinalIgnoreCase) == 0)
            {
                return true;
            }
            return false;
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
    public delegate void XMLAdapterCompletedEventHandler(object sender, XMLAdapterCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
    [DebuggerStepThrough()]
    [DesignerCategory("code")]
    public partial class XMLAdapterCompletedEventArgs : AsyncCompletedEventArgs
    {

        private object[] results;

        internal XMLAdapterCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public string Result
        {
            get
            {
                RaiseExceptionIfNecessary();
                return Conversions.ToString(results[0]);
            }
        }
    }
}