private void textBox1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (textBox1.SelectedText.Length > 0) { var text = textBox1.SelectedText; text = ComediaHelper.TrimUnecessaryCharacters(text); textBoxKey.Text = text; if (_formViewTable.Visible) { _formViewTable.SearchKey = text; } if (formNoteAdd.Visible) { var booknum = int.Parse(textBoxBook.Text); var cantonum = int.Parse(textBoxCanto.Text); var linenum = textBox1.GetLineFromCharIndex(textBox1.SelectionStart); int modnum = linenum / 4; var start = int.Parse(textBoxStart.Text); var pos = start + linenum - modnum; formNoteAdd.SetNoteName(text); formNoteAdd.SetLocStartEnd(booknum, cantonum, pos, pos); formNoteAdd.ResetNote(); } } } }
private void buttonGet_Click(object sender, EventArgs e) { int bookNumber = int.Parse(textBoxBook.Text); int cantoNumber = int.Parse(textBoxCanto.Text); int start = int.Parse(textBoxStart.Text); int end = int.Parse(textBoxEnd.Text); var books = DBHelper.GetAll <Book>(); if (books == null) { return; } textBox1.Text = ""; StringBuilder sb = new StringBuilder(); foreach (var book in books) { if (book.Number != bookNumber) { continue; } foreach (var canto in book.Cantos) { if (canto.Number == cantoNumber) { foreach (var line in canto.Lines) { if (line.Number >= start && line.Number <= end) { sb.Append(ComediaHelper.CantoReformat(line.Text, line.Number)); } } } } } textBox1.Text = sb.ToString(); var bookName = "Inferno"; if (bookNumber == 2) { bookName = "Purgatorio"; } if (bookNumber == 3) { bookName = "Paradiso"; } loadNotes(bookName, cantoNumber, start, end); }