Esempio n. 1
0
        /// <summary>
        /// Creates an instance of this class setting its private objects
        /// </summary>
        /// <param name="settings">Export settings</param>
        /// <param name="font">Font to use during printing</param>
        /// <param name="icon">The icon to use for print preview dialog</param>
        /// <history>
        /// [Curtis_Beard]      11/02/2005	Created
        /// [Curtis_Beard]      10/11/2006	CHG: Added Font object and a Icon
        /// </history>
        public frmPrint(MatchResultsExport.ExportSettings settings, Font font, Icon icon)
        {
            //
             // Required for Windows Form Designer support
             //
             InitializeComponent();

             this.settings = settings;
             this.printFont = font;
             this.previewIcon = icon;

             printDocument.PrintPage += pdoc_PrintPage;
        }
Esempio n. 2
0
        /// <summary>
        /// Show Print Dialog
        /// </summary>
        /// <param name="sender">system parm</param>
        /// <param name="e">system parm</param>
        /// <history>
        /// [Curtis_Beard]	   01/11/2005	.Net Conversion
        /// [Curtis_Beard]	   09/10/2005	CHG: pass in listView and grep hashtable
        /// [Curtis_Beard]	   10/14/2005	CHG: use No Results for message box title
        /// [Curtis_Beard]	   12/07/2005	CHG: Pass in font name and size to print dialog
        /// [Curtis_Beard]	   10/11/2006	CHG: Pass in font and icon
        /// </history>
        private void PrintResultsMenuItem_Click(object sender, EventArgs e)
        {
            if (lstFileNames.Items.Count > 0)
             {
            // get all grep indexes
            IEnumerable<ListViewItem> lv = lstFileNames.Items.Cast<ListViewItem>();
            var indexes = (from i in lv where i.Selected select int.Parse(i.SubItems[Constants.COLUMN_INDEX_GREP_INDEX].Text)).ToList();

            MatchResultsExport.ExportSettings settings = new MatchResultsExport.ExportSettings()
            {
               Grep = __Grep,
               GrepIndexes = indexes,
               ShowLineNumbers = LineNumbersMenuItem.Checked,
               RemoveLeadingWhiteSpace = RemoveWhiteSpaceMenuItem.Checked
            };

            using (var printForm = new frmPrint(settings, Convertors.ConvertStringToFont(Core.GeneralSettings.ResultsFont), Icon))
            {
               printForm.ShowDialog(this);
            }
             }
             else
            MessageBox.Show(Language.GetGenericText("PrintNoResults"), ProductInformation.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 3
0
        /// <summary>
        /// Output results using given export delegate.
        /// </summary>
        /// <param name="filename">Current filename</param>
        /// <param name="outputter">File delegate</param>
        /// <history>
        /// [Andrew_Radford]   20/09/2009	Initial
        /// [Curtis_Beard]     12/03/2014	CHG: pass grep indexes instead of ListView
        /// [Curtis_Beard]     04/08/2015	CHG: update export delegate with settings class
        /// </history>
        private void OutputResults(string filename, MatchResultsExport.FileDelegate outputter)
        {
            SetStatusBarMessage(String.Format(Language.GetGenericText("SaveSaving"), filename));

             try
             {
            // get all grep indexes
            IEnumerable<ListViewItem> lv = lstFileNames.Items.Cast<ListViewItem>();
            var indexes = (from i in lv select int.Parse(i.SubItems[Constants.COLUMN_INDEX_GREP_INDEX].Text)).ToList();

            MatchResultsExport.ExportSettings settings = new MatchResultsExport.ExportSettings()
            {
               Path = filename,
               Grep = __Grep,
               GrepIndexes = indexes,
               ShowLineNumbers = LineNumbersMenuItem.Checked,
               RemoveLeadingWhiteSpace = RemoveWhiteSpaceMenuItem.Checked
            };
            outputter(settings);
            SetStatusBarMessage(Language.GetGenericText("SaveSaved"));
             }
             catch (Exception ex)
             {
            MessageBox.Show(
                String.Format(Language.GetGenericText("SaveError"), ex),
                ProductInformation.ApplicationName,
                MessageBoxButtons.OK,
                MessageBoxIcon.Error);
             }
        }