static void bgwChannel_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Channel.Channel objChannel = (Channel.Channel)e.Result; IProtocal objChannelProtocal = (IProtocal)objChannel.GetProtocal(); objChannelProtocal.SendMsgEvent += objChannelProtocal_SendMsgEvent; objChannelProtocal.StartCreateData(); }
static void bgwChannel_DoWork(object sender, DoWorkEventArgs e) { try { string strChannelPath = (string)e.Argument; Channel.Channel objChannel = ChannelFactory.CreateChannel(strChannelPath); e.Result = objChannel; } catch (Exception ex) { Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace); } }