Ejemplo n.º 1
0
        private void ResolveClicked(object sender, EventArgs e)
        {
            int index = m_NotesListBox.SelectedIndex;

            if (index < 0)              // Nothing selected
            {
                MessageBox.Show("Select a note first.");
                return;
            }
            var note = m_noteList[index];

            if (note.IsResolved == false)
            {
                IWriteLock writeLock = m_project.RequestWriteLock(
                    this,
                    WriteLockReleaseRequested,
                    WriteLockScope.ProjectNotes);
                if (writeLock == null)
                {
                    MessageBox.Show("Can't get a write lock");
                }
                else
                {
                    note.Resolve(writeLock);
                    writeLock.Dispose();
                    UpdateNotesList();
                }
            }
        }
Ejemplo n.º 2
0
        private void AddNewNote(object sender, EventArgs e)
        {
            AddNoteDialog dialog = new AddNoteDialog(m_project);

            dialog.Verse = m_verseRef;
            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                if (dialog.m_comment.Lines.Length == 0)
                {
                    MessageBox.Show("Comment cannot be empty");
                }
                else
                {
                    IWriteLock writeLock = m_project.RequestWriteLock(
                        this,
                        WriteLockReleaseRequested,
                        WriteLockScope.ProjectNotes);

                    if (writeLock == null)
                    {
                        MessageBox.Show("Can't get a write lock");
                    }
                    else
                    {
                        string text = dialog.SelectedText;
                        IScriptureTextSelection anchor = null;
                        if (string.IsNullOrEmpty(text))
                        {
                            anchor = m_project.GetScriptureSelectionForVerse(dialog.Verse);
                        }
                        else
                        {
                            IReadOnlyList <IScriptureTextSelection> anchors;
                            anchors = m_project.FindMatchingScriptureSelections(dialog.Verse, text, wholeWord: dialog.WholeWord);
                            if (anchors.Count != 0)
                            {
                                anchor = anchors[0];
                            }
                        }
                        if (anchor == null)
                        {
                            MessageBox.Show("Nothing matches selection");
                        }
                        else
                        {
                            List <CommentParagraph> paragraphs = FormParagraphs(dialog.m_comment.Lines);

                            IUserInfo assignee = dialog.Assignee;

                            m_project.AddNote(writeLock, anchor, paragraphs, assignedUser: assignee);
                        }
                        writeLock.Dispose();
                    }
                }
                UpdateNotesList();
            }
            dialog.Dispose();
        }
Ejemplo n.º 3
0
 private void Unlock()
 {
     chapterText.Text = "";
     chapterText.BringToFront();
     changedCheckBox.Checked = false;
     if (m_WriteLock != null)
     {
         IWriteLock temp = m_WriteLock;
         temp.Dispose();
         m_WriteLock = null;
     }
     lockedCheckBox.Checked = false;
     EnableRadioButtons();
 }
Ejemplo n.º 4
0
        private void OnAddComment(object sender, EventArgs e)
        {
            AddCommentDialog dialog = new AddCommentDialog(m_project);

            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                if (dialog.m_comment.Lines.Length == 0)
                {
                    MessageBox.Show("Comment cannot be empty");
                }
                else
                {
                    List <CommentParagraph> paragraphs = FormParagraphs(dialog.m_comment.Lines);
                    IWriteLock writeLock = m_project.RequestWriteLock(
                        this,
                        WriteLockReleaseRequested,
                        WriteLockScope.ProjectNotes);
                    if (writeLock == null)
                    {
                        MessageBox.Show("Can't get a write lock");
                    }
                    else
                    {
                        int       index    = m_NotesListBox.SelectedIndex;
                        var       note     = m_noteList[index];
                        IUserInfo assignee = dialog.Assignee;

                        note.AddNewComment(writeLock, paragraphs, assignedUser: assignee);

                        writeLock.Dispose();
                    }
                }
                RefreshNoteList();
                UpdateNoteDisplay();
            }

            dialog.Dispose();
        }
Ejemplo n.º 5
0
 private void ReleaseRequested(IWriteLock writeLock)
 {
     writeLock.Dispose();
     m_writeLock      = null;
     textBox.ReadOnly = true;
 }