⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localhost.h

📁 《VC++2005编程实例》第五章的源代码
💻 H
字号:
#pragma once

#using <mscorlib.dll>
#using <System.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.EnterpriseServices.dll>
#using <System.Data.dll>

using namespace System::Security::Permissions;
[assembly:SecurityPermissionAttribute(SecurityAction::RequestMinimum, SkipVerification=false)];
// 
// 此源代码由 wsdl 自动生成, Version=2.0.50727.42。
// 
namespace localhost {
    using namespace System::Diagnostics;
    using namespace System::Web::Services;
    using namespace System::ComponentModel;
    using namespace System::Web::Services::Protocols;
    using namespace System;
    using namespace System::Xml::Serialization;
    using namespace System::Data;
    
    using namespace System;
    ref class Service;
    ref class HelloWorldCompletedEventArgs;
    ref class GetQueryResultCompletedEventArgs;
    
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")]
    public delegate System::Void HelloWorldCompletedEventHandler(System::Object^  sender, localhost::HelloWorldCompletedEventArgs^  e);
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")]
    public delegate System::Void GetQueryResultCompletedEventHandler(System::Object^  sender, localhost::GetQueryResultCompletedEventArgs^  e);
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code"), 
    System::Web::Services::WebServiceBindingAttribute(Name=L"ServiceSoap", Namespace=L"http://tempuri.org/")]
    public ref class Service : public System::Web::Services::Protocols::SoapHttpClientProtocol {
        
        private: System::Threading::SendOrPostCallback^  HelloWorldOperationCompleted;
        
        private: System::Threading::SendOrPostCallback^  GetQueryResultOperationCompleted;
        
        /// <remarks/>
        public: event localhost::HelloWorldCompletedEventHandler^  HelloWorldCompleted;
        
        /// <remarks/>
        public: event localhost::GetQueryResultCompletedEventHandler^  GetQueryResultCompleted;
        
        /// <remarks/>
        public: Service();
        /// <remarks/>
        public: [System::Web::Services::Protocols::SoapDocumentMethodAttribute(L"http://tempuri.org/HelloWorld", RequestNamespace=L"http://tempuri.org/", 
            ResponseNamespace=L"http://tempuri.org/", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
        System::String^  HelloWorld();
        
        /// <remarks/>
        public: System::IAsyncResult^  BeginHelloWorld(System::AsyncCallback^  callback, System::Object^  asyncState);
        
        /// <remarks/>
        public: System::String^  EndHelloWorld(System::IAsyncResult^  asyncResult);
        
        /// <remarks/>
        public: System::Void HelloWorldAsync();
        
        /// <remarks/>
        public: System::Void HelloWorldAsync(System::Object^  userState);
        
        private: System::Void OnHelloWorldOperationCompleted(System::Object^  arg);
        
        /// <remarks/>
        public: [System::Web::Services::Protocols::SoapDocumentMethodAttribute(L"http://tempuri.org/GetQueryResult", RequestNamespace=L"http://tempuri.org/", 
            ResponseNamespace=L"http://tempuri.org/", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
        System::Data::DataSet^  GetQueryResult(System::String^  MySQL);
        
        /// <remarks/>
        public: System::IAsyncResult^  BeginGetQueryResult(System::String^  MySQL, System::AsyncCallback^  callback, System::Object^  asyncState);
        
        /// <remarks/>
        public: System::Data::DataSet^  EndGetQueryResult(System::IAsyncResult^  asyncResult);
        
        /// <remarks/>
        public: System::Void GetQueryResultAsync(System::String^  MySQL);
        
        /// <remarks/>
        public: System::Void GetQueryResultAsync(System::String^  MySQL, System::Object^  userState);
        
        private: System::Void OnGetQueryResultOperationCompleted(System::Object^  arg);
        
        /// <remarks/>
        public: System::Void CancelAsync(System::Object^  userState) new;
    };
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code")]
    public ref class HelloWorldCompletedEventArgs : public System::ComponentModel::AsyncCompletedEventArgs {
        
        private: cli::array< System::Object^  >^  results;
        
        internal: HelloWorldCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, System::Boolean cancelled, 
                    System::Object^  userState);
        /// <remarks/>
        public:  property System::String^  Result {
            System::String^  get();
        }
    };
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code")]
    public ref class GetQueryResultCompletedEventArgs : public System::ComponentModel::AsyncCompletedEventArgs {
        
        private: cli::array< System::Object^  >^  results;
        
        internal: GetQueryResultCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, 
                    System::Boolean cancelled, System::Object^  userState);
        /// <remarks/>
        public:  property System::Data::DataSet^  Result {
            System::Data::DataSet^  get();
        }
    };
}
namespace localhost {
    
    
    inline Service::Service() {
        this->Url = L"http://localhost/WebSite/Service.asmx";
    }
    
    inline System::String^  Service::HelloWorld() {
        cli::array< System::Object^  >^  results = this->Invoke(L"HelloWorld", gcnew cli::array< System::Object^  >(0));
        return (cli::safe_cast<System::String^  >(results[0]));
    }
    
    inline System::IAsyncResult^  Service::BeginHelloWorld(System::AsyncCallback^  callback, System::Object^  asyncState) {
        return this->BeginInvoke(L"HelloWorld", gcnew cli::array< System::Object^  >(0), callback, asyncState);
    }
    
    inline System::String^  Service::EndHelloWorld(System::IAsyncResult^  asyncResult) {
        cli::array< System::Object^  >^  results = this->EndInvoke(asyncResult);
        return (cli::safe_cast<System::String^  >(results[0]));
    }
    
    inline System::Void Service::HelloWorldAsync() {
        this->HelloWorldAsync(nullptr);
    }
    
    inline System::Void Service::HelloWorldAsync(System::Object^  userState) {
        if (this->HelloWorldOperationCompleted == nullptr) {
            this->HelloWorldOperationCompleted = gcnew System::Threading::SendOrPostCallback(this, &localhost::Service::OnHelloWorldOperationCompleted);
        }
        this->InvokeAsync(L"HelloWorld", gcnew cli::array< System::Object^  >(0), this->HelloWorldOperationCompleted, userState);
    }
    
    inline System::Void Service::OnHelloWorldOperationCompleted(System::Object^  arg) {
        {
            System::Web::Services::Protocols::InvokeCompletedEventArgs^  invokeArgs = (cli::safe_cast<System::Web::Services::Protocols::InvokeCompletedEventArgs^  >(arg));
            this->HelloWorldCompleted(this, (gcnew localhost::HelloWorldCompletedEventArgs(invokeArgs->Results, invokeArgs->Error, 
                    invokeArgs->Cancelled, invokeArgs->UserState)));
        }
    }
    
    inline System::Data::DataSet^  Service::GetQueryResult(System::String^  MySQL) {
        cli::array< System::Object^  >^  results = this->Invoke(L"GetQueryResult", gcnew cli::array< System::Object^  >(1) {MySQL});
        return (cli::safe_cast<System::Data::DataSet^  >(results[0]));
    }
    
    inline System::IAsyncResult^  Service::BeginGetQueryResult(System::String^  MySQL, System::AsyncCallback^  callback, 
                System::Object^  asyncState) {
        return this->BeginInvoke(L"GetQueryResult", gcnew cli::array< System::Object^  >(1) {MySQL}, callback, asyncState);
    }
    
    inline System::Data::DataSet^  Service::EndGetQueryResult(System::IAsyncResult^  asyncResult) {
        cli::array< System::Object^  >^  results = this->EndInvoke(asyncResult);
        return (cli::safe_cast<System::Data::DataSet^  >(results[0]));
    }
    
    inline System::Void Service::GetQueryResultAsync(System::String^  MySQL) {
        this->GetQueryResultAsync(MySQL, nullptr);
    }
    
    inline System::Void Service::GetQueryResultAsync(System::String^  MySQL, System::Object^  userState) {
        if (this->GetQueryResultOperationCompleted == nullptr) {
            this->GetQueryResultOperationCompleted = gcnew System::Threading::SendOrPostCallback(this, &localhost::Service::OnGetQueryResultOperationCompleted);
        }
        this->InvokeAsync(L"GetQueryResult", gcnew cli::array< System::Object^  >(1) {MySQL}, this->GetQueryResultOperationCompleted, 
            userState);
    }
    
    inline System::Void Service::OnGetQueryResultOperationCompleted(System::Object^  arg) {
        {
            System::Web::Services::Protocols::InvokeCompletedEventArgs^  invokeArgs = (cli::safe_cast<System::Web::Services::Protocols::InvokeCompletedEventArgs^  >(arg));
            this->GetQueryResultCompleted(this, (gcnew localhost::GetQueryResultCompletedEventArgs(invokeArgs->Results, invokeArgs->Error, 
                    invokeArgs->Cancelled, invokeArgs->UserState)));
        }
    }
    
    inline System::Void Service::CancelAsync(System::Object^  userState) {
        __super::CancelAsync(userState);
    }
    
    
    inline HelloWorldCompletedEventArgs::HelloWorldCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, 
                System::Boolean cancelled, System::Object^  userState) : 
            System::ComponentModel::AsyncCompletedEventArgs(exception, cancelled, userState) {
        this->results = results;
    }
    
    inline System::String^  HelloWorldCompletedEventArgs::Result::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::String^  >(this->results[0]));
    }
    
    
    inline GetQueryResultCompletedEventArgs::GetQueryResultCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, 
                System::Boolean cancelled, System::Object^  userState) : 
            System::ComponentModel::AsyncCompletedEventArgs(exception, cancelled, userState) {
        this->results = results;
    }
    
    inline System::Data::DataSet^  GetQueryResultCompletedEventArgs::Result::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Data::DataSet^  >(this->results[0]));
    }
}

⌨️ 快捷键说明

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