Exemplo n.º 1
0
        private async Task AddField(object sender)
        {
            var    field = (sender as Button).DataContext as NoteField;
            string text  = "{{" + field.Name + "}}";
            await templateView.HtmlEditor.InsertHtml(text);

            fieldListView.Hide();
            AddFieldClick?.Invoke();
        }
Exemplo n.º 2
0
        private async Task DeleteField(object sender)
        {
            NoteField field = (sender as Button).DataContext as NoteField;

            fieldListView.Hide();

            var  noteCount  = collection.Models.NoteUseCount(currentNote.Model);
            bool isContinue = await UIHelper.AskUserConfirmation(String.Format(UIConst.WARN_DELETE_FIELD, noteCount));

            if (!isContinue)
            {
                return;
            }

            var model     = currentNote.Model;
            var fieldJson = model.GetNamedArray("flds").GetObjectAt((uint)field.Order);

            collection.Models.RemoveField(model, fieldJson);
            currentNote = collection.NewNote();
            await noteFieldView.DeleteField(field.Name, field.Order, currentNote);

            SavePrefs();
        }