private async void Button_Appointment_Click(object sender, RoutedEventArgs e) { try { this.Progress.IsActive = true; var startDate = new DateTime(this.startDate.Date.Year, this.startDate.Date.Month, this.startDate.Date.Day, this.starthour.Time.Hours, this.starthour.Time.Minutes, this.starthour.Time.Seconds); var endDate = new DateTime(this.endDate.Date.Year, this.endDate.Date.Month, this.endDate.Date.Day, this.endhour.Time.Hours, this.endhour.Time.Minutes, this.endhour.Time.Seconds); await OutlookHeñper.SetAppointment(this.txtSubject.Text, startDate, endDate); InfoText.Text = "Event scheduled correctly"; } catch (Exception ex) { InfoText.Text = $"OOPS! An error ocurred: {ex.GetMessage()}"; } finally { this.Progress.IsActive = false; } }
private async void Page_Loading(FrameworkElement sender, object args) { try { var contacts = await OutlookHeñper.GetContacts(); foreach (var contact in contacts.Where(x => x.EmailAddresses.Count() > 0)) { Items.Add(new ContactsModel() { ContactInfo = $"{contact.DisplayName} - {contact.EmailAddresses.FirstOrDefault().Address}" }); } } catch (Exception ex) { InfoText.Text = $"OOPS! An error ocurred: {ex.GetMessage()}"; } finally { Progress.IsActive = false; } }