c# - Is this a good practice to handle the displaying of the progress of data processing in a Class library? -


i developed c# class library, of methods shows information of processing progress because read , write millions of records, , user asked knowing how process going , time should wait.

using dependency injection avoid "if console app write progress on console else if wpf app display progress bar", (1) have got displaying on console time every 1 million records processed if method invoked console application , (2) have got displaying progress bar on gui if method invoked wpf application.

the question here is, practice doing or, there better/correct alternative matter?

my best regards.

please don't this. if building class library, should make 0 assumptions ui interacting user.

your solution sounds might work if have console window or wpf application, if it's being called website or inside service? i've seen many service brought down beause rogue class library trying display dialog there nobody around click ok.

the better solution raise event whenever want report progress, , let consuming ui application worry how wants display progress user.

see how backgroundworker class works model of this: http://msdn.microsoft.com/en-us/library/8xs8549b.aspx


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -