Jump to content

Recommended Posts

Posted

This app is a little more complicated that this but I have pared things down to the basics.

The application has a class that implements the IBindingListinterface so I can bind a list of this class to a datagridview. This datagridview has custom progress bar columns that illustrate the progress of a task.

 

I have a list of tasks that I need to show the progress of. These

tasks are started at various times i.e.

 

taskList[0].StartTime = 10:00;

taskList[1].StartTime = 10:30;

taskList[2].StartTime = 11:30;

 

I then have a System.Timers.Timer instance that iterates through each list item in the list and calculates the elapsed timespan converts it to an integer and displays the progress

 

foreach (Task t in taskListBindingSource.List)

 

// Calculate the different timespans in the list, convert them to an integer and display in the datagrid.

 

 

I am quite pleased that the program works but am most dipleased with the foreach loop because that seems dirty to me. The program also hangs frequently after running for 30 mins+ which is unacceptable because I need it running for days at a time. The System.Threading.Timer seems perfect because you can pass the object (or task) into the method that then displays the progress at intervals. I have tried this and found it horribly complicated and confusing, and worse still, you have unpredicable behaviour, i.e. it will start and then stop randomly and you can’t debug it.

 

I feel this is quite a generic problem that a lot of users should be acquainted with, so any pointers would be appreciated.

 

 

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...