reference.cs

来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 342 行

CS
342
字号
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50601.0
//
//     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 2.0.50601.0.
// 
#pragma warning disable 1591

namespace ProductInfo.NorthwindServices {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://www.contentmaster.com/NorthwindServices")]
    public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        private System.Threading.SendOrPostCallback HowMuchWillItCostOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetProductInfoOperationCompleted;
        
        private bool useDefaultCredentialsSetExplicitly;
        
        /// <remarks/>
        public Service() {
            this.Url = global::ProductInfo.Properties.Settings.Default.ProductInfo_NorthwindServices_Service;
            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 HowMuchWillItCostCompletedEventHandler HowMuchWillItCostCompleted;
        
        /// <remarks/>
        public event GetProductInfoCompletedEventHandler GetProductInfoCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contentmaster.com/NorthwindServices/HowMuchWillItCost", RequestNamespace="http://www.contentmaster.com/NorthwindServices", ResponseNamespace="http://www.contentmaster.com/NorthwindServices", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public decimal HowMuchWillItCost(string productName, int howMany) {
            object[] results = this.Invoke("HowMuchWillItCost", new object[] {
                        productName,
                        howMany});
            return ((decimal)(results[0]));
        }
        
        /// <remarks/>
        public void HowMuchWillItCostAsync(string productName, int howMany) {
            this.HowMuchWillItCostAsync(productName, howMany, null);
        }
        
        /// <remarks/>
        public void HowMuchWillItCostAsync(string productName, int howMany, object userState) {
            if ((this.HowMuchWillItCostOperationCompleted == null)) {
                this.HowMuchWillItCostOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHowMuchWillItCostOperationCompleted);
            }
            this.InvokeAsync("HowMuchWillItCost", new object[] {
                        productName,
                        howMany}, this.HowMuchWillItCostOperationCompleted, userState);
        }
        
        private void OnHowMuchWillItCostOperationCompleted(object arg) {
            if ((this.HowMuchWillItCostCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.HowMuchWillItCostCompleted(this, new HowMuchWillItCostCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contentmaster.com/NorthwindServices/GetProductInfo", RequestNamespace="http://www.contentmaster.com/NorthwindServices", ResponseNamespace="http://www.contentmaster.com/NorthwindServices", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public Product GetProductInfo(string productName) {
            object[] results = this.Invoke("GetProductInfo", new object[] {
                        productName});
            return ((Product)(results[0]));
        }
        
        /// <remarks/>
        public void GetProductInfoAsync(string productName) {
            this.GetProductInfoAsync(productName, null);
        }
        
        /// <remarks/>
        public void GetProductInfoAsync(string productName, object userState) {
            if ((this.GetProductInfoOperationCompleted == null)) {
                this.GetProductInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetProductInfoOperationCompleted);
            }
            this.InvokeAsync("GetProductInfo", new object[] {
                        productName}, this.GetProductInfoOperationCompleted, userState);
        }
        
        private void OnGetProductInfoOperationCompleted(object arg) {
            if ((this.GetProductInfoCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetProductInfoCompleted(this, new GetProductInfoCompletedEventArgs(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) 
                        && (wsUri.Port <= 5000)) 
                        && (string.Compare(wsUri.Host, "localHost", true) == 0))) {
                return true;
            }
            return false;
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.contentmaster.com/NorthwindServices")]
    public partial class Product {
        
        private int productIDField;
        
        private string productNameField;
        
        private int supplierIDField;
        
        private int categoryIDField;
        
        private string quantityPerUnitField;
        
        private decimal unitPriceField;
        
        private short unitsInStockField;
        
        private short unitsOnOrderField;
        
        private short reorderLevelField;
        
        private bool discontinuedField;
        
        /// <remarks/>
        public int ProductID {
            get {
                return this.productIDField;
            }
            set {
                this.productIDField = value;
            }
        }
        
        /// <remarks/>
        public string ProductName {
            get {
                return this.productNameField;
            }
            set {
                this.productNameField = value;
            }
        }
        
        /// <remarks/>
        public int SupplierID {
            get {
                return this.supplierIDField;
            }
            set {
                this.supplierIDField = value;
            }
        }
        
        /// <remarks/>
        public int CategoryID {
            get {
                return this.categoryIDField;
            }
            set {
                this.categoryIDField = value;
            }
        }
        
        /// <remarks/>
        public string QuantityPerUnit {
            get {
                return this.quantityPerUnitField;
            }
            set {
                this.quantityPerUnitField = value;
            }
        }
        
        /// <remarks/>
        public decimal UnitPrice {
            get {
                return this.unitPriceField;
            }
            set {
                this.unitPriceField = value;
            }
        }
        
        /// <remarks/>
        public short UnitsInStock {
            get {
                return this.unitsInStockField;
            }
            set {
                this.unitsInStockField = value;
            }
        }
        
        /// <remarks/>
        public short UnitsOnOrder {
            get {
                return this.unitsOnOrderField;
            }
            set {
                this.unitsOnOrderField = value;
            }
        }
        
        /// <remarks/>
        public short ReorderLevel {
            get {
                return this.reorderLevelField;
            }
            set {
                this.reorderLevelField = value;
            }
        }
        
        /// <remarks/>
        public bool Discontinued {
            get {
                return this.discontinuedField;
            }
            set {
                this.discontinuedField = value;
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    public delegate void HowMuchWillItCostCompletedEventHandler(object sender, HowMuchWillItCostCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class HowMuchWillItCostCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal HowMuchWillItCostCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public decimal Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((decimal)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    public delegate void GetProductInfoCompletedEventHandler(object sender, GetProductInfoCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("", "")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetProductInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetProductInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public Product Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((Product)(this.results[0]));
            }
        }
    }
}

#pragma warning restore 1591

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?