コード例 #1
0
 /// <summary>
 /// Evénement Test de Connexion
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTestConnect_Click(object sender, EventArgs e)
 {
     rchTxtBox.Text = "Démarrage de la connexion :\n";
     try
     {
         GoogleFct _googleFct = new GoogleFct(txtGoogleAccount.Text, txtPrivateKey.Text);
         if (_googleFct.InitCnx())
         {
             CalendarList _lst = _googleFct.GetCalendarList();
             rchTxtBox.Text += "Liste des calendriers disponibles :\n";
             foreach (CalendarListEntry _entry in _lst.Items)
             {
                 if (_entry.Summary != p_applClass.Param.GoogleAccount && _entry.Summary != "*****@*****.**") { rchTxtBox.Text += "---> " + _entry.Summary + "\n"; }
             }
             rchTxtBox.Text += "Test de connexion réussi.";
             frm.statusGoogle(true);
         }
         else { 
             rchTxtBox.Text += "Une erreur s'est produite lors de l'initialisation de Google...\n";
             frm.statusGoogle(false);
         }
     }
     catch (Exception err)
     {
         rchTxtBox.Text += "Une erreur s'est produite :\n";
         rchTxtBox.Text += err.Message + "\n";
         if (err.InnerException != null) { rchTxtBox.Text += err.InnerException + "\n"; }
         frm.statusGoogle(false);
     }
 }
コード例 #2
0
 /// <summary>
 /// Initialisation de la connexion Google
 /// </summary>
 private void initGoogleCnx()
 {
     Log.Debug("Initialisation de la connexion Google...");
     // Création de l'objet Google
     p_googleFct = new GoogleFct(p_applClass);
     if (p_googleFct.InitCnx())
     {
         // Test de connexion
         if (p_googleFct.TestCnx())
         {
             this.statusImgGoogle.Image = Resources.Cal1Ok;
             this.statusImgGoogle.ToolTipText = "Test Ok";
         }
         else
         {
             this.statusImgGoogle.ToolTipText = "Erreur lors du test de la connexion !";
             this.statusImgGoogle.Image = Resources.Cal1Ko;
         }
     }
     else
     {
         this.statusImgGoogle.Image = Resources.Cal1Ko;
         this.statusImgGoogle.ToolTipText = "Erreur lors de l'initalisation de la connexion !";
     }
 }