c# - Blocking User Process Controller from executing before Control on Winform Fully Loaded and Shown -


i'm creating excel vsto using c#. operation easy, right-click on cell , click on "update" , winform shows progress status prompt out , launch controls on form tied user process controller.

the problem process has launched , executed before form load, there way can block user process controller executing before control on progress status form shown , loaded? image below depict condition.

i have tried put user process controller call in form activated, shown, loaded, , nothing works.

this first stage form loaded. note : 2 line of text has shown user control process has been executed. form stage 1

this second stage form loaded. form stage 2

this third stage form stage 3

and loaded. finally loaded

i have discovered "hack" overcome issue. add in backgroundworker , done follow code on form constructor.

 public summarystatus()  {             initializecomponent();              backgroundworker = new backgroundworker();             backgroundworker.dowork += backgroundworker_dowork;             backgroundworker.runworkercompleted += backgroundworker_runworkercompleted;             backgroundworker.runworkerasync();  } 

and on dowork event of backgroundworker

 void backgroundworker_dowork(object sender, doworkeventargs e)  {             system.threading.thread.sleep(2000);  } 

and finally, added following code in run worker completed

void backgroundworker_runworkercompleted(object sender, runworkercompletedeventargs e) {             updateupc upc = new updateupc();             upc.txtupdatesummary = txtupdateprogress;             upc.updateprogressbar = updateprogressbar;             upc.updatestatusonitem(); } 

i understand above might not acceptable solution might provide workaround issue. however, if has better solution, feel free drop in suggestion.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

node.js - Express and Redis - If session exists for this user, don't allow access -