コード例 #1
0
        /// <summary>
        /// Handle the clicking of the extend button.
        /// </summary>
        private void cmdExtend_Click(object sender, EventArgs e)
        {
            try
            {
                bool success = BibWord.ExtendBibliography(this.txtWordDoc.Text, this.map[this.cmbStyles.Text]);

                // Give the user a hint to the result of the extension attempt.
                if (success == true)
                {
                    MessageBox.Show("Bibliography extension successful.", "Extension result",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Bibliography extension failed. Either there was no" +
                                    "bibliography or it was not a BibWord bibliography.", "Extension result",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (FileFormatException)
            {
                MessageBox.Show("Not a valid Word 2007 file.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Handle the clicking of the clean button.
        /// </summary>
        private void cmdClean_Click(object sender, EventArgs e)
        {
            try
            {
                BibWord.CleanBibliography(this.txtWordDoc.Text);

                // Give the user.
                MessageBox.Show("Bibliography was successfully cleaned.",
                                "Bibliography cleaned", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (FileFormatException)
            {
                MessageBox.Show("Not a valid Word 2007 file.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Handle the clicking of the button to select a file.
        /// </summary>
        private void cmdWordDocSelection_Click(object sender, EventArgs e)
        {
            // Let the user pick a Word docx file.
            openFileDialog.ShowDialog();

            // Display the selected file.
            if (openFileDialog.FileName != "")
            {
                txtWordDoc.Text = openFileDialog.FileName;

                // Sets the bibliography style currently used by the document.
                try
                {
                    this.cmbStyles.Text = BibWord.GetBibliographyStyle(openFileDialog.FileName, this.map);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Background worker thread.
 /// </summary>
 private void Worker_DoWork(object sender, DoWorkEventArgs e)
 {
     // Load information about all the bibliography styles.
     e.Result = BibWord.LoadBibliographyStylesInformation(this.worker);
 }