article search result of 'BackgroundWorker' : 1

  1. 2010.12.04 [BackGroundWorkerTEST] Sync , Async , Thread (282)

[BackGroundWorkerTEST] Sync , Async , Thread

주요 Code


Created with colorer-take5 library. Type 'csharp'

        private void testCodeSync()
            using (System.Net.WebClient wc = new System.Net.WebClient())
                wc.DownloadFile(streamPath, "test_"+checkTime.ToString()+currentState+".tmp");
            stateTx.Text = currentState + " :: done";

        private void testCodeAsync()
            using (System.Net.WebClient wc = new System.Net.WebClient())
                wc.DownloadFileAsync(streamPath, "test_" + checkTime.ToString() + currentState + ".tmp");
            stateTx.Text = currentState + " :: done";

        BackgroundWorker bw = new BackgroundWorker();
        void BGWorker()
            //bw = new BackgroundWorker();
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
            //RunWorkerCompleted 이벤트 안에서는 윈폼 스레드로 돌아와 안전��게 컨트롤 할�� 있다.
            stateTx.Text = currentState + " :: done";

        void bw_DoWork(object sender, DoWorkEventArgs e)
            using (System.Net.WebClient wc = new System.Net.WebClient())
                wc.DownloadFile(streamPath, "test_" + checkTime.ToString() + currentState + ".tmp");
            //에러! : 크로스 스레딩 ( 스레드가 다르다 )
            //stateTx.Text = currentState + " :: done";
인터넷 속도가 빠를경우 테스트가 잘 되지 않지만 Async 도 처음에 실행할때는 약간의 딜레이가 생긴다
sync 는 항상 딜레이가 생긴다.
테스트 타겟은 구글의 메인페이지 이다.
C# 2010. 12. 4. 02:26

댓글을 달아 주세요

  1. 이전 댓글 더보기
  2. BlogIcon Fitflop NZ Sale Online 2014.10.14 18:14  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  3. BlogIcon meizitang botanical slimming 2014.10.23 13:50  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  4. BlogIcon meizitang 2014.10.28 12:29  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  5. BlogIcon mont blanc fountain pen��mont blanc pen��mont blanc pens��mont b 2014.10.28 12:30  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  6. BlogIcon Buy macbook pro from china 2014.11.01 21:28  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  7. BlogIcon burberry shawl 2014.11.01 23:27  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  8. BlogIcon moncler flavienne quilted jacket 2014.11.09 10:36  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  9. BlogIcon 眼镜批发 2014.11.12 00:50  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  10. BlogIcon Buy Samsung Phones 2014.11.12 03:16  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  11. BlogIcon moncler 70 tal 2014.11.12 11:44  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  12. BlogIcon moncler bambino shop online 2014.11.12 11:46  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  13. 匿名 2015.01.07 17:45  수정/삭제  댓글쓰기

    이용약관위배로 관리자 삭제된 댓글입니다.

  14. 匿名 2015.02.06 14:13  수정/삭제  댓글쓰기















  15. BlogIcon clubmaster Sunglasses 2015.03.05 17:04  수정/삭제  댓글쓰기

    다없the best way we'd like most efficientmedical attentidirectly to stick fitand fit same way our pets also desirecare, medical attention and prefer to stick fitand fit. additionally they get illness and disease hence additionally they require smartdoctors specialized to offer them hospital therapy. Doctors who're specialized in giving hospital therapy and attentidirectly to animals are referred to as그있

  16. 匿名 2015.03.31 08:50  수정/삭제  댓글쓰기

    단에Another challenge is of course the selection of the fastest checkout line in the supermarket, a feat that requires a vast array of skills and experience combining the assessment of shopper behavior (cash vs. check,Popular Shopping Destinations, self bagging vs. the delegation of bagging, possession of a store discount card vs. the often fictionalized "my spouse has the store discount card"), the k는없

  17. 匿名 2015.04.01 06:28  수정/삭제  댓글쓰기

    방일Black and military green. Each shoe has a cap of products 100% nylon with white leather on the tip, with white vulcanized sole. The following is a list detailing details log on to Nike Air Max 90.

    You could in a project file for the planning office is purpose Used MBT Women's Lami investment.Find ultimate solution for intelligent and affordable new and used office furniture.

    Quite ofte법법

  18. 匿名 2015.04.03 13:49  수정/삭제  댓글쓰기

    가메They are comfortable and keep your feet feel different! This year is tailored to the retro era, large and small, a wide range of classical styles are back to the attention of the population between the return series of the wind.

    Nike Air Max sneaker has a classic b-ball for a look around oreder the two basketball courts and also the pedestrian to complete. Nike Air Max 95, a draft model Spo수메

  19. 匿名 2015.04.03 17:37  수정/삭제  댓글쓰기

    있선Security Headaches

    O.K., so the iPad really won't reduce any costs in my business. Can we justify its business ROI through increased employee productivity? Ha! You try using one of those things for a few hours and then tell me how much actual work you accomplished. It's just too damn fun.

    Clients are going to ask me why I don't recommend it for their business. My employees are going 어알

  20. 匿名 2015.04.04 02:54  수정/삭제  댓글쓰기


    Fulfill Your Pocket Bike Desires with Mini Chopper Bikes


    There are those among us who collect big toys not just for the sake of displaying them, but also of enjoying them to the fullest. Pocket bikes,How to Read a Woman's Body La, for example, are there to be ridden and seen in public in,Online Shopping- Choosing Awe, and customi관알

  21. 匿名 2015.04.09 00:24  수정/삭제  댓글쓰기

    서방Like the above, knitted hat and a jacket with a lining seam searsucker-like. We're not normally a heavy logo'd pieces, but the embroidered letters feels like a part of the winter-generic design.

    Few have left thoughts about the current collection. Moncler is not for everyone because not everyone can come from the look of nyloned painted in a bright color, but there are some interesting piec일있

Powerd by Tistory, designed by criuce