Example #1
0
        /// <summary>
        /// Occurs when the Print MenuItem is clicked.
        /// </summary>
        /// <param name="sender">Control that initiated the event.</param>
        /// <param name="e">Event arguments.</param>
        private void PrintToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string DocumentIDString = tabControl.SelectedTab.Name;

            if (int.TryParse(DocumentIDString, out int DocumentID))
            {
                MyPrintDialog printDialog = new MyPrintDialog(this, DocumentID);
            }
            else
            {
                MessageBox.Show("Failed to print the document." +
                                "\n\nError cause: Failed to resolve the document ID.");
            }
        }
Example #2
0
 private void MenuItemPrint_Click(object sender, EventArgs e)
 {
     if (SelectedNode.GetNodeCount(false) == 0)
     {
         if (int.TryParse(SelectedNode.Name, out int documentId))
         {
             MyPrintDialog myPrintDialog = new MyPrintDialog(parentForm, documentId);
         }
         else
         {
             MessageBox.Show("Failed to print the selected document." +
                             "\n\nFailed to resolve the document ID.");
         }
     }
 }
Example #3
0
        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 {; }
            }
        }