예제 #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;
        }
예제 #2
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);
             }
        }
예제 #3
0
 /// <summary>
 /// Output results using given export delegate.
 /// </summary>
 /// <param name="outputter">Print delegate</param>
 /// <returns></returns>
 /// <history>
 /// [Curtis_Beard]     04/10/2015	ADD: use delegate for print methods
 /// </history>
 private string OutputResults(MatchResultsExport.PrintDelegate outputter)
 {
     return outputter(settings);
 }