Author Topic: Tasks with ReadDwg() to accelerate progress  (Read 48 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 384
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Tasks with ReadDwg() to accelerate progress
« on: November 13, 2017, 07:45:39 am »
Hello !

Someone which have experience with .net Task class and implement multiple Tasks in progress with reading Files ?
Code: [Select]
tasks = new Task<List<File>>[count];
                    string message = string.Empty;
                    int procent = 100 / count;
                    for (int i = 0; i < count; i++)
                    {
                        tasks[i] = new Task<List<File>>(() =>
                        {
                            return ReadBlocks(BlockData.SelectedFiles[i]);
                        });
                        tasks[i].Start();
                        read = tasks[i].Result;
                        toolStripProgressBar1.Value = procent * i;
                    }


I test this Code to read Blockattributes from "unopened" files.
But doing this with Task accelerate not progressing. Who have idea to do it faster by the way ?