示例#1
0
 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;
 }
示例#2
0
 public bool AddReminders(ReminderCollection reminders)
 {
     lock (this.reminders)
     {
         this.reminders.AddRange(reminders);
         return(true);
     }
 }
示例#3
0
    /// <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();
    }
示例#4
0
    /// <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();
    }
示例#5
0
    /// <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;
    }
示例#7
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);
     }
 }
示例#8
0
        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;
            }
        }
        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);
            }
        }
示例#10
0
        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;
            }
        }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the Appointment class.
 /// </summary>
 public Appointment()
 {
     _Reminders = new ReminderCollection(this);
     _AutoId = ++AutoIdCounter;
 }