KanbanNotes.xaml.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 bool Ready { get; set; }
  24. public void Load(object item, Func<Type, CoreTable> PageDataHandler)
  25. {
  26. NotesList.ItemsSource = ((Kanban)item).Notes;
  27. Ready = true;
  28. }
  29. public void BeforeSave(object item)
  30. {
  31. if (!string.IsNullOrWhiteSpace(AdditionalNote))
  32. {
  33. var kanban = (Kanban)item;
  34. var notes = kanban.Notes.ToList();
  35. notes.Add(string.Format("{0:yyyy-MM-dd HH:mm:ss} {1}: {2}", DateTime.Now, UserID, AdditionalNote));
  36. kanban.Notes = notes.ToArray();
  37. }
  38. }
  39. public string Caption()
  40. {
  41. return "Notes";
  42. }
  43. public int Order()
  44. {
  45. return int.MinValue;
  46. }
  47. public void AfterSave(object item)
  48. {
  49. // no need to do anything here
  50. }
  51. public Size MinimumSize()
  52. {
  53. return new Size(400, 600);
  54. }
  55. }
  56. }