.net - C# Ionic.Zip progressbar as background worker -
i got following code:
string path = environment.currentdirectory; private void button1_click(object sender, eventargs e) { using (zipfile zip = zipfile.read("fringe.s03e07.hdtv.xvid-lol.zip")) { zip.extractprogress += extractprogress; foreach (zipentry file in zip) { file.extract(path+"\\temp", extractexistingfileaction.overwritesilently); } } } public void extractprogress(object sender, extractprogresseventargs e) { if (e.eventtype == zipprogresseventtype.extracting_entrybyteswritten) { //bytes transfered of current file label4.text = e.bytestransferred.tostring(); } else if (e.eventtype == zipprogresseventtype.extracting_beforeextractentry) { //filename of current extracted file label2.text = e.currententry.filename; } }
when click on button, form stuck. want make extractprogress background worker when dont know how convert function backgroundworker function because extractprogress function require extractprogresseventargs e , backgroundworker_dowork function require doworkeventargs e.
if can me convert or give me solution great!
simple: put all code in button1_click
method, , have button1_click
run method in backgroundworker
. try , see how works out.
Comments
Post a Comment