Implementing stop functionality for downloading data from db in WPF app in MVP
-
Hi In my WPF windows app, with MVP architecture, I have to download data from database into excel sheet with DOWNLOAD button. I have an another button STOP which has to stop the current process of downloading . Say, for eg: I have data to download into 5 excel files, after a min or so, if i click stop button, it shuld stop at the point of downloading and by this time if it had copied to 2 files, then it should remain.. I am trying out for 1. The click of Download btn should start downloading(now its happening.. corrctly..) . But When i click stop it should stop at the point of downloading and retain the data... 2. Also, I have added an wpf progress bar.so the downloading of hte data should be linked with the progress bar data.. i mean if ti takes 170 secs to download from db, the progress bar should display the status of it.. Kindly help me. Thank you, Ramm
-
Hi In my WPF windows app, with MVP architecture, I have to download data from database into excel sheet with DOWNLOAD button. I have an another button STOP which has to stop the current process of downloading . Say, for eg: I have data to download into 5 excel files, after a min or so, if i click stop button, it shuld stop at the point of downloading and by this time if it had copied to 2 files, then it should remain.. I am trying out for 1. The click of Download btn should start downloading(now its happening.. corrctly..) . But When i click stop it should stop at the point of downloading and retain the data... 2. Also, I have added an wpf progress bar.so the downloading of hte data should be linked with the progress bar data.. i mean if ti takes 170 secs to download from db, the progress bar should display the status of it.. Kindly help me. Thank you, Ramm
You need to run your download on another thread. You can then do progress notifications if it's a backgroundworker thread. To do a progress bar, you'd need to read your file a line at a time, so you know where you are at, to report progress. Or you can show progress one file at a time, and stop on that basis. What is MVP architecture, do you mean MVC ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You need to run your download on another thread. You can then do progress notifications if it's a backgroundworker thread. To do a progress bar, you'd need to read your file a line at a time, so you know where you are at, to report progress. Or you can show progress one file at a time, and stop on that basis. What is MVP architecture, do you mean MVC ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Thanks Christian for the inputs. so, the progress bar progress should be captured based on the total time it takes to download? Add all the files downloading time and show it in progress bar as whole?? MVP is Model view presenter. earlier we have Model-View-viewModel...and instead of MVC, we can use MVP architecture too. Presenter has the ways of presenting the user requirements. Thank You, Ramm
-
Thanks Christian for the inputs. so, the progress bar progress should be captured based on the total time it takes to download? Add all the files downloading time and show it in progress bar as whole?? MVP is Model view presenter. earlier we have Model-View-viewModel...and instead of MVC, we can use MVP architecture too. Presenter has the ways of presenting the user requirements. Thank You, Ramm
Krishna Aditya wrote:
so, the progress bar progress should be captured based on the total time it takes to download?
Well, it's up to you to work out what granularity of data you're capable of capturing, the point really is that I think if you have 5 files, five progress steps makes the most sense.
Krishna Aditya wrote:
MVP is Model view presenter. earlier we have Model-View-viewModel...and instead of MVC, we can use MVP architecture too
Sounds overly convoluted to me.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.