示例#1
0
    void OnGUI()
    {
        try
        {
            if (_lastException != null)
            {
                // JJ.Framework.Logging does not workon Windows Phone 8, because it references something out of System.Diagnostics that is not supported
                //string exceptionMessage = ExceptionHelper.FormatExceptionWithInnerExceptions(_lastException, includeStackTrace: true);
                string exceptionMessage = _lastException.Message;

                GUI.Label(new Rect(0, 0, 580, 3000), exceptionMessage);
                if (GUI.Button(new Rect(580, 0, 100, _lineHeight), "Clear"))
                {
                    _lastException = null;
                }
                return;
            }

            int y = _spacing;

            GUI.Label(new Rect(_spacing, y, _width, _lineHeight), "SOAP Test", _labelStyle);

            y += _lineHeight;
            y += _spacing;

            if (GUI.Button(new Rect(_spacing, y, _width, _lineHeight), "Send Request"))
            {
                string url                   = "http://83.82.26.17:6371/SetTextAppService.svc";
                string operationName         = "Show";
                string interfaceName         = "ISetTextAppService";
                string soapAction            = String.Format("http://tempuri.org/{0}/{1}", interfaceName, operationName);
                int    timeoutInMilliseconds = 3000;

                string stringToSend = GetStringToSend();
                _messageSender = new AsyncSoapMessageSender(url, soapAction, stringToSend, timeoutInMilliseconds);
            }
            y += _lineHeight;
            y += _spacing;

            if (_messageSender != null)
            {
                _resultString = _messageSender.TryGetResponse();
                if (!String.IsNullOrEmpty(_resultString))
                {
                    _messageSender = null;
                }
            }

            if (_resultString != null)
            {
                GUI.Label(new Rect(_spacing, y, 400, 600), _resultString, _labelStyle);
            }
        }
        catch (Exception ex)
        {
            _lastException = ex;
        }
    }
示例#2
0
    private void SendMessage_Async_UsingGameLoop()
    {
        string url                   = "http://83.82.26.17:6371/SetTextAppService.svc";
        string operationName         = "Show";
        string interfaceName         = "ISetTextAppService";
        string soapAction            = String.Format("http://tempuri.org/{0}/{1}", interfaceName, operationName);
        int    timeoutInMilliseconds = 3000;

        string stringToSend = GetStringToSend();

        _asyncMessageSender = new AsyncSoapMessageSender(url, soapAction, stringToSend, timeoutInMilliseconds);
    }
示例#3
0
    void OnGUI()
    {
        try
        {
            if (_lastException != null)
            {
                string exceptionMessage = ExceptionHelper.FormatExceptionWithInnerExceptions(_lastException, includeStackTrace: true);

                GUI.Label(new Rect(0, 0, 580, 3000), exceptionMessage);
                if (GUI.Button(new Rect(580, 0, 100, _lineHeight), "Clear"))
                {
                    _lastException = null;
                }
                return;
            }

            int y = _spacing;

            GUI.Label(new Rect(_spacing, y, _width, _lineHeight), "SOAP Test", _labelStyle);

            y += _lineHeight;
            y += _spacing;

            if (GUI.Button(new Rect(_spacing, y, _width, _lineHeight), "Send Request"))
            {
                SendMessage_Async_UsingGameLoop();
                //SendMessage_Async_UsingThread();
            }
            y += _lineHeight;
            y += _spacing;

            if (_asyncMessageSender != null)
            {
                _resultString = _asyncMessageSender.TryGetResponse();
                if (!String.IsNullOrEmpty(_resultString))
                {
                    _asyncMessageSender = null;
                }
            }

            if (_resultString != null)
            {
                GUI.Label(new Rect(_spacing, y, 400, 600), _resultString, _labelStyle);
            }
        }
        catch (Exception ex)
        {
            _lastException = ex;
        }
    }