Exemple #1
0
 public ExcelToPdfThread(string name, ExcelViewPdfParams parameters)
 {
     _excelApiFunctions = new ExcelApiFunctions();
     thread             = new Thread(Func);
     thread.Name        = name;
     thread.Start(parameters);
 }
Exemple #2
0
 public ExcelViewPdfParams(ExcelViewPdfParams parameters)
 {
     Config         = parameters.Config;
     SourceFileName = parameters.SourceFileName;
     SourceFileType = parameters.SourceFileType;
     ResultFileName = parameters.ResultFileName;
     ResultFileType = parameters.ResultFileType;
     Offset         = parameters.Offset;
     Count          = parameters.Count;
     FileNumber     = parameters.FileNumber;
 }
Exemple #3
0
        void Func(object parameters)
        {
            var    timer         = new Stopwatch();
            Stream outFileStream = new FileStream(ConfigurationManager.AppSettings["SourcePath"] + "metrics/" + Thread.CurrentThread.Name + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            var    outFile       = new StreamWriter(outFileStream);
            var    data          = new ExcelViewPdfParams((ExcelViewPdfParams)parameters);

            timer = Stopwatch.StartNew();
            _excelApiFunctions.PdfViewer(data.Config, data.SourceFileName, data.SourceFileType, data.ResultFileName, data.ResultFileType, data.Offset, data.Count);
            timer.Stop();
            outFile.Write(Thread.CurrentThread.Name + " executing time: " + timer.ElapsedMilliseconds + " \n\n");
            outFile.Write("Average upload time for file: " + timer.ElapsedMilliseconds / data.Count + "\n");
            Thread.Sleep(0);
            outFile.Close();
            //outFileStream.Close();
        }