private void buttonPingURL_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PingURLRequest request = new PingURLRequest();
         request.MultiSpeakMsgHeader        = new MultiSpeakMsgHeader();
         request.MultiSpeakMsgHeader.UserID = textBoxUserName.Text;
         request.MultiSpeakMsgHeader.Pwd    = passwordBoxPassword.Password;
         PingURLResponse response = _Proxy.PingURL(request);
         if (response == null)
         {
             DisplayMsg("MockSCADAServerService IS RUNNING BUT RESPONSE IS NULL");
             return;
         }
         if (response.MultiSpeakMsgHeader == null)
         {
             DisplayMsg("MockSCADAServerService IS RUNNING BUT RESPONSE IS MISSIMG MSGHEADER");
             return;
         }
         if ((response.PingURLResult != null) && (response.PingURLResult.Length > 0))
         {
             DisplayMsg(String.Format("MockSCADAServerService ERROR:{0}", response.PingURLResult[0].errorString));
             return;
         }
         DisplayMsg(String.Format("MockSCADAServerService BUILD:{0} IS RUNNING", response.MultiSpeakMsgHeader.Build));
         return;
     }
     catch (Exception ex)
     {
         DisplayMsg(String.Format("ex: {0}", ex.Message));
     }
 }
예제 #2
0
    public PingURLResponse PingURL(PingURLRequest request)
    {
        PingURLResponse response = new PingURLResponse();

        try
        {
            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.MinorVersion       = "4";
            response.MultiSpeakMsgHeader.MinorVersion       = "1";
            response.MultiSpeakMsgHeader.Build              = "73"; // 8
            response.MultiSpeakMsgHeader.BuildString        = BuildDescriptor.Release;
            response.MultiSpeakMsgHeader.AppName            = "DCSystems";
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;

            //errorObject[] eObject = new errorObject[1];
            //eObject[0] = new errorObject();
            //eObject[0].eventTime = DateTime.Now;
            //eObject[0].eventTimeSpecified = true;
            //response.PingURLResult = eObject;
            return(response);
        }
        catch (Exception ex)
        {
            response.PingURLResult                = new errorObject[1];
            response.PingURLResult[0].objectID    = "DCSystem";
            response.PingURLResult[0].errorString = ex.Message;
            return(response);
        }
    }
 private void buttonFlushLogs_Click(object sender, RoutedEventArgs e)
 {
     try {
         PingURLRequest  request  = new PingURLRequest();
         PingURLResponse response = _Proxy.FlushLog(request);
         DisplayMsg(response.PingURLResult[0].errorString);
     } catch (Exception ex) {
         DisplayMsg(String.Format("ex: {0}", ex.Message));
     }
 }
예제 #4
0
    public PingURLResponse PingURL(PingURLRequest request)
    {
        LogInfo("PingURL() Entered");
        PingURLResponse response = new PingURLResponse();

        try
        {
            if (_UdpClient == null)
            {
                String            path = @"C:\\DCSystems\Logs\";
                ConfigurationList cl   = new ConfigurationList();
                cl.Add("Process Name", "MockNotServerService");
                cl.Add("Log Output Directory", path);
                _Logger = new Logger(cl);

                LogInfo("()");

                _UdpClient = new UdpClient();
                _UdpClient.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7373));
            }
            Byte[] sendBytes = Encoding.ASCII.GetBytes("PingURL,OK");
            _UdpClient.Send(sendBytes, sendBytes.Length);

            response.MultiSpeakMsgHeader = new MultiSpeakMsgHeader();
            response.MultiSpeakMsgHeader.MinorVersion       = "4";
            response.MultiSpeakMsgHeader.MinorVersion       = "1";
            response.MultiSpeakMsgHeader.Build              = "8";
            response.MultiSpeakMsgHeader.BuildString        = BuildDescriptor.Release;
            response.MultiSpeakMsgHeader.AppName            = "DCSystems";
            response.MultiSpeakMsgHeader.TimeStamp          = DateTime.Now;
            response.MultiSpeakMsgHeader.TimeStampSpecified = true;

            //errorObject[] eObject = new errorObject[1];
            //eObject[0] = new errorObject();
            //eObject[0].eventTime = DateTime.Now;
            //eObject[0].eventTimeSpecified = true;
            //response.PingURLResult = eObject;
            return(response);
        }
        catch (Exception ex)
        {
            LogError(String.Format("PingURL() ex:{0}", ex));
            response.PingURLResult                = new errorObject[1];
            response.PingURLResult[0].objectID    = "DCSystem";
            response.PingURLResult[0].errorString = ex.Message;
            return(response);
        }
    }
예제 #5
0
    public PingURLResponse FlushLog(PingURLRequest request)
    {
        LogInfo("FlushLog() Entered");
        PingURLResponse response = new PingURLResponse();

        response.PingURLResult    = new errorObject[1];
        response.PingURLResult[0] = new errorObject();
        try {
            if (_Logger != null)
            {
                _Logger.flush();
                response.PingURLResult[0].errorString = "OK";
            }
        } catch (Exception ex) {
            LogError(String.Format("FlushLog() ex:{0}", ex));
            response.PingURLResult[0].errorString = ex.Message;
        }
        return(response);
    }