Exemplo n.º 1
0
        public virtual IScreen OpenMeetingForm(FormArgs args)
        {
            var menu = (MeetingForm)SpawnScreen(m_meetingFormPrefab);

            menu.OpenForm(this, args);
            return(menu);
        }
Exemplo n.º 2
0
        public void WhenSubmittingFormItIncludesDefaultValues_Typed(
            [Values("multipart", "urlencoded")] string encType)
        {
            // Arrange
            FormArgs args = new FormArgs();

            //Session.SerializerSettings.

            // Act
            IKeyValueForm form = GetForm(encType: encType);

            using (var r = form.Value(args).Bind().Submit <FormArgs>())
            {
                FormArgs result = r.Body;

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual("text", result.InputText);
                Assert.AreEqual("password", result.InputPassword);
                Assert.AreEqual("checkbox", result.InputCheckbox);
                Assert.AreEqual("hidden", result.InputHidden);
                Assert.AreEqual("textarea", result.TextArea);
                Assert.AreEqual("2", result.Select);
                Assert.AreEqual("1b", result.Radio1);
                Assert.IsNull(result.Radio2);
                //Assert.AreEqual("B,C", result.MultiSelectValue);
                Assert.AreEqual(encType, result.EncType);
            }
        }
Exemplo n.º 3
0
        public void WhenSubmittingFormItOverridesDefaultValues_Typed(
            [Values("multipart", "urlencoded")] string encType)
        {
            // Arrange
            FormArgs args = new FormArgs
            {
                InputText     = "abc",
                InputPassword = "******",
                InputCheckbox = "not",
                TextArea      = "qwe",
                Select        = "3",
                Radio1        = "1a",
                Radio2        = "2b"
                                //MultiSelect = new List<string> { "A", "D" }
            };

            // Act
            IKeyValueForm form   = GetForm(encType: encType);
            FormArgs      result = form.Value(args).Bind().Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("abc", result.InputText);
            Assert.AreEqual("1234", result.InputPassword);
            Assert.AreEqual("not", result.InputCheckbox);
            Assert.AreEqual("hidden", result.InputHidden);
            Assert.AreEqual("qwe", result.TextArea);
            Assert.AreEqual("3", result.Select);
            Assert.AreEqual("1a", result.Radio1);
            Assert.AreEqual("2b", result.Radio2);
            //Assert.AreEqual("A,D", result.MultiSelectValue);
            Assert.AreEqual(encType, result.EncType);
        }
Exemplo n.º 4
0
        public void WhenSubmittingFormItOverridesDefaultValues_Keyed(
            [Values("multipart", "urlencoded")] string encType)
        {
            // Act
            IKeyValueForm form = GetForm(encType: encType);

            form.Value("InputText", "abc");
            form.Value("InputPassword", "1234");
            form.Value("InputCheckbox", "not");
            form.Value("TextArea", "qwe");
            form.Value("Select", "1");
            form.Value("Radio1", "1a");
            form.Value("Radio2", "2b");
            using (var r = form.Bind().Submit <FormArgs>())
            {
                FormArgs result = r.Body;

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual("abc", result.InputText);
                Assert.AreEqual("1234", result.InputPassword);
                Assert.AreEqual("not", result.InputCheckbox);
                Assert.AreEqual("hidden", result.InputHidden);
                Assert.AreEqual("qwe", result.TextArea);
                Assert.AreEqual("1", result.Select);
                Assert.AreEqual("1a", result.Radio1);
                Assert.AreEqual("2b", result.Radio2);
                //Assert.AreEqual("A,D", result.MultiSelectValue);
                Assert.AreEqual(encType, result.EncType);
            }
        }
Exemplo n.º 5
0
        public void ItEitherUsesAcceptCharsetFromFormOrDefaultCharsetWhenSubmitting_Typed(
            [Values("iso-8859-1", "utf-8", "unused")] string charset)
        {
            // Arrange
            FormArgs args = new FormArgs
            {
                InputText = "ÆØÅüì"
            };

            // Act
            IKeyValueForm form          = GetForm(charset: charset);
            Request       submitRequest = form.Value(args).Bind();

            using (var r = submitRequest.Submit <FormArgs>())
            {
                FormArgs result = r.Body;

                // Assert
                if (charset == "unused")
                {
                    charset = Session.DefaultEncoding.WebName;
                }
                Assert.AreEqual(charset, submitRequest.CodecParameter("Charset"));
                Assert.IsNotNull(result);
                Assert.AreEqual("ÆØÅüì", result.InputText);
            }
        }
Exemplo n.º 6
0
        public void ExecuteCustomHandler <T>(object sender, FormArgs frmArgs)
        {
            var     transferDocEntry = frmArgs.Parameters["Instance"];
            dynamic objectInstance   = (T)transferDocEntry;

            objectInstance.Show();
            objectInstance.OnUserFormClosedDone += new UserFormClosedDone(OnUserFormClosed);
            frmInstances.Add(objectInstance);
        }
