Ejemplo n.º 1
0
 private void addToList_Click(object sender, EventArgs e)
 {
     if (sendToInput.Items.Count != 20)
     {
         sendToInput.Items.Add(recipientInput.Text);
     }
     else
     {
         Speak informToMany = new Speak();
     }
     Console.WriteLine(sendToInput.Items.Count.ToString());
 }
Ejemplo n.º 2
0
        public void CalenderAppointments()
        {
            Console.WriteLine("Checking Calender");
            jarvis = new Speak();
            try
            {
                DateTime start            = DateTime.Now;
                DateTime end              = start.AddDays(7);
                int      index            = 1;
                bool     appointmentFound = false;

                NameSpace  outlookNameSpace = outLookApp.GetNamespace("MAPI");
                MAPIFolder calender         = outlookNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
                Items      calenderItems    = GetAppointmentsInRange(calender, start, end);
                if (calenderItems != null)
                {
                    Console.WriteLine("Appointments Found");
                    //set bool here change in foreach ask after foreach for change
                    foreach (AppointmentItem appointment in calenderItems)
                    {
                        Console.WriteLine("Appointment " + index.ToString());
                        string[] appointmentContent = { index.ToString(), appointment.Subject, appointment.Start.Date.ToString("d"), appointment.Start.TimeOfDay.ToString(), appointment.Location };
                        Thread   sayAppointment     = new Thread(new ThreadStart(() => jarvis.sayAppointment(appointmentContent)));
                        sayAppointment.IsBackground = true;
                        sayAppointment.Start();
                        Thread.Sleep(8000);
                        index++;
                        appointmentFound = true;
                    }

                    if (!appointmentFound)
                    {
                        Console.WriteLine("Nothing found");
                        NoAppointments();
                    }
                }
                else
                {
                    Console.WriteLine("Nothing found");
                    NoAppointments();
                }
            }
            catch
            {
                NoAppointments();
            }
        }