Ejemplo n.º 1
0
    public void ValidateInput()
    {
        if (isNewObject)
        {
            ConfirmButton.SetInteractivity(true);
            return;
        }

        bool valid = ((string)nameInput.GetValue()) != selectedObject.GetName();

        ConfirmButton.SetInteractivity(valid, "Name has not been changed");
    }
Ejemplo n.º 2
0
    public async void ValidateInput()
    {
        bool valid = true;

        if (string.IsNullOrEmpty((string)nameInput.GetValue()))
        {
            ConfirmButton.SetInteractivity(false, "Name cannot be empty");
            valid = false;
        }
        else if (string.IsNullOrEmpty(valueInput.Input.text) && selectedType != ProjectParameterTypes.boolean)
        {
            ConfirmButton.SetInteractivity(false, "Value cannot be empty");
            valid = false;
        }

        if (!isNewConstant)
        {
            if (((string)nameInput.GetValue()) == projectParameter.Name && valueInput.Input.text == projectParameter.Value)    //known bug: always false when parameter's type is double or boolean
            {
                ConfirmButton.SetInteractivity(false, "Project parameter unchanged");
                valid = false;
            }
        }

        if (!valid)
        {
            return;
        }

        try {
            await Confirm(true);

            ConfirmButton.SetInteractivity(true);
        } catch (RequestFailedException e) {
            ConfirmButton.SetInteractivity(false, e.Message);
        }
    }