Esempio n. 1
0
        public FlowDocument GetFlowDocument()
        {
            FlowDocument doc = (FlowDocument)Application.LoadComponent(
                new Uri("/Daytimer.DatabaseHelpers;component/Templates/NoteTemplate.xaml",
                        UriKind.Relative));

            NotebookSection section  = NoteDatabase.GetSection(_page.SectionID);
            Notebook        notebook = NoteDatabase.GetNotebook(section.NotebookID);

            ((Paragraph)doc.FindName("Title")).Inlines.Add(_page.Title);
            ((Paragraph)doc.FindName("Created")).Inlines.Add(FormatHelpers.FormatDate(_page.Created.Date) + " "
                                                             + RandomFunctions.FormatTime(_page.Created.TimeOfDay));
            ((Paragraph)doc.FindName("Notebook")).Inlines.Add(notebook.Title);
            ((Paragraph)doc.FindName("Section")).Inlines.Add(section.Title);

            Section details = (Section)doc.FindName("Details");

            FlowDocument detailsDoc = _page.DetailsDocument;

            if (detailsDoc != null)
            {
                BlockCollection blocks = _page.DetailsDocument.Copy().Blocks;

                while (blocks.Count > 0)
                {
                    details.Blocks.Add(blocks.FirstBlock);
                }
            }

            return(doc);
        }
Esempio n. 2
0
 public string[] GetTextDocument()
 {
     return(new string[] { "Subject:\t" + _task.Subject,
                           "Start Date:\t" + (_task.StartDate.HasValue? FormatHelpers.FormatDate(_task.StartDate.Value) : "None"),
                           "Due Date:\t" + (_task.DueDate.HasValue ? FormatHelpers.FormatDate(_task.DueDate.Value) : "None"),
                           "Status:\t\t" + _task.Status.ConvertToString(),
                           "Priority:\t" + _task.Priority.ToString(),
                           "Progress:\t" + _task.Progress.ToString() + "%",
                           "Details:\t" + _task.Details });
 }
Esempio n. 3
0
        public string[] GetTextDocument()
        {
            NotebookSection section  = NoteDatabase.GetSection(_page.SectionID);
            Notebook        notebook = NoteDatabase.GetNotebook(section.NotebookID);

            return(new string[] { "Title:\t" + _page.Title,
                                  "Created:\t" + FormatHelpers.FormatDate(_page.Created.Date) + " " + RandomFunctions.FormatTime(_page.Created.TimeOfDay),
                                  "Notebook:\t" + notebook.Title,
                                  "Section:\t" + section.Title,
                                  "Details:\t" + _page.Details });
        }
Esempio n. 4
0
        private string GetWhen()
        {
            DateTime start;
            DateTime end;

            if (!_appointment.IsRepeating)
            {
                start = _appointment.StartDate;
                end   = _appointment.EndDate;
            }
            else
            {
                start = _appointment.RepresentingDate.Add(_appointment.StartDate.TimeOfDay);
                end   = start.Add(_appointment.EndDate - _appointment.StartDate);
            }

            string when = FormatHelpers.FormatDate(start);

            if (start.Date.AddDays(1) == end.Date)
            {
                if (!_appointment.AllDay)
                {
                    when += " " + RandomFunctions.FormatTime(start.TimeOfDay)
                            + "-" + RandomFunctions.FormatTime(end.TimeOfDay);
                }
            }
            else
            {
                if (start.Date != end.Date)
                {
                    when += " " + RandomFunctions.FormatTime(start.TimeOfDay)
                            + " to "
                            + FormatHelpers.FormatDate(end) + " "
                            + RandomFunctions.FormatTime(end.TimeOfDay);
                }
                else
                {
                    when += " " + RandomFunctions.FormatTime(start.TimeOfDay)
                            + " to " + RandomFunctions.FormatTime(end.TimeOfDay);
                }
            }

            return(when);
        }