public override void Open()
        {
            base.Open();
            oldPassInput.SetTextWithoutNotify("");
            newPassInput.SetTextWithoutNotify("");
            repeatPassInput.SetTextWithoutNotify("");

            oldPasswordObserver = new CredentialsObserver(ContextControler.oldPassword)
            {
                onValueChanged = x =>
                {
                    changeButton.interactable = AllCorrect;
                    if (oldPasswordHint.text != string.Empty)
                    {
                        oldPasswordHint.SetText("HINT_PASSWORD_OLD".Translated());
                    }
                }
            }.Setup();

            ContextControler.PropertyChanged += OnErrorMessage;

            repeatObserver = new CredentialsObserver(ContextControler.repeatNewPassword)
            {
                onEmptyValue   = x => repeatHint.SetText("HINT_PASSWORD_REPEAT".Translated()),
                onInvalidValue = x => repeatHint.SetText("HINT_PASSWORD_MISMATCH".Translated()),
                onValidValue   = x => repeatHint.SetText("HINT_PASSWORD_MATCH".Translated()),
                onValueChanged = x => changeButton.interactable = AllCorrect,
            }.Setup();

            passwordObserver = new CredentialsObserver(ContextControler.newPassword)
            {
                onEmptyValue   = x => passwordHint.SetText("HINT_PASSWORD_NEW".Translated()),
                onInvalidValue = x => passwordHint.SetText("HINT_PASSWORD_RULES".Translated()),
                onValidValue   = x => passwordHint.SetText("HINT_PASSWORD_OK".Translated()),
                onValueChanged = x => {
                    repeatObserver.Observed.Validate();
                    changeButton.interactable = AllCorrect;
                }
            }.Setup();

            changeButton.interactable = AllCorrect;

            //Colors
            repeatColors      = new CredentialsTextColors(repeatHint, repeatObserver);
            passwordColors    = new CredentialsTextColors(passwordHint, passwordObserver);
            oldPasswordColors = new CredentialsTextColors(oldPasswordHint, oldPasswordObserver);
        }
예제 #2
0
#pragma warning restore IDE0052 // Remove unread private members

        public override void Open()
        {
            base.Open();
            userNameInput.SetTextWithoutNotify("");
            passwordInput.SetTextWithoutNotify("");
            repeatInput.SetTextWithoutNotify("");

            userNameObserver = new CredentialsObserver(ContextControler.NewUserName)
            {
                onEmptyValue   = x => userNameHint.SetText("HINT_USER_DESC".Translated()),
                onInvalidValue = x => userNameHint.SetText("HINT_USER_RULES".Translated()),
                onValidValue   = x => userNameHint.SetText("HINT_USER_CORRECT".Translated()),
                onValueChanged = x => createButton.interactable = AllCorrect,
            }.Setup();


            repeatObserver = new CredentialsObserver(ContextControler.RepeatedPassword)
            {
                onEmptyValue   = x => repeatHint.SetText("HINT_PASSWORD_REPEAT".Translated()),
                onInvalidValue = x => repeatHint.SetText("HINT_PASSWORD_MISMATCH".Translated()),
                onValidValue   = x => repeatHint.SetText("HINT_PASSWORD_MATCH".Translated()),
                onValueChanged = x => createButton.interactable = AllCorrect,
            }.Setup();

            passwordObserver = new CredentialsObserver(ContextControler.Password)
            {
                onEmptyValue   = x => passwordHint.SetText("HINT_PASSWORD".Translated()),
                onInvalidValue = x => passwordHint.SetText("HINT_PASSWORD_RULES".Translated()),
                onValidValue   = x => passwordHint.SetText("HINT_PASSWORD_OK".Translated()),
                onValueChanged = x =>
                {
                    createButton.interactable = AllCorrect;
                    repeatObserver.Observed.Validate();
                }
            }.Setup();
            createButton.interactable = AllCorrect;

            passwordColors = new CredentialsTextColors(passwordHint, passwordObserver);
            userNameColors = new CredentialsTextColors(userNameHint, userNameObserver);
            repeatColors   = new CredentialsTextColors(repeatHint, repeatObserver);
        }
        public override void Open()
        {
            base.Open();
            oldUserName.SetText(ContextControler.CurrentUserName);

            changeButton.interactable = false;

            userNameObserver = new CredentialsObserver(ContextControler.NewUserName)
            {
                onValueChanged = x =>
                {
                    if (x != userNameInput.text)
                    {
                        userNameInput.SetTextWithoutNotify(x);
                    }
                    changeButton.interactable = ContextControler.NewUserName.IsValid;
                },
                onEmptyValue   = x => hint.SetText("HINT_RENAME_USER_NEW".Translated()),
                onInvalidValue = x => hint.SetText("HINT_RENAME_RULES".Translated() + ContextControler.CurrentUserName),
                onValidValue   = x => hint.SetText("HINT_RENAME_OK".Translated())
            };

            userNameColors = new CredentialsTextColors(hint, userNameObserver);
        }