KanbanNotes.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Linq;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using Comal.Classes;
  6. using InABox.Core;
  7. using InABox.DynamicGrid;
  8. namespace PRSDesktop
  9. {
  10. /// <summary>
  11. /// Interaction logic for KanbanNotes.xaml
  12. /// </summary>
  13. public partial class KanbanNotes : UserControl, IDynamicEditorPage
  14. {
  15. private readonly string UserID = "";
  16. public KanbanNotes(string userid)
  17. {
  18. UserID = userid;
  19. InitializeComponent();
  20. }
  21. public string AdditionalNote => NewNote.Text;
  22. public DynamicEditorGrid EditorGrid { get; set; }
  23. public PageType PageType => PageType.Other;
  24. public bool Ready { get; set; }
  25. public void Load(object item, Func<Type, CoreTable> PageDataHandler)
  26. {
  27. NotesList.ItemsSource = ((Kanban)item).Notes;
  28. Ready = true;
  29. }
  30. public void BeforeSave(object item)
  31. {
  32. if (!string.IsNullOrWhiteSpace(AdditionalNote))
  33. {
  34. var kanban = (Kanban)item;
  35. var notes = kanban.Notes.ToList();
  36. notes.Add(string.Format("{0:yyyy-MM-dd HH:mm:ss} {1}: {2}", DateTime.Now, UserID, AdditionalNote));
  37. kanban.Notes = notes.ToArray();
  38. }
  39. }
  40. public string Caption()
  41. {
  42. return "Notes";
  43. }
  44. public int Order()
  45. {
  46. return int.MinValue;
  47. }
  48. public void AfterSave(object item)
  49. {
  50. // no need to do anything here
  51. }
  52. public Size MinimumSize()
  53. {
  54. return new Size(400, 600);
  55. }
  56. }
  57. }