Esempio n. 1
0
    public GetSCADAAnalogBySCADAPointIDResponse GetSCADAAnalogBySCADAPointID(GetSCADAAnalogBySCADAPointIDRequest request)
    {
        Random r = new Random();
        GetSCADAAnalogBySCADAPointIDResponse response = new GetSCADAAnalogBySCADAPointIDResponse();

        try
        {
            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.TimeStampSpecified                  = true;
            response.MultiSpeakMsgHeader.TimeStamp                           = DateTime.Now;
            response.GetSCADAAnalogBySCADAPointIDResult                      = new scadaAnalog();
            response.GetSCADAAnalogBySCADAPointIDResult.objectID             = request.scadaPointID;
            response.GetSCADAAnalogBySCADAPointIDResult.value                = new value();
            response.GetSCADAAnalogBySCADAPointIDResult.value.units          = uom.V;
            response.GetSCADAAnalogBySCADAPointIDResult.value.unitsSpecified = true;
            response.GetSCADAAnalogBySCADAPointIDResult.value.Value          = (float)r.NextDouble();
            return(response);
        }
        catch (Exception ex)
        {
            errorObject[] eObject = new errorObject[1];
            eObject[0]       = new errorObject();
            eObject[0].Value = ex.Message;
            return(response);
        }
    }
 private void buttonGetScadaAnalogByScadaPointId_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         GetSCADAAnalogBySCADAPointIDRequest request = new GetSCADAAnalogBySCADAPointIDRequest();
         request.scadaPointID               = (String)comboBoxAnalogPointIDs.SelectedValue;
         request.MultiSpeakMsgHeader        = new MultiSpeakMsgHeader();
         request.MultiSpeakMsgHeader.UserID = textBoxUserName.Text;
         request.MultiSpeakMsgHeader.Pwd    = passwordBoxPassword.Password;
         GetSCADAAnalogBySCADAPointIDResponse response = _Proxy.GetSCADAAnalogBySCADAPointID(request);
         if (response == null)
         {
             DisplayMsg("MockSCADAServerService RESPONSE IS NULL");
             return;
         }
         if (response.MultiSpeakMsgHeader == null)
         {
             DisplayMsg("MockSCADAServerService RESPONSE IS MISSIMG MSGHEADER");
             return;
         }
         if (response.GetSCADAAnalogBySCADAPointIDResult == null)
         {
             DisplayMsg("MockSCADAServerService GetMethodsResult IS NULL");
             return;
         }
         scadaAnalog analog = response.GetSCADAAnalogBySCADAPointIDResult;
         if (analog.objectID == (String)comboBoxAnalogPointIDs.SelectedValue)
         {
             textBoxAnalogValue.Text = String.Format("{0:0.00000} {1}", analog.value.Value, analog.value.units);
         }
         else
         {
             DisplayMsg(String.Format("objectID: {0} does not match {1}", analog.objectID, (String)comboBoxStatusPointIDs.SelectedValue));
         }
     }
     catch (Exception ex)
     {
         DisplayMsg(String.Format("ex: {0}", ex.Message));
     }
 }