Beispiel #1
0
    public void SaveNote()
    {
        // don't allow save empty note
        if (string.IsNullOrEmpty(_noteInput.text))
        {
            return;
        }

        // if we didn't edit existing note
        if (_selectedNoteData == null)
        {
            // add new one
            NoteData data = new NoteData(DateTime.Now);
            data.EditNote(_noteInput.text);

            NotesManager.AddNote(data);
        }
        else
        {
            // edit existing
            _selectedNoteData.EditNote(_noteInput.text);
        }

        // remove selection
        _selectedNoteData = null;

        CloseEditNoteScreen();
    }