c# - Having trouble getting a progress bar to run -
c# - Having trouble getting a progress bar to run -
in programme have file input operation pretty lengthy. during operation, application freezes until file loaded (as in, can't click on anything). due this, trying implement progress bar loading screen user not think wrong. have created .xaml window progress bar , attached viewmodel , datamodel facilitate properties of progress bar.
for simplicity, routines run on file open located in big while
loop. before while loop open loading window , alter progress bar's isindeterminate
property true
.
i utilize isindeterminate
property because need progress bar this:
however, mentioned earlier, during process window freezes. causing progress bar freeze. how can display progress bar , allow run while go through file input process?
edit
xaml progress bar:
<progressbar name="progress" value="{binding loadscreenmodel.value}" minimum="{binding loadscreenmodel.min}" maximum="{binding loadscreenmodel.max}" isindeterminate="{binding loadscreenmodel.isindeterminate}" />
data model progress bar window:
private int _value, _min = 0, _max = 100; //progress bar values private bool _isindeterminate; public loadingscreendatamodel() { } //progress bar values public int value{...} public int min{...} public int max{...} public bool isindeterminate{...}
code in info model runs file input routines:
var loadingwindow = new loadingscreen(); loadingwindow.show(); //open window w/progress bar viewmodel.loadscreendatamodel.isindeterminate = true; while() {... /* run file input routines **/ ...} viewmodel.loadscreendatamodel.isindeterminate = false; loadingwindow.close(); //close window w/progress bar
c# wpf file-io progress-bar
Comments
Post a Comment