private void MakeRequest(CFXEnvelope env) { CFXEnvelope response = null; try { response = MyEndpoint.ExecuteRequest(FactoryLogixMESEndpointUri, env); } catch (Exception ex) { AddToResults($"ERROR OCCURRED MAKING REQUEST TO {FactoryLogixMESEndpointUri}, handle {FactoryLogixMESEndpointHandle}.\nERROR MESSAGE: {ex.Message} \n{ex.StackTrace}"); } if (response.MessageBody is NotSupportedResponse) { NotSupportedResponse r = response.MessageBody as NotSupportedResponse; AddToResults($"NOT SUPPORTED RESPONSE: {r.RequestResult.ResultCode.ToString()}.\n{r.RequestResult.Message}"); } else if (response.MessageBody is ValidateUnitsResponse) { ValidateUnitsResponse r = response.MessageBody as ValidateUnitsResponse; if (r.Result.Result != StatusResult.Success) { AddToResults($"ERROR OCCURRED PROCESSING VALIDATATION REQUEST: {r.PrimaryResult.Result.ToString()}.\n{r.PrimaryResult.Message}"); } else { AddToResults($"VALIDATATION RESULT RECEIVED: {r.PrimaryResult.Result.ToString()}.\n{r.PrimaryResult.Message}"); } } else { AddToResults($"UNEXPLAINED RESPONSE: {response.MessageName}\n{response.ToJson(true)}"); } }
private void ReportAddition(MyEndpoint client) { if (client != null && !clientsListView.Items.Contains(client)) { clientsListView.Items.Add(client); } }
public SendingWindow(MyServer server, MyEndpoint SelectedClient, string FilePath) { this.FilePath = FilePath; this.server = server; this.SelectedClient = SelectedClient; InitializeComponent(); StartSending(); }
private void CloseEndpoint() { if (MyEndpoint != null) { MyEndpoint.Close(); MyEndpoint = null; } RefreshUI(); }
public void IsPartOfRouteTemplate_ReturnsFalse_ForNonRouteEndpoint() { // Arrange MyEndpoint endpoint = new MyEndpoint(c => Task.CompletedTask, EndpointMetadataCollection.Empty, "test"); ODataTemplateTranslateContext translateContext = new ODataTemplateTranslateContext { Endpoint = endpoint }; // Act bool actual = translateContext.IsPartOfRouteTemplate("/{key}"); // Assert Assert.False(actual); }
private void SendStateChange() { if (!IsOpen) { return; } TimeSpan duration = TimeSpan.FromSeconds(1); if (LastStateChange != DateTime.MinValue) { duration = LastStateChange - DateTime.Now; LastStateChange = DateTime.Now; } ResourceState oldState = LastState; ResourceState newState = ResourceState.USD; if (oldState == ResourceState.USD) { newState = ResourceState.PRD; } else { newState = ResourceState.USD; } LastState = newState; // Create a CFXEnvelope containing a new StationStateChanged message CFXEnvelope env = new CFXEnvelope(new StationStateChanged() { OldState = oldState, NewState = newState, OldStateDuration = duration, }); // Publish the message. MyEndpoint.Publish(env); AddToResults($"MESSAGE PUBLISHED:\n {env.ToJson(true)}"); }