Пример #1
0
        void batch_FileProcessSuccess(object sender, PNGoo.BatchOperations.FileProcessSuccessEventArgs e)
        {
            ++FilesProcessed;

            DataGridViewRow row = fileBatchDataGridView.Rows[e.FilePathIndex];

            if (e.Compressor != null)
            {
                // update optimised size column
                row.Cells["OptimisedSizeColumn"].Value = formatFileSize(e.Compressor.CompressedFile.Length);
                // update actual file row to point to the new file, so further compressions act on the new file
                row.Cells["RealFileColumn"].Value = e.NewFilePath;
                // update status
                string compressorUsed = e.Compressor.GetType().Name;
                row.Cells["StatusColumn"].Value = String.Format("Complete: {0} used", compressorUsed);
            }
            else
            {
                // the original file was just copied
                // update optimised size column
                DataGridViewCell cell = row.Cells["OptimisedSizeColumn"];
                if (cell.Value.ToString() == String.Empty)
                {
                    cell.Value = row.Cells["OriginalSizeColumn"].Value;
                }
                row.Cells["StatusColumn"].Value = "Complete: Original file copied";
            }
        }
Пример #2
0
 void batch_FileProcessFail(object sender, PNGoo.BatchOperations.FileProcessFailEventArgs e)
 {
     DataGridViewRow row = fileBatchDataGridView.Rows[e.FilePathIndex];
     row.Cells["StatusColumn"].Value = String.Format("Error: {0}", e.Error);
 }