public ReportSystem(System.Drawing.Icon icon = null, StandardBrowserViewer tabViewer = null, ProgressBar.ProgressBar progressBar = null) { if (icon != null) { Icon = icon; } TabViewer = tabViewer; ProgressBar = progressBar; }
static void Main(string[] args) { //Console.WriteLine("Simplest usage"); //var pb = new ProgressBar(50); //pb.Refresh(0, "connecting to server to download 50 files sychronously."); //Console.ReadLine(); //pb.Refresh(5, "downloading file 5"); //Console.ReadLine(); //pb.Refresh(50, "finished."); //return; // demo; take the first 10 directories that have files from c:\windows, and then pretends to process (list) them. // processing of each directory happens on a different thread, to simulate multiple background tasks, // e.g. file downloading. // ============================================================================================================== var dirs = Directory.GetDirectories(@"c:\windows").Where(d=> Directory.GetFiles(d).Count()>0).Take(7); var tasks = new List<Task>(); var bars = new List<ProgressBar.ProgressBar>(); foreach (var d in dirs) { var dir = new DirectoryInfo(d); var files = dir.GetFiles().Take(50).Select(f=>f.FullName).ToArray(); if (files.Count()==0) continue; var bar = new ProgressBar.ProgressBar(files.Count()); bars.Add(bar); bar.Refresh(0, d); tasks.Add(new Task(() => ProcessFiles(d, files, bar))); } Console.WriteLine("ready press enter."); Console.ReadLine(); foreach (var t in tasks) t.Start(); Task.WaitAll(tasks.ToArray()); Console.WriteLine("done."); Console.ReadLine(); }
public ReportSystem(MiMFa_ReportLanguage mRL, StandardBrowserViewer tabViewer = null, ProgressBar.ProgressBar progressBar = null) { MRL = mRL; TabViewer = tabViewer; ProgressBar = progressBar; }