private void buttonGetAllScadaPoints_Click(object sender, RoutedEventArgs e) { try { GetAllSCADAPointsRequest request = new GetAllSCADAPointsRequest(); request.MultiSpeakMsgHeader = new MultiSpeakMsgHeader(); request.MultiSpeakMsgHeader.UserID = textBoxUserName.Text; request.MultiSpeakMsgHeader.Pwd = passwordBoxPassword.Password; request.lastReceived = _LastReceived; GetAllSCADAPointsResponse response = _Proxy.GetAllSCADAPoints(request); if (response == null) { DisplayMsg("MockSCADAServerService RESPONSE IS NULL"); return; } if (response.MultiSpeakMsgHeader == null) { DisplayMsg("MockSCADAServerService RESPONSE IS MISSIMG MSGHEADER"); return; } if (response.GetAllSCADAPointsResult == null) { DisplayMsg("MockSCADAServerService GetMethodsResult IS NULL"); return; } if (_LastReceived == String.Empty) { comboBoxAnalogPointIDs.Items.Clear(); comboBoxStatusPointIDs.Items.Clear(); } for (int i = 0; i < response.GetAllSCADAPointsResult.Length; i++) { scadaPoint point = response.GetAllSCADAPointsResult[i]; if (point.scadaPointType == scadaPointType.analog) { comboBoxAnalogPointIDs.Items.Add(point.objectName); } else { comboBoxStatusPointIDs.Items.Add(point.objectName); } } comboBoxAnalogPointIDs.SelectedIndex = 0; comboBoxStatusPointIDs.SelectedIndex = 0; if (Int32.Parse(response.MultiSpeakMsgHeader.ObjectsRemaining) == 0) { _LastReceived = String.Empty; } else { _LastReceived = response.MultiSpeakMsgHeader.LastSent; } } catch (Exception ex) { DisplayMsg(String.Format("ex: {0}", ex.Message)); } }
public GetAllSCADAPointsResponse GetAllSCADAPoints(GetAllSCADAPointsRequest request) { const int NUM_POINTS = 2048; GetAllSCADAPointsResponse response = new GetAllSCADAPointsResponse(); try { response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader(); response.MultiSpeakMsgHeader.TimeStampSpecified = true; response.MultiSpeakMsgHeader.TimeStamp = DateTime.Now; response.MultiSpeakMsgHeader.ObjectsRemaining = "0"; // ??????????????????????????? response.GetAllSCADAPointsResult = new scadaPoint[NUM_POINTS]; bool analog = true; for (int i = 0; i < NUM_POINTS; i++) { response.GetAllSCADAPointsResult[i] = new scadaPoint(); if (analog) { response.GetAllSCADAPointsResult[i].objectName = string.Format("Analog{0:0000}", i); response.GetAllSCADAPointsResult[i].scadaPointType = scadaPointType.analog; } else { response.GetAllSCADAPointsResult[i].objectName = string.Format("Status{0:0000}", i); response.GetAllSCADAPointsResult[i].scadaPointType = scadaPointType.status; } response.GetAllSCADAPointsResult[i].scadaPointTypeSpecified = true; analog = !analog; } return(response); } catch (Exception ex) { errorObject[] eObject = new errorObject[1]; eObject[0] = new errorObject(); eObject[0].Value = ex.Message; return(response); } }