Ejemplo n.º 1
0
        } // END METHOD

        /// <summary>
        /// Asynchonous Soap Call to get the ECGridOS SessionInfo
        /// Uses private variable for APIKey - must be set prior to calling
        /// Converts EAP pattern into TAP pattern to use async/await from ECGridAPIAsync Class
        /// </summary>
        /// <param name="APIKey">String APIKey/SessionID in GUID Format for ECGridOS</param>
        /// <returns>net.ecgridos.SessionInfo Class: User Session information</returns>
        public async Task <ECGridOS_API.SessionInfo> SessionInfoAsync(string APIKey)
        {
            try
            {
                using (ECGridOS_API.ECGridOSAPIv3 ECGridOS = new ECGridOS_API.ECGridOSAPIv3())
                {
                    // Check to make sure it is in valid Guid Format
                    if (IsValidGUID(_apiKey))
                    {
                        // Make the call and return the results
                        var AsyncTask = await ECGridAPIAsync.SessionInfoAsync(ECGridOS, APIKey);

                        return(AsyncTask.Result);
                    }
                    else
                    {
                        throw new Exception("Invalid GUID API Key");
                    }
                }
            }
            catch (SoapException SoapEx)
            {
                // SOAP Exceptions
                Console.WriteLine(ECGridAPI.ShowSoapError(SoapEx));
                return(null);
            }
        } // END METHOD
Ejemplo n.º 2
0
        } // END METHOD

        /// <summary>
        /// Asynchonous Soap Call to get the ECGridOS Version
        /// Converts EAP pattern into TAP pattern to use async/await from ECGridAPIAsync Class
        /// </summary>
        /// <returns>Task string: ECGridOS Version</returns>
        public async Task <string> APIVersionAsync()
        {
            try
            {
                using (ECGridOS_API.ECGridOSAPIv3 ECGridOS = new ECGridOS_API.ECGridOSAPIv3())
                {
                    // Make the call and await the results to return
                    var AsyncTask = await ECGridAPIAsync.VersionAsync(ECGridOS);

                    return(AsyncTask.Result);
                }
            }
            catch (SoapException SoapEx)
            {
                // SOAP Exceptions
                return(ECGridAPI.ShowSoapError(SoapEx));
            }
        } // END METHOD