private void ZmqStatusListener(string endPoint) { using (Context context = new Context()) { StatusPort = string.Empty; TestResultPort = string.Empty; using (Socket server = context.Socket(SocketType.REP)) { try { if (isStatusContextActive == false || isPortChanged == true) { server.Bind(endPoint); isStatusContextActive = true; } } catch (ZMQ.Exception ex) { if (ex.Errno != 100) { string IPCPort = _globalParameters.GlbParam.GlbParamIpcStartPort; if (IPCPort == string.Empty) { IPCPort = "0"; } if (endPoint == EditorConstants.PortAddress.PortPrefix + IPCPort) { StatusPort = endPoint; TestReultError = EditorConstants.CommonMessageTypes.TestReultError + ex.Message + EditorConstants.CommonMessageTypes.StackTraceMessage + ex.StackTrace; } StopExecOfScript(default(object)); isCancelledtask = true; ScriptStatusDesc = new ScriptStatusDesc() { Status = "Failed", statusDescription = "Failed" }; } } while (true) { string message = server.Recv(Encoding.UTF8); UpdateTestResults(message); server.Send(" ACK", Encoding.UTF8); // if (message == "Test Passed") //break; } } } }
Quote:We were able to solve the issue by getting clues doing a sample app to reproduce the issue and to first know whether our ClrZmq pattern was correct for us or not and it is correct. The resolution we followed is that when we needed to bind that data to its corresponding View's Model object in its ViewModel so had to retrieve View's DataContext which is of Type ISomeXViewModel for the particular TestStation using an Id of that TestStation we did this cos all of our TestStations are dynamically added and we even store it to be accessed wherever necessary. This issue was caused to due multiple instances of UserControls so we explicitly needed to update the TestStation manually with a little more effort. Sample Code Snippet private void BindTestResult(string xmlPayLoad) { // converting xmlPalLoad to a class/model object ITestStationViewModel viewModel = (ITestStationViewModel)((IView)DynamicTestStationsGrid.Children[StationNumber].Content).DataContext; // IView class has DataContext property so I am type casting the Content which is ContentControl to IView type first and later to ITestStationViewModel viewModel.TestStationModel = xmlPayLoadModel; } Thanks.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)