#pragma once

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

using namespace System::Security::Permissions;
[assembly:SecurityPermissionAttribute(SecurityAction::RequestMinimum, SkipVerification=false)];
// 
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
// 
namespace Konkurs {
    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;
    ref class Service;
    ref class InitCompletedEventArgs;
    ref class QueryCompletedEventArgs;
    
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.3038")]
    public delegate System::Void InitCompletedEventHandler(System::Object^  sender, Konkurs::InitCompletedEventArgs^  e);
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.3038")]
    public delegate System::Void QueryCompletedEventHandler(System::Object^  sender, Konkurs::QueryCompletedEventArgs^  e);
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.3038"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code"), 
    System::Web::Services::WebServiceBindingAttribute(Name=L"ServiceSoap", Namespace=L"http://konkurs.musala.com")]
    public ref class Service : public System::Web::Services::Protocols::SoapHttpClientProtocol {
        
        private: System::Threading::SendOrPostCallback^  InitOperationCompleted;
        
        private: System::Threading::SendOrPostCallback^  QueryOperationCompleted;
        
        /// <remarks/>
        public: event Konkurs::InitCompletedEventHandler^  InitCompleted;
        
        /// <remarks/>
        public: event Konkurs::QueryCompletedEventHandler^  QueryCompleted;
        
        /// <remarks/>
        public: Service();
        /// <remarks/>
        public: [System::Web::Services::Protocols::SoapDocumentMethodAttribute(L"http://konkurs.musala.com/Init", RequestNamespace=L"http://konkurs.musala.com", 
            ResponseNamespace=L"http://konkurs.musala.com", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
        System::Int32 Init(System::Int32 test, System::Int32 %n, System::Int32 %m);
        
        /// <remarks/>
        public: System::IAsyncResult^  BeginInit(System::Int32 test, System::AsyncCallback^  callback, System::Object^  asyncState);
        
        /// <remarks/>
        public: System::Int32 EndInit(System::IAsyncResult^  asyncResult, System::Int32 %n, System::Int32 %m);
        
        /// <remarks/>
        public: System::Void InitAsync(System::Int32 test);
        
        /// <remarks/>
        public: System::Void InitAsync(System::Int32 test, System::Object^  userState);
        
        private: System::Void OnInitOperationCompleted(System::Object^  arg);
        
        /// <remarks/>
        public: [System::Web::Services::Protocols::SoapDocumentMethodAttribute(L"http://konkurs.musala.com/Query", RequestNamespace=L"http://konkurs.musala.com", 
            ResponseNamespace=L"http://konkurs.musala.com", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
        System::Int32 Query(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, System::Int32 %dist);
        
        /// <remarks/>
        public: System::IAsyncResult^  BeginQuery(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, System::AsyncCallback^  callback, 
                    System::Object^  asyncState);
        
        /// <remarks/>
        public: System::Int32 EndQuery(System::IAsyncResult^  asyncResult, System::Int32 %dist);
        
        /// <remarks/>
        public: System::Void QueryAsync(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A);
        
        /// <remarks/>
        public: System::Void QueryAsync(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, System::Object^  userState);
        
        private: System::Void OnQueryOperationCompleted(System::Object^  arg);
        
        /// <remarks/>
        public: System::Void CancelAsync(System::Object^  userState) new;
    };
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.3038"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code")]
    public ref class InitCompletedEventArgs : public System::ComponentModel::AsyncCompletedEventArgs {
        
        private: cli::array< System::Object^  >^  results;
        
        internal: InitCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, System::Boolean cancelled, 
                    System::Object^  userState);
        /// <remarks/>
        public: property System::Int32 Result {
            System::Int32 get();
        }
        
        /// <remarks/>
        public: property System::Int32 n {
            System::Int32 get();
        }
        
        /// <remarks/>
        public: property System::Int32 m {
            System::Int32 get();
        }
    };
    
    /// <remarks/>
    [System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl", L"2.0.50727.3038"), 
    System::Diagnostics::DebuggerStepThroughAttribute, 
    System::ComponentModel::DesignerCategoryAttribute(L"code")]
    public ref class QueryCompletedEventArgs : public System::ComponentModel::AsyncCompletedEventArgs {
        
        private: cli::array< System::Object^  >^  results;
        
        internal: QueryCompletedEventArgs(cli::array< System::Object^  >^  results, System::Exception^  exception, System::Boolean cancelled, 
                    System::Object^  userState);
        /// <remarks/>
        public: property System::Int32 Result {
            System::Int32 get();
        }
        
        /// <remarks/>
        public: property System::Int32 dist {
            System::Int32 get();
        }
    };
}
namespace Konkurs {
    
    
    inline Service::Service() {
        this->Url = L"http://10.0.0.63:8000/Recognition/Service.asmx";
    }
    
    inline System::Int32 Service::Init(System::Int32 test, System::Int32 %n, System::Int32 %m) {
        cli::array< System::Object^  >^  results = this->Invoke(L"Init", gcnew cli::array< System::Object^  >(1) {test});
        n = (cli::safe_cast<System::Int32 >(results[1]));
        m = (cli::safe_cast<System::Int32 >(results[2]));
        return (cli::safe_cast<System::Int32 >(results[0]));
    }
    
