Esempio n. 1
0
 private void btUpdate_Click(object sender, EventArgs e)
 {
     if (lvEvents.SelectedItems.Count != 0)
     {
         if (CheckForInternetConnection())
         {
             var FormInsUpd = new FormInsertUpdate("Update")
             {
                 Summary  = lvEvents.SelectedItems[0].SubItems[0].Text,
                 Location = lvEvents.SelectedItems[0].SubItems[1].Text
             };
             if (FormInsUpd.ShowDialog() == DialogResult.OK)
             {
                 service.Events.Get("primary", lvEvents.SelectedItems[0].Tag.ToString()).Execute();
                 Event newEvent = MakeEvent(FormInsUpd.Summary, FormInsUpd.Location, FormInsUpd.Description, FormInsUpd.StartTime, FormInsUpd.StartHour, FormInsUpd.EndTime, FormInsUpd.EndHour);
                 service.Events.Update(newEvent, "primary", lvEvents.SelectedItems[0].Tag.ToString()).Execute();
                 UpdateList();
             }
         }
         else
         {
             MessageBox.Show("No internet connection available");
         }
     }
 }
Esempio n. 2
0
 private void btInsert_Click(object sender, EventArgs e)
 {
     if (credential != null)
     {
         if (CheckForInternetConnection())
         {
             var FormInsUpd = new FormInsertUpdate("Insert");
             if (FormInsUpd.ShowDialog() == DialogResult.OK)
             {
                 {
                     Event newEvent = MakeEvent(FormInsUpd.Summary, FormInsUpd.Location, FormInsUpd.Description, FormInsUpd.StartTime, FormInsUpd.StartHour, FormInsUpd.EndTime, FormInsUpd.EndHour);
                     service.Events.Insert(newEvent, "primary").Execute();
                     UpdateList();
                 }
             }
         }
         else
         {
             MessageBox.Show("No internet connection available");
         }
     }
     else
     {
         MessageBox.Show("To insert event you need to log in");
     }
 }