public void TestSendGpsLocationForm()
 {
     GpsLocationWidget widget = new GpsLocationWidget();
     widget.Gps = false;
     ValidateSendForm("Submit your current location.", widget);
 }
 public void TestGpsLocationForm()
 {
     string jsonRpcCallId = "jsonrpc id 19347819";
     Messaging.SendFormRequest request = new Messaging.SendFormRequest ();
     request.Member = "*****@*****.**";
     request.ParentKey = null;
     request.Flags = 0;
     request.AlertFlags = 0;
     request.Branding = "A68EBEAB5C962B271BD236AAE6595E5C353B56A650F98B760026CAFA094DB8D1";
     request.Text = "Submit your current location.";
     request.Tag = "my message tag19347819";
     request.Context = null;
     GpsLocationWidget widget = new GpsLocationWidget ();
     widget.Gps = false;
     request.Form.Widget = widget;
     request.Form.PositiveButtonCaption = "Next question";
     request.Form.NegativeButtonCaption = "Stop poll";
     request.Form.NegativeButtonConfirmation = "Do you really want to stop the poll?";
     Messaging.SendFormResponse response = this.Api.Send (request, jsonRpcCallId);
     Assert.IsNotNull (response.Result);
 }
        private Messaging.PokeResponse onPoke(Messaging.PokeRequest request)
        {
            Messaging.PokeResponse response = new Messaging.PokeResponse();

            switch (request.Tag)
            {
            case "mfr":
                FlowCallbackResult flowResult = new FlowCallbackResult();
                flowResult.Flow = FLOW_GPS;
                flowResult.Tag = request.Tag;
                response.Result = flowResult;
                break;
            case "form":
                {
                    GpsLocationWidget gpsLocationWidget = new GpsLocationWidget ();
                    gpsLocationWidget.Gps = false;

                    FormCallbackResult formResult = new FormCallbackResult ();
                    formResult.Form = new Form ();
                    formResult.Tag = request.Tag;
                    formResult.Text = "Submit your location";
                    formResult.Form.PositiveButtonCaption = "Submit";
                    formResult.Form.NegativeButtonCaption = "Cancel";
                    formResult.Form.PositiveButtonUiFlags = UiFlag.WAIT_FOR_NEXT_MESSAGE.Value;
                    formResult.Form.Widget = gpsLocationWidget;
                    response.Result = formResult;
                    break;
                }
            case "test1":
                {
                    TextLineWidget textLineWidget = new TextLineWidget ();
                    textLineWidget.MaxChars = 50;
                    FormCallbackResult formResult = new FormCallbackResult();
                    formResult.Form = new Form();
                    formResult.Tag = request.Tag;
                    formResult.Text = "test 123";
                    formResult.Form.PositiveButtonCaption = "Submit";
                    formResult.Form.NegativeButtonCaption = "Cancel";
                    formResult.Form.PositiveButtonUiFlags = UiFlag.WAIT_FOR_NEXT_MESSAGE.Value;
                    formResult.Form.Widget = textLineWidget;
                    response.Result = formResult;
                    break;
                }
            default:
                break;
            }

            return response;
        }