    inline System::IAsyncResult^  Service::BeginInit(System::Int32 test, System::AsyncCallback^  callback, System::Object^  asyncState) {
        return this->BeginInvoke(L"Init", gcnew cli::array< System::Object^  >(1) {test}, callback, asyncState);
    }
    
    inline System::Int32 Service::EndInit(System::IAsyncResult^  asyncResult, System::Int32 %n, System::Int32 %m) {
        cli::array< System::Object^  >^  results = this->EndInvoke(asyncResult);
        n = (cli::safe_cast<System::Int32 >(results[1]));
        m = (cli::safe_cast<System::Int32 >(results[2]));
        return (cli::safe_cast<System::Int32 >(results[0]));
    }
    
    inline System::Void Service::InitAsync(System::Int32 test) {
        this->InitAsync(test, nullptr);
    }
    
    inline System::Void Service::InitAsync(System::Int32 test, System::Object^  userState) {
        if (this->InitOperationCompleted == nullptr) {
            this->InitOperationCompleted = gcnew System::Threading::SendOrPostCallback(this, &Konkurs::Service::OnInitOperationCompleted);
        }
        this->InvokeAsync(L"Init", gcnew cli::array< System::Object^  >(1) {test}, this->InitOperationCompleted, userState);
    }
    
    inline System::Void Service::OnInitOperationCompleted(System::Object^  arg) {
        {
            System::Web::Services::Protocols::InvokeCompletedEventArgs^  invokeArgs = (cli::safe_cast<System::Web::Services::Protocols::InvokeCompletedEventArgs^  >(arg));
            this->InitCompleted(this, (gcnew Konkurs::InitCompletedEventArgs(invokeArgs->Results, invokeArgs->Error, invokeArgs->Cancelled, 
                    invokeArgs->UserState)));
        }
    }
    
    inline System::Int32 Service::Query(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, System::Int32 %dist) {
        cli::array< System::Object^  >^  results = this->Invoke(L"Query", gcnew cli::array< System::Object^  >(2) {test, 
                A});
        dist = (cli::safe_cast<System::Int32 >(results[1]));
        return (cli::safe_cast<System::Int32 >(results[0]));
    }
    
    inline System::IAsyncResult^  Service::BeginQuery(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, 
                System::AsyncCallback^  callback, System::Object^  asyncState) {
        return this->BeginInvoke(L"Query", gcnew cli::array< System::Object^  >(2) {test, A}, callback, asyncState);
    }
    
    inline System::Int32 Service::EndQuery(System::IAsyncResult^  asyncResult, System::Int32 %dist) {
        cli::array< System::Object^  >^  results = this->EndInvoke(asyncResult);
        dist = (cli::safe_cast<System::Int32 >(results[1]));
        return (cli::safe_cast<System::Int32 >(results[0]));
    }
    
    inline System::Void Service::QueryAsync(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A) {
        this->QueryAsync(test, A, nullptr);
    }
    
    inline System::Void Service::QueryAsync(System::Int32 test, cli::array< cli::array< System::Byte >^  >^  A, System::Object^  userState) {
        if (this->QueryOperationCompleted == nullptr) {
            this->QueryOperationCompleted = gcnew System::Threading::SendOrPostCallback(this, &Konkurs::Service::OnQueryOperationCompleted);
        }
        this->InvokeAsync(L"Query", gcnew cli::array< System::Object^  >(2) {test, A}, this->QueryOperationCompleted, userState);
    }
    
    inline System::Void Service::OnQueryOperationCompleted(System::Object^  arg) {
        {
            System::Web::Services::Protocols::InvokeCompletedEventArgs^  invokeArgs = (cli::safe_cast<System::Web::Services::Protocols::InvokeCompletedEventArgs^  >(arg));
            this->QueryCompleted(this, (gcnew Konkurs::QueryCompletedEventArgs(invokeArgs->Results, invokeArgs->Error, invokeArgs->Cancelled, 
                    invokeArgs->UserState)));
        }
    }
    
    inline System::Void Service::CancelAsync(System::Object^  userState) {
        __super::CancelAsync(userState);
    }
    
    
    inline InitCompletedEventArgs::InitCompletedEventArgs(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::Int32 InitCompletedEventArgs::Result::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Int32 >(this->results[0]));
    }
    
    inline System::Int32 InitCompletedEventArgs::n::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Int32 >(this->results[1]));
    }
    
    inline System::Int32 InitCompletedEventArgs::m::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Int32 >(this->results[2]));
    }
    
    
    inline QueryCompletedEventArgs::QueryCompletedEventArgs(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::Int32 QueryCompletedEventArgs::Result::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Int32 >(this->results[0]));
    }
    
    inline System::Int32 QueryCompletedEventArgs::dist::get() {
        this->RaiseExceptionIfNecessary();
        return (cli::safe_cast<System::Int32 >(this->results[1]));
    }
}
