The thing that indicate the end of Backgroundworker thread in wpf

Posted by Sudhakar_A under WPF on 1/20/2014 | Points: 10 | Views : 1939 | Status : [Member] | Replies : 0
This ma Code:-

public Window7()
{
InitializeComponent();
string[] Comport = SerialPort.GetPortNames();
port.PortName = Comport.ElementAt(1);
b1.DoWork += B1_DoWork;

}
Button click event:-

private void DispTimer_Click(object sender, RoutedEventArgs e)
{

b1.WorkerReportsProgress = true;
b1.WorkerSupportsCancellation = true;


b1.RunWorkerAsync();
}
Backgroundworker thread Dowork event:-

private void B1_DoWork(object Sender, System.ComponentModel.DoWorkEventArgs e)
{

byte[] a = { 36, 77, 84, 33, 68, 71, 83, 69, 84, 84, 69, 83, 84, 65, 1, 5, 0, 54, 1, 0, 0, 0, 0, 180, 226 };
string Rsocket = Static_ConstantValue.ByteArrayToString(a);
h3 = "Socketalive packet is send successfully";
UpdateTextCallback UpdateMyDelegate = new UpdateTextCallback(Updateemptytext);
textBox1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, UpdateMyDelegate, Convert.ToString(DateTime.Now) + "-" + h3 + "\n" + Rsocket);
//progressBar1.Value = 10;
objRaw.DispOutput = objport.PacketIdentification(port, a, 25, 02, objRaw);
string SocketResponse = Static_ConstantValue.ByteArrayToString(objRaw.DispOutput);
textBox1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, UpdateMyDelegate, Convert.ToString(DateTime.Now) + "-" + "Socket alive Response" + "\n" + SocketResponse);


}

pls help me sort out




Responses

(No response found.)

Login to post response