Пример #1
0
        private void do_ext_add(object sender, RoutedEventArgs e)
        {
            this.update_selected_topic();
            ExternalNote note = new ExternalNote("", DateTime.Now);

            note.topics.Add(this.guid);
            NoteWindow dialog_window = new NoteWindow(this.save_state, note, topics: this.topics)
            {
                Owner = this
            };

            dialog_window.ShowDialog();
            ExternalNote             new_note = dialog_window.get_note() as ExternalNote;
            Dictionary <Guid, Topic> topics   = dialog_window.get_topics();

            if ((new_note is null) || (topics is null))
            {
                return;
            }
            this.add_topics(topics, new_note);
            this.notes[Guid.NewGuid()] = new_note;
            this.topic_cache.Clear();
            this.populate_topic_cache();
            this.set_topic(this.guid);
        }
Пример #2
0
        private void do_external_note_add(object sender, RoutedEventArgs e)
        {
            if ((this.topics is null) || (this.notes is null) || (this.save_state is null))
            {
                return;
            }
            ExternalNote note = new ExternalNote("", DateTime.Now);
            Guid?        sel  = this.topic_list.SelectedValue as Guid?;

            if ((sel is not null) && (sel.Value != Guid.Empty))
            {
                note.topics.Add(sel.Value);
            }
            NoteWindow dialog_window = new NoteWindow(this.save_state, note)
            {
                Owner = Window.GetWindow(this)
            };

            dialog_window.ShowDialog();
            ExternalNote             new_note = dialog_window.get_note() as ExternalNote;
            Dictionary <Guid, Topic> topics   = dialog_window.get_topics();

            if ((new_note is null) || (topics is null))
            {
                return;
            }
            this.add_topics(topics, new_note);
            this.notes[Guid.NewGuid()] = new_note;
            this.topic_cache.Clear();
            this.change_callback(null, topics: this.topics, topic_refs: this.topic_refs, notes: this.notes);
        }
Пример #3
0
        private void do_note_add(object sender, RoutedEventArgs e)
        {
            this.update_selected_topic();
            Guid ent_guid = this.entry_guid ?? Guid.NewGuid();
            Note note     = new Note("", ent_guid);

            note.topics.Add(this.guid);
            NoteWindow dialog_window = new NoteWindow(this.save_state, note, this.now, this.topics)
            {
                Owner = this
            };

            dialog_window.ShowDialog();
            Note new_note = dialog_window.get_note() as Note;
            Dictionary <Guid, Topic> topics = dialog_window.get_topics();

            if ((new_note is null) || (topics is null))
            {
                return;
            }
            this.add_topics(topics, new_note);
            Guid guid = this.state.notes.add_note(new_note);

            this.actions.Add(new ActionNoteCreate(guid, new_note));
            this.topic_cache.Clear();
            this.populate_topic_cache();
            this.set_topic(this.guid);
        }
Пример #4
0
        private void do_note_add(object sender, RoutedEventArgs e)
        {
            if (this.save_state is null)
            {
                return;
            }
            Guid ent_guid = this.entry_guid ?? Guid.NewGuid();
            Note note     = new Note("", ent_guid);
            Guid?sel      = this.topic_list.SelectedValue as Guid?;

            if ((sel is not null) && (sel.Value != Guid.Empty))
            {
                note.topics.Add(sel.Value);
            }
            NoteWindow dialog_window = new NoteWindow(this.save_state, note, this.now)
            {
                Owner = Window.GetWindow(this)
            };

            dialog_window.ShowDialog();
            if (this.change_callback is null)
            {
                return;
            }
            Note new_note = dialog_window.get_note() as Note;
            Dictionary <Guid, Topic> topics = dialog_window.get_topics();

            if ((new_note is null) || (topics is null))
            {
                return;
            }
            this.add_topics(topics, new_note);
            List <EntryAction> actions = new List <EntryAction>()
            {
                new ActionNoteCreate(Guid.NewGuid(), new_note)
            };

            this.change_callback(actions, ent_guid, this.topics, this.topic_refs, this.notes);
        }