/// <summary> /// Handle inbound VersionResponseMessage. /// </summary> /// <param name="responseMessage"></param> public void ReceiveResponse(VersionResponseMessage responseMessage) { Trace.WriteLine("VersionResponseMessage received from " + m_RemoteParticipant.Guid.ToString()); m_RemoteVersion = responseMessage.ResponderVersion; if (m_RemoteVersion > VersionExchangeModel.LocalVersion) { m_RemoteCompatibility = responseMessage.Compatibility; m_RecommendedAction = responseMessage.Action; m_WarningMessage = responseMessage.WarningMessage; if (!this.m_LocalNodeIsInstructor) { if ((m_RecommendedAction == VersionIncompatibilityRecommendedAction.IssueWarning) && (m_WarningMessage != null) && (m_WarningMessage != "")) { //Cause a local pop-up warning to be displayed. PresenterModel.TheInstance.VersionExchange.SetPopUpWarning(m_WarningMessage); } } else { //Here we might want to show warning, but aggregate across all participants and show one messagebox. } } else if (m_RemoteVersion < VersionExchangeModel.LocalVersion) { //This node is newer than the remote node, so use the local compatibility matrix // to generate compatibility information. VersionResponseMessage vrm = CompatiblityMatrix.GetVersionResponseMessage(m_RemoteVersion); m_RemoteCompatibility = vrm.Compatibility; m_RecommendedAction = vrm.Action; m_WarningMessage = vrm.LocalWarningMessage; //If the local node is an instructor and if the local node has a later version, we send one more // response back to the client since our verison of the compatibility matrix may have information // that the client's matrix doesn't have. if (this.m_LocalNodeIsInstructor) { using (Synchronizer.Lock(this.SyncRoot)) { this.SetPublishedProperty("SendVersionResponse", ref this.m_SendVersionResponse, vrm); } } //Are there any cases where we want to raise events? If so, the code can be added later as needed. } else { //Versions are equal. We fully expect compatiblity in this case. m_RemoteCompatibility = responseMessage.Compatibility; m_RecommendedAction = responseMessage.Action; m_WarningMessage = responseMessage.WarningMessage; } }
/// <summary> /// Handle inbound VersionRequestMessage from this participant. Always respond. /// </summary> /// <param name="version"></param> internal void ReceiveRequest(Version version) { m_RemoteVersion = version; VersionResponseMessage vrm = CompatiblityMatrix.GetVersionResponseMessage(m_RemoteVersion); //If local is newer or equal, populate compatibility information from the local matrix if (m_RemoteVersion <= VersionExchangeModel.LocalVersion) { m_RemoteCompatibility = vrm.Compatibility; m_RecommendedAction = vrm.Action; m_WarningMessage = vrm.LocalWarningMessage; } //Set the property to cause the Network Service to send the response. using (Synchronizer.Lock(this.SyncRoot)) { this.SetPublishedProperty("SendVersionResponse", ref this.m_SendVersionResponse, vrm); } }