Search code examples
c#winformsmethodsstatic-classes

Send progress information from static class to main class


My main class uses several static classes to fetch data from internet. Sometimes there are lots of data to fetch, and that takes some time. Is there any way for static class to report its progress to main class? Not only percent, but text also.

Thanks!


Solution

  • I am not sure of your exact situation, but if you create static variables in your static class to hold current status and update them in the methods which you are calling from your main class it will work. for instance create a static variable called percentcompleted in static class and keep updating the value of it in the static class methods. then keep reading the value of it in the main class at regular intervals.