using System; using System.Linq; using System.Windows; using System.Windows.Controls; using Comal.Classes; using InABox.Core; using InABox.DynamicGrid; namespace PRSDesktop { /// /// Interaction logic for KanbanNotes.xaml /// public partial class KanbanNotes : UserControl, IDynamicEditorPage { private readonly string UserID = ""; public KanbanNotes(string userid) { UserID = userid; InitializeComponent(); } public string AdditionalNote => NewNote.Text; public DynamicEditorGrid EditorGrid { get; set; } public PageType PageType => PageType.Other; public bool Ready { get; set; } public void Load(object item, Func PageDataHandler) { NotesList.ItemsSource = ((Kanban)item).Notes; Ready = true; } public void BeforeSave(object item) { if (!string.IsNullOrWhiteSpace(AdditionalNote)) { var kanban = (Kanban)item; var notes = kanban.Notes.ToList(); notes.Add(string.Format("{0:yyyy-MM-dd HH:mm:ss} {1}: {2}", DateTime.Now, UserID, AdditionalNote)); kanban.Notes = notes.ToArray(); } } public string Caption() { return "Notes"; } public int Order() { return int.MinValue; } public void AfterSave(object item) { // no need to do anything here } public Size MinimumSize() { return new Size(400, 600); } } }