Example #1
0
        //Prog de test
        public string Lance()
        {
            //Déclare une nouvelle requete
            ReqAPI ReqContact = new ReqAPI();

            try
            {
                //Ouvre la connexion
                Task.WaitAll(Task.Run(async() => await RunAsync(ReqContact)));
            }
            catch (System.Exception ex) { Err.DisplayException(ex); }
            finally
            {
                if (Co.GetHTTPClient() != null)
                {
                    Co.Déconnecte();
                }
            }

            Console.WriteLine(Contacts.GetPerson[0].m_firstname);
            Console.WriteLine(Contacts.GetPerson[1].m_firstname);
            Console.WriteLine(Contacts.GetPerson[2].m_firstname);
            Console.ReadKey();

            return(Contacts.GetPerson[0].m_firstname);
        }
Example #2
0
 //Appel les methodes en Asynk
 public async Task RunAsync(ReqAPI Client)
 {
     try
     {
         Contacts = await Client.GetContact(Co); // Sending a request
     }
     catch (Exception ex)
     { Err.DisplayException(ex); }
 }
Example #3
0
        //Test SSIS
        public string Lance()
        {
            //Déclare une nouvelle requete
            ReqAPI ReqContact = new ReqAPI();

            try
            {
                //Ouvre la connexion
                httpClient = Co.GetHTTPClient();
                Task.WaitAll(Task.Run(async() => await RunAsync(ReqContact)));
            }
            catch (System.Exception ex) { Err.DisplayException(ex); }
            finally
            {
                if (httpClient != null)
                {
                    httpClient.Dispose();
                }
            }
            return(Contacts.GetPerson[0].m_firstname);
        }