Exemplo n.º 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;
 }
Exemplo n.º 2
0
 public bool AddReminders(ReminderCollection reminders)
 {
     lock (this.reminders)
     {
         this.reminders.AddRange(reminders);
         return(true);
     }
 }
Exemplo n.º 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();
    }
Exemplo n.º 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();
    }
Exemplo n.º 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;
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the Appointment class.
 /// </summary>
 public Appointment()
 {
     _Reminders = new ReminderCollection(this);
     _AutoId = ++AutoIdCounter;
 }