Exemplo n.º 7
0
        private void OpenLicensePage()
        {
            var emailInput = new MenuItemInfo
            {
                Path        = "Email",
                Text        = "Email",
                Command     = "Email",
                Icon        = null,
                Data        = TMP_InputField.ContentType.EmailAddress,
                CommandType = MenuCommandType.FORM_INPUT
            };

            var keyInput = new MenuItemInfo
            {
                Path        = "License key",
                Text        = "License key",
                Command     = "License key",
                Icon        = null,
                Data        = TMP_InputField.ContentType.Standard,
                CommandType = MenuCommandType.FORM_INPUT
            };

            MenuItemInfo[] formItems = new MenuItemInfo[] { emailInput, keyInput };
            FormArgs       args      = new FormArgs(formItems, "ACTIVATE LICENSE", "Activate", (inputs) =>
            {
                m_webInterface.ActivateUserLicense(inputs[0], inputs[1]).OnRequestComplete(
                    (isNetworkError, message) =>
                {
                    Debug.Log(message);
                    JsonData activateLicenseResult = JsonMapper.ToObject(message);
                    if (activateLicenseResult["success"].ToString() == "True")
                    {
                        Debug.Log("License has been successfully activated. Ok");

                        Error error     = new Error();
                        error.ErrorText = "License has been successfully activated.";
                        m_uiEngine.DisplayResult(error);

                        Observable.TimerFrame(20).Subscribe(_ => OpenLoginPage());
                    }
                    else
                    {
                        Error error     = new Error(Error.E_NotFound);
                        error.ErrorText = activateLicenseResult["error"]["message"].ToString();
                        m_uiEngine.DisplayResult(error);
                        Debug.LogFormat("Error", activateLicenseResult["error"]["message"].ToString(), "Ok");
                    }
                }
                    );
            })
            {
                FormType = FormType.LICENSE
            };

            m_uiEngine.OpenForm(args);
        }
Exemplo n.º 8
0
        public virtual IScreen OpenForm(FormArgs args)
        {
            var menu = SpawnScreen(m_formPrefab);

            if (!(menu is Form))
            {
                throw new InvalidOperationException();
            }

            ((Form)menu).OpenForm(this, args);
            m_menuOn = true;
            return(menu);
        }
Exemplo n.º 9
0
        public void WhenNoActionUrlIsSetItSubmitsToCurrentUrl()
        {
            // Arrange
            FormArgs args = new FormArgs();

            // Act
            IKeyValueForm form   = GetForm("empty");
            FormArgs      result = form.Value(args).Bind("Cancel").Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Cancel", result.Cancel);
        }
Exemplo n.º 10
0
        public void CanSubmitToRelativeActionUrl()
        {
            // Arrange
            FormArgs args = new FormArgs();

            // Act
            IKeyValueForm form   = GetForm("relative");
            FormArgs      result = form.Value(args).Bind("Cancel").Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Cancel", result.Cancel);
        }
Exemplo n.º 11
0
        public void WhenSubmittingByIdItOnlyIncludesValuesFromTheSubmitButtonUsed()
        {
            // Arrange
            FormArgs args = new FormArgs();

            // Act
            IKeyValueForm form   = GetForm();
            FormArgs      result = form.Value(args).Bind("#help-button").Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsNull(result.Save);
            Assert.IsNull(result.Cancel);
            Assert.AreEqual("Help", result.Help);
        }
Exemplo n.º 12
0
        public void WhenSubmittingWithoutNameItIncludesValuesFromFirstSubmitButton()
        {
            // Arrange
            FormArgs args = new FormArgs();

            // Act
            IKeyValueForm form   = GetForm();
            FormArgs      result = form.Value(args).Bind().Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Save", result.Save);
            Assert.IsNull(result.Cancel);
            Assert.IsNull(result.Help);
        }
Exemplo n.º 13
0
        public void WhenSubmittingFormItIncludesDefaultValues_Keyed(
            [Values("multipart", "urlencoded")] string encType)
        {
            // Act
            IKeyValueForm form = GetForm(encType: encType);

            form.Value("Unused", "---");
            FormArgs result = form.Bind().Submit <FormArgs>().Body;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("text", result.InputText);
            Assert.AreEqual("password", result.InputPassword);
            Assert.AreEqual("checkbox", result.InputCheckbox);
            Assert.AreEqual("hidden", result.InputHidden);
            Assert.AreEqual("textarea", result.TextArea);
            Assert.AreEqual("2", result.Select);
            Assert.AreEqual("1b", result.Radio1);
            Assert.IsNull(result.Radio2);
            //Assert.AreEqual("B,C", result.MultiSelectValue);
            Assert.AreEqual(encType, result.EncType);
        }
Exemplo n.º 14
0
        public void CanSubmitWithGetMethod()
        {
            // Arrange
            FormArgs args = new FormArgs
            {
                InputText = "This is a GET",
                Select    = "Select XXX"
            };

            // Act
            IKeyValueForm form = GetForm("relative", encType: "urlencoded", method: "GET");

            using (var r = form.Value(args).Bind("Cancel").Submit <FormArgs>())
            {
                FormArgs result = r.Body;

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual("GET", result.Method);
                Assert.AreEqual(args.InputText, result.InputText);
                Assert.AreEqual(args.Select, result.Select);
            }
        }
Exemplo n.º 15
0
 public void OpenForm(FormArgs args)
 {
     m_standaloneInterface.OpenForm(args);
     m_vrInterface?.OpenForm(args);
 }