private void SetAppointment(Appointment appointment) { CurrentAppointmentId = appointment.Id; Subject = appointment.Subject; Location = appointment.Location; StartDate = appointment.Start.Date; StartTime = appointment.Start.ToString("MM-dd-yyyy HH:mm:ss"); EndDate = appointment.End.Date; EndTime = appointment.End.ToString("MM-dd-yyyy HH:mm:ss"); LabelId = appointment.LabelId; ResourceId = appointment.ResourceId; StatusId = appointment.StatusId; AllDayEvent = appointment.AllDay; Description = appointment.Description; //if appointment has reminder we look for the closest time to our defoult remanders if (appointment.Reminder != null) { var closestKeyPair = ReminderCollection.First( n => Math.Abs(appointment.Reminder.TimeBeforeStart.TotalSeconds - n.Key) < double.Epsilon); SelectedReminder = closestKeyPair; } else { SelectedReminder = ReminderCollection[0]; } Appointment = appointment; SelectedCalendar = appointment.CustomFields["cfCalendar"] as Mailbird.Apps.Calendar.Engine.Metadata.Calendar; }
public bool AddReminders(ReminderCollection reminders) { lock (this.reminders) { this.reminders.AddRange(reminders); return(true); } }
/// <summary> /// Serializes a set of Reminders to an XML file. /// </summary> /// /// <param name="filename">Desired filename of XML file. Will overwrite if exists.</param> public static void SerializeReminders(ReminderCollection reminders, string filename) { DataContractSerializer x = new DataContractSerializer(typeof(ReminderCollection)); FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write); x.WriteObject(fs, reminders); fs.Close(); }
/// <summary> /// Construct a set of Reminders from an XML file. It is assumed /// that the filename path is correctly constructed. /// </summary> /// /// <param name="filename">Path to the XML file.</param> /// /// <returns>Reminders constructed from serialized version.</returns> public static ReminderCollection DeserializeReminders(string filename) { DataContractSerializer x = new DataContractSerializer(typeof(ReminderCollection)); FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read); ReminderCollection reminders = x.ReadObject(fs) as ReminderCollection; fs.Close(); return(reminders); }
void InitItemListBox(RemindersFormTemplateContainer container) { ReminderCollection reminders = container.Reminders; int count = reminders.Count; for (int i = 0; i < count; i++) { Reminder reminder = reminders[i]; ListEditItem item = new ListEditItem(reminder.Subject, i); lbItems.Items.Add(item); } lbItems.SelectedIndex = 0; }
private void GetReminders(DateTime dateTime) { try { Task.Factory.StartNew(() => { this.ReminderList = ReminderAction.GetReminders(this.DBConnectionString, dateTime); }); } catch (Exception exception) { NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured, ExceptionResources.ExceptionOccuredLogDetail); } }
private void InitReminders() { remindersToShow = false; // Create a new reminder collection and start the clock reminders = new ReminderCollection(); reminders.RegisterObserver(this); reminders.Start(); // Copy reminders from diary collection to reminder manager foreach (DiaryEntry entry in diaryEntryCollection) { reminders.AddReminder(entry.Reminder); entry.Reminder.Entry = entry; } }
/// <summary> /// Initializes a new instance of the Appointment class. /// </summary> public Appointment() { _Reminders = new ReminderCollection(this); _AutoId = ++AutoIdCounter; }