Example #1
0
        private void DoOutlookAppointment()
        {
            try
            {
                SNCalendar.OutlookAppointmentFilter outlookAppointmentFilter = new SNCalendar.OutlookAppointmentFilter();

                // Check whether this is a new appointment or an update.
                outlookAppointmentFilter.StartDate = DateTime.Now.AddDays(-40);
                outlookAppointmentFilter.EndDate   = DateTime.Now.AddDays(100);
                // Set the subject to the character name and the skill being trained for uniqueness sakes.
                outlookAppointmentFilter.Subject = String.Format(CultureConstants.DefaultCulture, "{0} - {1}", m_character.Name, m_character.CurrentlyTrainingSkill.SkillName);
                // Pull the list of appointments. Hopefully we should either get 1 or none back.
                outlookAppointmentFilter.ReadAppointments();

                // If there is an appointment, get the first one.
                if (outlookAppointmentFilter.ItemCount > 0)
                {
                    outlookAppointmentFilter.GetAppointment(0);
                }

                // Update the appointment we may have pulled or the new one.
                // Set the appoinment length to 5 minutes, starting at the estimated completion date and time.
                outlookAppointmentFilter.StartDate         = m_character.CurrentlyTrainingSkill.EndTime;
                outlookAppointmentFilter.EndDate           = m_character.CurrentlyTrainingSkill.EndTime.AddMinutes(5);
                outlookAppointmentFilter.ItemReminder      = Settings.Calendar.UseReminding;
                outlookAppointmentFilter.AlternateReminder = Settings.Calendar.UseRemindingRange;
                outlookAppointmentFilter.EarlyReminder     = Settings.Calendar.EarlyReminding;
                outlookAppointmentFilter.LateReminder      = Settings.Calendar.LateReminding;
                outlookAppointmentFilter.Minutes           = Settings.Calendar.RemindingInterval;
                if (outlookAppointmentFilter.ItemCount > 0)
                {
                    outlookAppointmentFilter.UpdateAppointment(0);
                }
                else
                {
                    outlookAppointmentFilter.AddAppointment();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0} {1}{1} {2}", "There was a problem accessing the Outlook Libraries, is Outlook installed on this machine?", Environment.NewLine, ex.Message), "Problem intergrating to Outlook");
                return;
            }
        }
        private void DoOutlookAppointment()
        {
            try
            {
                SNCalendar.OutlookAppointmentFilter outlookAppointmentFilter = new SNCalendar.OutlookAppointmentFilter();

                // Check whether this is a new appointment or an update.
                outlookAppointmentFilter.StartDate = DateTime.Now.AddDays(-40);
                outlookAppointmentFilter.EndDate = DateTime.Now.AddDays(100);
                // Set the subject to the character name and the skill being trained for uniqueness sakes.
                outlookAppointmentFilter.Subject = String.Format(CultureConstants.DefaultCulture, "{0} - {1}", m_character.Name, m_character.CurrentlyTrainingSkill.SkillName);
                // Pull the list of appointments. Hopefully we should either get 1 or none back.
                outlookAppointmentFilter.ReadAppointments();

                // If there is an appointment, get the first one.
                if (outlookAppointmentFilter.ItemCount > 0)
                    outlookAppointmentFilter.GetAppointment(0);

                // Update the appointment we may have pulled or the new one.
                // Set the appoinment length to 5 minutes, starting at the estimated completion date and time.
                outlookAppointmentFilter.StartDate = m_character.CurrentlyTrainingSkill.EndTime;
                outlookAppointmentFilter.EndDate = m_character.CurrentlyTrainingSkill.EndTime.AddMinutes(5);
                outlookAppointmentFilter.ItemReminder = Settings.Calendar.UseReminding;
                outlookAppointmentFilter.AlternateReminder = Settings.Calendar.UseRemindingRange;
                outlookAppointmentFilter.EarlyReminder = Settings.Calendar.EarlyReminding;
                outlookAppointmentFilter.LateReminder = Settings.Calendar.LateReminding;
                outlookAppointmentFilter.Minutes = Settings.Calendar.RemindingInterval;
                if (outlookAppointmentFilter.ItemCount > 0)
                    outlookAppointmentFilter.UpdateAppointment(0);
                else
                    outlookAppointmentFilter.AddAppointment();
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format(CultureConstants.DefaultCulture, "{0} {1}{1} {2}", "There was a problem accessing the Outlook Libraries, is Outlook installed on this machine?", Environment.NewLine, ex.Message), "Problem intergrating to Outlook");
                return;
            }
        }