C# cancelling DoWork of background worker

前端 未结 4 1698
春和景丽
春和景丽 2021-02-06 15:50

C# 2008

I am using the code below to login to a softphone. However, the login progess is a long process as there are many things that have to be initialized and checks t

4条回答
  •  隐瞒了意图╮
    2021-02-06 16:10

    Within your DoWork() function you wrote .... Depending on how many tasks of the same structure are coming like the displayed two one, you could refactor this structure into an own method, giving the changing parts as parameters.

    Also this InvokeRequired if-else branch has doubled the output string. A little search here on stackoverflow or on the web should show you a pattern to accomplish this doubling.

    Evernything else looks quite good.

提交回复
热议问题