//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MonteCarloCLI.HPCExcelService {
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="HPCExcelService.IHPCExcelService")]
    public interface IHPCExcelService {
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHPCExcelService/Calculate", ReplyAction="http://tempuri.org/IHPCExcelService/CalculateResponse")]
        MonteCarloCLI.HPCExcelService.CalculateResponse Calculate(MonteCarloCLI.HPCExcelService.CalculateRequest request);
        
        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IHPCExcelService/Calculate", ReplyAction="http://tempuri.org/IHPCExcelService/CalculateResponse")]
        System.IAsyncResult BeginCalculate(MonteCarloCLI.HPCExcelService.CalculateRequest request, System.AsyncCallback callback, object asyncState);
        
        MonteCarloCLI.HPCExcelService.CalculateResponse EndCalculate(System.IAsyncResult result);
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.MessageContractAttribute(WrapperName="Calculate", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
    public partial class CalculateRequest {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
        public string workbookPath;
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=1)]
        public string macroName;
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=2)]
        public byte[] inputs;
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=3)]
        public System.Nullable<System.DateTime> lastSaveDate;
        
        public CalculateRequest() {
        }
        
        public CalculateRequest(string workbookPath, string macroName, byte[] inputs, System.Nullable<System.DateTime> lastSaveDate) {
            this.workbookPath = workbookPath;
            this.macroName = macroName;
            this.inputs = inputs;
            this.lastSaveDate = lastSaveDate;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.MessageContractAttribute(WrapperName="CalculateResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
    public partial class CalculateResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
        public byte[] CalculateResult;
        
        public CalculateResponse() {
        }
        
        public CalculateResponse(byte[] CalculateResult) {
            this.CalculateResult = CalculateResult;
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IHPCExcelServiceChannel : MonteCarloCLI.HPCExcelService.IHPCExcelService, System.ServiceModel.IClientChannel {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class CalculateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        public CalculateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        public MonteCarloCLI.HPCExcelService.CalculateResponse Result {
            get {
                base.RaiseExceptionIfNecessary();
                return ((MonteCarloCLI.HPCExcelService.CalculateResponse)(this.results[0]));
            }
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class HPCExcelServiceClient : System.ServiceModel.ClientBase<MonteCarloCLI.HPCExcelService.IHPCExcelService>, MonteCarloCLI.HPCExcelService.IHPCExcelService {
        
        private BeginOperationDelegate onBeginCalculateDelegate;
        
        private EndOperationDelegate onEndCalculateDelegate;
        
        private System.Threading.SendOrPostCallback onCalculateCompletedDelegate;
        
        public HPCExcelServiceClient() {
        }
        
        public HPCExcelServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public HPCExcelServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public HPCExcelServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public HPCExcelServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
        
        public event System.EventHandler<CalculateCompletedEventArgs> CalculateCompleted;
        
        public MonteCarloCLI.HPCExcelService.CalculateResponse Calculate(MonteCarloCLI.HPCExcelService.CalculateRequest request) {
            return base.Channel.Calculate(request);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        public System.IAsyncResult BeginCalculate(MonteCarloCLI.HPCExcelService.CalculateRequest request, System.AsyncCallback callback, object asyncState) {
            return base.Channel.BeginCalculate(request, callback, asyncState);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        public MonteCarloCLI.HPCExcelService.CalculateResponse EndCalculate(System.IAsyncResult result) {
            return base.Channel.EndCalculate(result);
        }
        
        private System.IAsyncResult OnBeginCalculate(object[] inValues, System.AsyncCallback callback, object asyncState) {
            MonteCarloCLI.HPCExcelService.CalculateRequest request = ((MonteCarloCLI.HPCExcelService.CalculateRequest)(inValues[0]));
            return this.BeginCalculate(request, callback, asyncState);
        }
        
        private object[] OnEndCalculate(System.IAsyncResult result) {
            MonteCarloCLI.HPCExcelService.CalculateResponse retVal = this.EndCalculate(result);
            return new object[] {
                    retVal};
        }
        
        private void OnCalculateCompleted(object state) {
            if ((this.CalculateCompleted != null)) {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                this.CalculateCompleted(this, new CalculateCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }
        
        public void CalculateAsync(MonteCarloCLI.HPCExcelService.CalculateRequest request) {
            this.CalculateAsync(request, null);
        }
        
        public void CalculateAsync(MonteCarloCLI.HPCExcelService.CalculateRequest request, object userState) {
            if ((this.onBeginCalculateDelegate == null)) {
                this.onBeginCalculateDelegate = new BeginOperationDelegate(this.OnBeginCalculate);
            }
            if ((this.onEndCalculateDelegate == null)) {
                this.onEndCalculateDelegate = new EndOperationDelegate(this.OnEndCalculate);
            }
            if ((this.onCalculateCompletedDelegate == null)) {
                this.onCalculateCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCalculateCompleted);
            }
            base.InvokeAsync(this.onBeginCalculateDelegate, new object[] {
                        request}, this.onEndCalculateDelegate, this.onCalculateCompletedDelegate, userState);
        }
    }
}
