private void CheckBox_Checked(object sender, RoutedEventArgs e) { configViewModel = this.DataContext as ConfigSettingViewModel; if (configViewModel != null) { CheckBox chk = (CheckBox)sender; configViewModel.CheckCheckBoxValueChange(chk.Name, chk.IsChecked); } }
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { configViewModel = this.DataContext as ConfigSettingViewModel; if (configViewModel != null) { TextBox chk = (TextBox)sender; if (chk.Name != null && !chk.Name.Equals("")) { configViewModel.CheckTextValueChange(chk.Name, chk.Text); } } }
private void RadioButton_Click(object sender, RoutedEventArgs e) { configViewModel = this.DataContext as ConfigSettingViewModel; if (configViewModel != null) { RadioButton chk = (RadioButton)sender; string tag = string.Format("{0}", chk.Tag); if (tag != null && !tag.Equals("")) { configViewModel.CheckRadioButtonValueChange(tag, chk.Name); } } }
public void LoadCellValues(ConfigSettingViewModel setting) { ExceptionUtility.Try(() => { this._setting = setting; this._label.Hidden = true; this._textField.Hidden = true; this._button.Hidden = true; switch (setting.ControlType) { case ConfigSettingControlType.TextField: this._label.Hidden = false; this._textField.Hidden = false; switch (setting.Type) { case ConfigSettingType.Username: this._label.Text = StringLiterals.UsernameTextFieldPlaceholder; this._textField.Placeholder = StringLiterals.UsernameTextFieldPlaceholder; this._textField.MaxLength = 40; this._textField.AutocorrectionType = UITextAutocorrectionType.No; this._textField.AutocapitalizationType = UITextAutocapitalizationType.None; this._textField.ReturnKeyType = UIReturnKeyType.Next; this._textField.SecureTextEntry = false; this._textField.ValidationFunction = (s) => { if (s != null) { s = s.Trim(); } if (String.IsNullOrEmpty(s)) { _textField.TextColor = Colors.ErrorTextColor; return("Please enter a username"); } else { _textField.TextColor = UIColor.DarkGray; } return(null); }; break; case ConfigSettingType.Password: this._label.Text = StringLiterals.PasswordTextFieldPlaceholder; this._textField.Placeholder = StringLiterals.PasswordTextFieldPlaceholder; this._textField.MaxLength = 40; this._textField.ReturnKeyType = UIReturnKeyType.Next; this._textField.AutocorrectionType = UITextAutocorrectionType.No; this._textField.AutocapitalizationType = UITextAutocapitalizationType.None; this._textField.SecureTextEntry = true; this._textField.ValidationFunction = (s) => { if (s != null) { s = s.Trim(); } if (String.IsNullOrEmpty(s)) { _textField.TextColor = Colors.ErrorTextColor; return("Please enter a password"); } else { _textField.TextColor = UIColor.DarkGray; } return(null); }; break; case ConfigSettingType.ServerUri: this._label.Text = StringLiterals.ServerUriTextFieldPlaceholder; this._textField.Placeholder = StringLiterals.ServerUriTextFieldPlaceholder; this._textField.MaxLength = 150; this._textField.ReturnKeyType = UIReturnKeyType.Done; this._textField.AutocorrectionType = UITextAutocorrectionType.No; this._textField.AutocapitalizationType = UITextAutocapitalizationType.None; this._textField.SecureTextEntry = false; this._textField.ValidationFunction = (s) => { if (s != null) { s = s.Trim(); } if ((!AllowSubmitWithEmptyUriField) && String.IsNullOrEmpty(s)) { _textField.TextColor = Colors.ErrorTextColor; return("Please enter a server url"); } else if (ValidateUriFormat && !Uri.IsWellFormedUriString(ServerAliases.AliasToUri(s), UriKind.Absolute)) { _textField.TextColor = Colors.ErrorTextColor; return("Please enter a valid url"); } else { _textField.TextColor = UIColor.DarkGray; } if ((!AllowSubmitWithEmptyUriField) && s.Length <= 4) { _textField.TextColor = Colors.ErrorTextColor; return("Server url must be greater than 4 characters"); } else { _textField.TextColor = UIColor.DarkGray; } return(null); }; break; } this._textField.Text = setting.CurrentValue; break; case ConfigSettingControlType.Button: this._button.Hidden = false; switch (setting.Type) { case ConfigSettingType.LogoutButton: this._button.SetTitle(StringLiterals.LogoutButtonText, UIControlState.Normal); this._button.SetTitle(StringLiterals.LogoutButtonText, UIControlState.Disabled); this._button.SetTitleColor(Colors.ErrorTextColor, UIControlState.Normal); break; } break; } }); }