private void AddClick() { var dlg = new NoteDialog(); dlg.DialogTitle = "Add Note"; dlg.OkClick = () => { var text = dlg.Text.TrimToNull(); if (text == null) { return; } this.items = this.items ?? new List <NoteRow>(); items.Insert(0, new NoteRow { Text = text, InsertUserDisplayName = Authorization.UserDefinition.DisplayName, InsertDate = Q.Externals.FormatISODateTimeUTC(JsDate.Now) }); UpdateContent(); dlg.DialogClose(); IsDirty = true; if (OnChange != null) { OnChange(); } }; dlg.DialogOpen(); }
private void EditClick(jQueryEvent e) { e.PreventDefault(); var index = J(e.Target).GetDataValue("index").As <int>(); var old = items[index]; var dlg = new NoteDialog(); dlg.DialogTitle = "Edit Note"; dlg.Text = old.Text; dlg.OkClick = () => { var text = dlg.Text.TrimToNull(); if (text == null) { return; } items[index].Text = text; UpdateContent(); dlg.DialogClose(); IsDirty = true; if (OnChange != null) { OnChange(); } }; dlg.DialogOpen(); }