//----< receive thread processing >------------------------------ void ThreadProc() { while (true) { rcvdMsg = recvr.GetMessage(); // call window functions on UI thread this.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, OnNewMessage, rcvdMsg); } }
//----< called by UI thread when dispatched from rcvThrd >------- void OnNewMessageHandler(SvcMsg msg) { if (msg.cmd.ToString().Equals("ProjectList")) { messageCounter++; message_listbox.Items.Insert(0, " "); message_listbox.Items.Insert(0, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff")); message_listbox.Items.Insert(0, messageCounter + ". Response for ProjectList From: " + msg.src.ToString()); listbox1.Items.Clear(); List <string> projectList = pc.getProjectList(msg.body.ToString()); if (projectList != null) { foreach (string s in projectList) { listbox1.Items.Add(s); } } else { dependency_Result.Items.Add("There is Projects Available on Server"); } } if (msg.cmd.ToString().Equals("Dependency")) { messageCounter++; message_listbox.Items.Insert(0, " "); message_listbox.Items.Insert(0, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff")); message_listbox.Items.Insert(0, messageCounter + ". Response for Dependency From: " + msg.src.ToString()); pc.outGoingResultAnalysis(msg.body.ToString()); // dependency_Result.Text = msg.body.ToString(); } if (msg.cmd.ToString().Equals("DependencyAll")) { pc.inComingResultAnalysis(msg.body.ToString()); } }