private bool GetPrintText(int DocumentID) { try { rtbPrintContent = new RichTextBoxEx() { Rtf = SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(DocumentID)).RTFpublic }; return(true); } catch { return(false); } }
private void RecentsTreeNode_DoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Left) { string[] arraySermonComponents = RecentlyOpenedDocs.OpenSermonFromID(int.Parse(e.Node.Name)); if (arraySermonComponents == null) { return; } else { Form displayForm = SermonReader.DisplayStoredSermon(arraySermonComponents); parentForm.AddNewTabPage(displayForm); } } }
private void MenuItemPrintAll_Click(object sender, EventArgs e) { DialogResult userChoice = MessageBox.Show("If many files are to be printed, your PC will be taxed. Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (userChoice == DialogResult.Yes) { try { RichTextBoxEx rtbSource = new RichTextBoxEx(); foreach (TreeNode tnParentNode in Nodes) { foreach (TreeNode tnChildNode in tnParentNode.Nodes) { try { string rtf = SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(int.Parse(tnChildNode.Name))).RTFpublic; try { if (rtbSource.Rtf.ToLower().Contains("rtf")) { rtf = AppendRTF(rtbSource.Rtf, rtf); } } catch { } rtbSource.Rtf = rtf; rtbSource.Text += PAGE_BREAK; } catch { MessageBox.Show("An error was encountered in opening [" + tnChildNode.Text + "]."); } } } MyPrintDialog myPrintDialog = new MyPrintDialog(parentForm, rtbSource); } catch {; } } }
private void SaveTypedData() { try { DateTime datetime = dtPicker.Value; int series; try { if (!int.TryParse(cmbxSeries.SelectedValue.ToString(), out series)) { series = 0; } } catch { series = 0; } string venue; if (string.IsNullOrEmpty(txbVenue_Name.Text)) { venue = "NOT SET"; } if (txbVenue_Name.Text == txbVenue_Name.Watermark) { venue = "NOT SET"; } else { venue = txbVenue_Name.Text; } string town; if (string.IsNullOrEmpty(txbVenue_Town.Text)) { town = "NOT SET"; } if (txbVenue_Town.Text == txbVenue_Town.Watermark) { town = "NOT SET"; } else { town = txbVenue_Town.Text; } string activity; if (string.IsNullOrEmpty(txbVenue_Activity.Text)) { activity = "NOT SET"; } if (txbVenue_Activity.Text == txbVenue_Activity.Watermark) { activity = "NOT SET"; } else { activity = txbVenue_Activity.Text; } string speaker; if (string.IsNullOrEmpty(txbSpeakerName.Text)) { speaker = "NOT SET"; } if (txbSpeakerName.Text == txbSpeakerName.Watermark) { speaker = "NOT SET"; } else { speaker = txbSpeakerName.Text; } string keytext; if (string.IsNullOrEmpty(txbKeyText.Text)) { keytext = "NOT SET"; } if (txbKeyText.Text == txbKeyText.Watermark) { keytext = "NOT SET"; } else { keytext = txbKeyText.Text; } string hymn; if (string.IsNullOrEmpty(txbHymn.Text)) { hymn = "NOT SET"; } if (txbHymn.Text == txbHymn.Watermark) { hymn = "NOT SET"; } else { hymn = txbHymn.Text; } string title; if (string.IsNullOrEmpty(txbTitle.Text)) { title = "NOT SET"; } if (txbTitle.Text == txbTitle.Watermark) { title = "NOT SET"; } else { title = txbTitle.Text; } string theme; if (string.IsNullOrEmpty(txbTheme.Text)) { theme = "NOT SET"; } if (txbTheme.Text == txbTheme.Watermark) { theme = "NOT SET"; } else { theme = txbTheme.Text; } string content = rtbContent.Rtf; StatusBarMessages.SetStatusBarMessageAction("Saving " + title); if (isEdited == false)//new sermon { Sermon sermon = new Sermon(0, series, datetime, venue, town, activity, speaker, keytext, hymn, title, theme, content); string[] arraySubItems = Sermon.ComponentsToString(sermon); if (Sermon.WriteSermon(arraySubItems) == 1)//sermon inserted successfully { AppEngine.Database.Sermon dummy = new AppEngine.Database.Sermon() { Activity = sermon.Activity, Content = sermon.Content, DateCreated = sermon.DateCreated, Hymn = sermon.Hymn, KeyText = sermon.KeyText, Speaker = sermon.Speaker, Title = sermon.Title, Theme = sermon.Theme, Town = sermon.Town, Venue = sermon.Venue }; if (dummy.Exists(dummy)) { sermon.Id = dummy.Id; parentForm.tabControl.TabPages.Remove(parentForm.tabControl.SelectedTab); parentForm.AddNewTabPage(SermonReader.DisplayStoredSermon(Sermon.ComponentsToString(sermon))); treeViewEx.AddNewTreeNode(dummy.Title, dummy.Id.ToString()); } } else { MessageBox.Show("Document not added.\nPlease try again."); } } else//edited sermon: use existing ID { Sermon sermon = new Sermon(editedID, series, datetime, venue, town, activity, speaker, keytext, hymn, title, theme, content); string[] arraySubItems = Sermon.ComponentsToString(sermon); arraySubItems[iID] = editedID.ToString(); Sermon.OverwriteSermon(arraySubItems); parentForm.tabControl.TabPages.Remove(parentForm.tabControl.SelectedTab); parentForm.AddNewTabPage(SermonReader.DisplayStoredSermon(arraySubItems)); } StatusBarMessages.SetStatusBarMessageAction("Saved " + title); } catch { StatusBarMessages.SetStatusBarMessageAction("Error saving " + txbTitle.Text); } }
/* private void lvShowFoundItems_SelectedIndexChanged (<object>, <EventArgs>) * This function is called when the user clicks on a list view item * * */ private void lvShowFoundItems_SelectedIndexChanged(object sender, EventArgs e) { parentForm.AddNewTabPage(SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(int.Parse(lvShowFoundItems.FocusedItem.Name)))); Close(); }
public void DisplayTreeNodeItem(TreeNode treeNodeSelected) { Form sermonReader = SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(int.Parse(treeNodeSelected.Name))); parentForm.AddNewTabPage(sermonReader); }